How to use
- Pick the algorithm (HMAC-SHA256, SHA384 or SHA512). SHA256 is the most common when nothing is specified.
- Enter the secret key. If the key is given as hex or Base64, switch the key format to match, or the result will differ. Text is converted to UTF-8 bytes.
- Enter the message and the result appears at once as hex (lower and upper case), Base64 and Base64URL. The page opens with the RFC 4231 example (key
Jefe) filled in. - If you received a signature from a webhook or API, paste it into Verify a signature. It tells you straight away whether it matches.
What HMAC does
An HMAC is a confirmation stamp that only someone who knows the secret key can produce. When the value arrives with a message, the receiver recomputes it with the same key. If it matches, the message was not altered on the way and came from a holder of the key. Unlike a plain hash, the value cannot be forged without the key. It does not hide the content, though. To hide content, use AES Encrypt and Decrypt.
| Algorithm | Output length | Hex characters | Base64 characters |
|---|---|---|---|
| HMAC-SHA256 | 32 bytes | 64 | 44 (with = padding) |
| HMAC-SHA384 | 48 bytes | 96 | 64 |
| HMAC-SHA512 | 64 bytes | 128 | 88 (with padding) |
A check value: key Jefe and message what do ya want for nothing? give an HMAC-SHA256 of 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843 (RFC 4231 test case 2). This tool’s output was checked against the RFC 4231 vectors and Node.js crypto.
Signature formats by service
| Service | What is signed | Notation |
|---|---|---|
GitHub webhook (X-Hub-Signature-256) |
the body exactly as received | sha256= + hex |
Shopify webhook (X-Shopify-Hmac-Sha256) |
the body exactly as received | Base64 |
Stripe (Stripe-Signature) |
timestamp.body |
v1= hex inside the header |
Slack (X-Slack-Signature) |
v0:timestamp:body |
v0= + hex |
Each service builds the signed string differently, so build the same string in the message box using the table above. A prefix such as sha256= is stripped by the verify box automatically. Check each service’s documentation for the current specification.
Watch out for
- If you parse a webhook body as JSON and serialize it again, spacing and key order change and the signature no longer matches. Compute over the raw text you received.
- In server code, compare signatures with a constant-time function (such as Node’s
crypto.timingSafeEqual) instead of==. - The key should be long and random. Make one of 32 or more characters with the Password Generator. Avoid typing a real production key into any outside site and check with a test key instead.
- A key longer than the block size (64 bytes for SHA256, 128 for SHA512) is hashed down first. The result follows the standard rule.
FAQ
How is HMAC different from a plain hash?
Anyone can compute a plain hash, so it cannot prevent forgery. An HMAC mixes in a secret key, so a correct value cannot be made without it. For file integrity alone, the Hash Generator is enough.
What should I check when my webhook signature never matches?
The usual causes are a changed body (JSON re-serialized, a trailing newline removed), a key encoding mix-up (text versus hex), an algorithm mismatch (SHA256 versus SHA512), and comparing hex against Base64. Change them one at a time to find out.
Why no SHA-1 HMAC?
HMAC-SHA1 has not been broken, but new designs are advised to use SHA-256 or stronger, so this tool offers SHA256, SHA384 and SHA512 only.
Is JWT HS256 the same thing?
Yes. A JWT HS256 signature is HMAC-SHA256 over the header.payload string, written in Base64URL. You can read the token contents with the JWT Decoder.
Is the key sent to a server?
No. It is computed inside this page, and the key and message are never sent or stored.
Related tools
- For plain hashes use the Hash Generator, and for encryption AES Encrypt and Decrypt.
- To decode a Base64 value, use the Base64 Encoder and Decoder.
The key and message you enter are processed only in your browser and never sent to a server.