HMAC Generator (SHA-256, SHA-512)
Developer ToolsCompute an HMAC of a message with a secret key, or check a webhook signature, without the key leaving your browser.
Computed in your browser with Web Crypto. The key, message and signature are never sent, stored or logged. Privacy
About
What the HMAC Generator does
The HMAC Generator signs a message with a secret key using HMAC with SHA-1, SHA-256, SHA-384 or SHA-512, the way webhooks and API requests are signed. The key can be text, hex or Base64, and a random key can be generated. Verify mode compares the result with an expected signature. It runs in your browser with Web Crypto, and nothing about a run is stored.
Steps
How to use it
- 1Paste the message: for a webhook, the exact raw request body.
- 2Enter the secret key and pick the algorithm.
- 3Copy the signature, or switch to Verify and paste the signature you received.
Example
A real run
Input
Message (raw request body):
{"id":"evt_1042","type":"order.paid","amount":6497}
Key: whsec_example_not_a_real_key (made up for this example)
Algorithm: HMAC-SHA256
Expected signature header: sha256=07bf6fc8edfa63bfc60277b79c2fc294f7349417459ccefc01d32656b18e0187Output
HMAC-SHA256: 07bf6fc8edfa63bfc60277b79c2fc294f7349417459ccefc01d32656b18e0187 Valid signature: the expected signature matches this message and key
The key is made up for this example. In Verify mode the expected signature, with its sha256= prefix, matches the HMAC of the exact body bytes.
Options
Every setting, and when to use it
- Algorithm
- HMAC-SHA256 is the common choice for webhooks and API signing; SHA-512 gives a longer signature; SHA-1 exists only for older systems that still require it.
- Key format
- Most webhook secrets are used as plain text. Choose Hex or Base64 when the secret is given as encoded bytes, and the bytes are decoded before signing.
- Verify
- Paste the signature from the request header, in hex or Base64; a prefix such as sha256= is ignored. The page says whether it matches the message and key.
Good to know
Common problems and limits
Messages up to 1 MB. The signature covers the exact bytes: re-serialized JSON, different spacing or line endings give a different result.
This tool does not log runs: the message, key and signature are never sent or saved, only a count that a signature was made.
For plain fingerprints without a key, use the Hash Generator; to read a signed token, use the JWT Decoder.
Audience
Who uses it
- Backend developersDebug a webhook integration by checking whether a delivery's signature matches your secret and the raw body.
- API developersProduce a reference signature while implementing request signing, to compare with your code's output.
- QA engineersCraft signed test payloads for webhook endpoints without writing a script.
FAQ
Frequently asked
What is the difference between HMAC and a hash?
A hash such as SHA-256 is computed from the message alone, so anyone can produce it. An HMAC mixes in a secret key, so only someone with the key can produce or check it. That proves the message came from the key holder and was not changed.
How do I verify a webhook signature?
Take the raw request body exactly as received, compute HMAC-SHA256 with your webhook signing secret, and compare it with the signature header, using a constant-time comparison in code. Many providers also sign a timestamp with the body to stop replays; check their documentation for the exact string that is signed.
Why doesn't my signature match?
The usual causes are signing a parsed and re-serialized body instead of the raw bytes, a trimmed or changed line ending, the wrong secret (test versus live), or comparing hex against Base64. Paste the exact raw body and try both output formats.
How long should an HMAC key be?
At least as long as the hash output: 32 random bytes for HMAC-SHA256 and 64 for HMAC-SHA512. Shorter keys weaken it; longer keys are hashed down first. The Random key buttons create keys of those lengths with a cryptographic random generator.
Is HMAC-SHA256 secure?
Yes. HMAC-SHA256 has no known practical attack and is used by major payment, cloud and code-hosting platforms for webhook and API signatures. Its security rests on keeping the key secret and long enough.
Is my secret key safe here?
The key and message are used only by your browser's Web Crypto, never sent to a server, and this tool does not save runs. For production secrets, prefer computing signatures in your own code or terminal.
Automation: an MCP tool hmac(message, key, algorithm) → signature and an n8n node are planned for this tool. Runs of this tool are never stored.