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.
0 characters · 1 line
HMACs
Computing…Computing…Computing…Computing…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.
Shortcut: Ctrl/⌘ + Enter copies all
How to use
- Enter the secret key and choose whether it is plain text (UTF-8), hex or Base64.
- 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.
- Choose an output format: hex, Base64 or the Base64url used by JWTs.
- To check a signature you received, paste it into “Verify an HMAC” to see whether it matches and which algorithm it is.
- 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.
Related tools
Hash Generator
Compute MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text at once, and check them against an expected value.JWT Decoder
Decode a JWT’s header and payload, explain standard claims like exp and iat, and see whether it has expired. Decodes only; never verifies or uploads.Base64 Encode/Decode
Encode text to Base64 or decode it back, with full UTF-8 support for Chinese and emoji and a URL-safe option.Password Generator
Create strong random passwords with your browser’s secure random generator. Pick the length and character sets, or make many at once.