1. Home
  2. Developer
  3. HMAC Generator

HMAC Generator

Compute HMAC-SHA256, 384 or 512 as hex or Base64, and compare with a received signature.

Runs in your browser · No upload
The secret shared with the server. The key never leaves this page.
For webhooks, paste the received body exactly as is. Even a newline or space changes the result.

HMAC result | HMAC-SHA256, 32 bytes = 256 bits

Hex (lowercase)
5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
Base64
W9zBRr9gdU5qBCQmCJV1x1oAPwidJzmDnexYuWTsOEM=
Base64URL (no padding)
W9zBRr9gdU5qBCQmCJV1x1oAPwidJzmDnexYuWTsOEM
Hex (uppercase)
5BDCC146BF60754E6A042426089575C75A003F089D2739839DEC58B964EC3843

Verify a signature

Compared whatever the prefix such as sha256=, letter case, colons, or hex or Base64 form.

The HMAC is computed only on this device. The key and message are never sent or stored.

How to use

  1. Pick the algorithm (HMAC-SHA256, SHA384 or SHA512). SHA256 is the most common when nothing is specified.
  2. 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.
  3. 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.
  4. 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.

The key and message you enter are processed only in your browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.