Quick access

Saved in this browser. Sign in to keep it on all your devices.

HMAC Generator & Verifier

Sign a message with a secret key, or check a webhook signature from GitHub, Stripe, Slack or Shopify. SHA-256, SHA-512, SHA-3 and more.

Private — your key never leaves this page

Paste the body exactly as received. Re-formatted JSON — even one changed space — gives a different signature.

No key yet — this is the HMAC with an empty key. Enter your secret above.

Signature

Header the sender adds


            

Signed JWT

Exact string that was signed

            

✓ Valid — the signature matches ().

✗ Doesn't match.

  • Is the body byte-for-byte what was received (no re-formatting, same line endings)?
  • Is it the right secret — for this endpoint, test mode vs live mode?
  • Same algorithm? A 64-character hex signature is SHA-256; 128 is SHA-512.

That doesn't look like a signature. Paste hex or Base64, with or without its prefix.

Verify it in your code


    

Hash vs HMAC

Anyone can compute a plain hash with the Hash Generator. An HMAC mixes in a secret key, so only someone who has the key can make a matching signature.

Compare in constant time

Check signatures with timingSafeEqual, hmac.compare_digest or hash_equals, never ==. Also reject old timestamps (Stripe and Slack suggest 5 minutes) to stop replayed requests.

Testing webhooks?

Catch a real request with the Webhook Tester, then paste its raw body and signature header here. For tokens, see the JWT Decoder.

Version 1.1 Updated What's new

Release notes

  1. v1.1 Latest
    • Added an in-depth guide below the tool, written from what the tool actually does.

About the HMAC Generator

An HMAC is a hash of a message combined with a secret key. Services like Stripe and GitHub sign webhooks with HMAC so the receiver can prove a request is genuine and was not changed on the way.

How to use it

  1. 1 Pick a scheme, such as Stripe webhook, or Custom.
  2. 2 Enter the secret key and paste the raw request body or message.
  3. 3 Paste the signature you received to check it, or copy the signature in hex or Base64.

Frequently asked questions

Why does my webhook signature not match?

Most often the body was parsed and re-serialised before hashing. Sign the exact raw bytes received. Also check the secret (test and live modes have different ones), and whether the expected output is hex or Base64.

What is the difference between a hash and an HMAC?

Anyone can compute a hash. An HMAC also needs the secret key, so only the sender and receiver can produce it.

Is HMAC-SHA256 secure?

Yes, with a long random key. Compare signatures with a constant-time function to avoid timing attacks, and reject old timestamps to stop replayed requests.

What does Stripe sign?

Stripe signs the timestamp, a dot, and the raw body ("t.body") with HMAC-SHA256 using your endpoint secret. The Stripe-Signature header carries the timestamp as t= and the hex signature as v1=.

Is my secret key sent anywhere?

No. Signing runs in your browser and the key is never saved or uploaded. Use a test key anyway when you can.

Can I make a JWT here?

Yes. Choose JWT, enter the payload JSON and the secret, and you get a signed HS256, HS384 or HS512 token you can open in the JWT Decoder.

How HMAC-SHA256 is built

HMAC wraps a normal hash function around the key twice. The key is first padded to the block size of the hash (64 bytes for SHA-256; longer keys are hashed down first). It is mixed with one constant to make an inner key and with another to make an outer key. The result is H(outer key + H(inner key + message)). This two-step design is why an HMAC is safe even with hashes such as SHA-256 that would be open to length-extension attacks if you simply hashed key + message.

Check your setup with a known answer

RFC 4231 publishes test values for HMAC-SHA256. With the key Jefe and the message what do ya want for nothing? the hex result must be:

5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843

If your code gives anything else for this input, the problem is in your code (often the key and message are swapped, or a newline sneaked in), not in the webhook provider.

Verify a webhook signature in Node.js and Python

// Node.js
const crypto = require('crypto')
const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex')
const ok = expected.length === received.length &&
  crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(received))

# Python
import hmac, hashlib
expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
ok = hmac.compare_digest(expected, received)

rawBody must be the bytes exactly as they arrived. In Express, read it with express.raw() on the webhook route; in Flask, use request.get_data().

Where providers put the signature

  • GitHub: X-Hub-Signature-256 header, hex HMAC-SHA256 of the body, prefixed with sha256=.
  • Shopify: X-Shopify-Hmac-Sha256 header, Base64 HMAC-SHA256 of the body.
  • Slack: X-Slack-Signature, v0= plus the hex HMAC-SHA256 of v0:timestamp:body, with the timestamp in X-Slack-Request-Timestamp.
  • Stripe: Stripe-Signature, with t= and v1= values as described in the questions above.

Strip the prefix (sha256= or v0=) before comparing, and decode Base64 only when the provider uses it.