Skip to main content
Tools

HMAC Generator

Compute HMAC-SHA256, SHA-384, SHA-512, SHA-1 and MD5 of a message with a secret key, and verify webhook or API signatures.

The key is only used in this tab’s memory. It is never stored or sent.

The key is empty, so anyone can compute the same HMAC and it proves nothing.

0 characters · 1 line

HMACs

Output format
HMAC-SHA-256
Computing…
HMAC-SHA-384
Computing…
HMAC-SHA-512
Computing…
HMAC-SHA-1Legacy
Computing…
HMAC-MD5Legacy
Computing…

HMAC-SHA1 and HMAC-MD5 are not practically broken yet, but use them only to talk to older systems. Choose HMAC-SHA256 or stronger for new ones.

Key 0 B, message 0 B

A server verifying an HMAC should use a constant-time comparison (such as Node.js crypto.timingSafeEqual) so attackers cannot guess the signature from response times. Comparing in your own browser carries no such risk.

How to use

  1. Enter the secret key and choose whether it is plain text (UTF-8), hex or Base64.
  2. Enter the message, such as the raw body of a webhook. HMAC-SHA256, SHA-384, SHA-512, SHA-1 and MD5 are computed instantly, all at once.
  3. Choose an output format: hex, Base64 or the Base64url used by JWTs.
  4. To check a signature you received, paste it into “Verify an HMAC” to see whether it matches and which algorithm it is.
  5. Click “Example” to load RFC 4231 test data (key “Jefe”) and compare with the specification.

FAQ

Is my key uploaded or stored?

No. HMACs are computed on your device with the browser’s built-in Web Crypto. The key and message are never sent to a server or saved in the browser, and they are gone when you close the tab. Only options such as the key and output formats are remembered.

How is an HMAC different from a plain hash like SHA-256?

Anyone can compute a hash, but computing the right HMAC requires the key. The receiver recomputes it with the same key and compares, which proves the message was not altered and came from someone who holds the key. Webhooks from GitHub, Stripe and many others are signed this way.

Why does my result differ from the server’s?

Common causes: a missing or extra trailing newline, JSON that was reformatted (use the raw body exactly as received), a key that is really hex or Base64 but was entered as text, or different output formats (hex vs Base64). Some services also prepend a timestamp to the message, so check their documentation.

What should I watch out for when comparing signatures?

On a server, use a constant-time comparison such as Node.js crypto.timingSafeEqual or Python hmac.compare_digest instead of ==, otherwise attackers may recover the signature byte by byte from response times. Comparing in your own browser carries no such risk.

How long should the key be? Are HMAC-SHA1 and HMAC-MD5 still safe?

RFC 2104 recommends a key at least as long as the output, for example 32 or more random bytes for HMAC-SHA256. HMAC-SHA1 and HMAC-MD5 have no practical attacks yet, but use them only for older systems you must interoperate with; choose HMAC-SHA256 or stronger for new ones.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.