HMAC Generator
Generate HMAC signatures using SHA-256, SHA-384, or SHA-512 with custom secret keys for message authentication.
HMAC Generator tool
Example
Input: Message "what do ya want for nothing?", secret key "Jefe", algorithm SHA-256
Result: 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
This is RFC 4231 test case 2. HMAC hashes the key-padded message twice (inner and outer pad), giving a 32-byte (256-bit) signature for SHA-256.
HMAC Output Sizes
| Algorithm | Bytes | Bits | Hex characters | Base64 characters |
|---|---|---|---|---|
| HMAC-SHA256 | 32 | 256 | 64 | 44 |
| HMAC-SHA384 | 48 | 384 | 96 | 64 |
| HMAC-SHA512 | 64 | 512 | 128 | 88 |
Measured from the RFC 4231 test case 2 signatures. Use the length to spot a wrong algorithm or encoding.
- Enter the message you want to sign.
- Type your secret key into the key field.
- Choose the hash algorithm: SHA-256, SHA-384 or SHA-512.
- Click "Generate HMAC" to compute the signature in hex. Turn on Uppercase if needed.
- Copy the result to compare it with a signature or use it in your request.
HMAC Signatures for Webhooks and APIs
HMAC (hash-based message authentication code) is a signature made from a message plus a secret key. This generator computes HMAC-SHA256, HMAC-SHA384 or HMAC-SHA512 in your browser and shows the result in hex. Use it to check a webhook signature or to test code that signs API requests.
A plain hash shows that data has not changed, but anyone can compute one. HMAC mixes in a shared secret, so only someone who holds the key can make the right value. GitHub and Stripe use HMAC-SHA256 this way. They sign each webhook with your endpoint secret and send the signature in a header. Your server computes it again and rejects the request if the two do not match.
Most mismatches come from the input, not the math. Sign the exact raw body the service sent. Reformatted JSON, an extra newline or a trimmed space changes the result. Some services sign more than the body. Stripe, for example, signs the timestamp, a dot and then the payload. Check the header format as well: GitHub puts sha256= in front of its hex signature, and Shopify sends Base64 instead of hex.
The key and message are read as UTF-8 text. The result shows its length, which is 32 bytes for SHA-256, 48 for SHA-384 and 64 for SHA-512. MD5 and SHA-1 are not offered. The Web Crypto API does the work, so neither the key nor the message leaves your device. For a digest without a key, use the Hash Generator. To read a token signed with HMAC, try the JWT Decoder.
Sources
Frequently Asked Questions
Related Tools
Hash Generator
Create MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files, right in your browser.
Security and EncryptionBcrypt Hash Generator and Verifier
Generate bcrypt hashes with configurable rounds and verify passwords against existing bcrypt hashes.
Security and EncryptionText Encryption and Decryption
Encrypt and decrypt text using AES-256 encryption entirely in your browser. No data sent to servers.
Security and EncryptionJWT Decoder
Decode JSON Web Tokens to inspect header, payload, and signature without needing the secret key.
Developer Tools