HMAC Generator
Compute HMAC signatures with SHA-1, SHA-256, SHA-384 or SHA-512 — hex or base64 output, key as text or hex, all inside your browser.
An HMAC is a signature a shared secret makes possible: both sides hold the same key, one side signs a message with it, and the other recomputes the signature to prove the message arrived unchanged and from someone who knows the key. It is the mechanism behind webhook signatures, signed API requests and session tokens. The computation here is done by your browser’s own Web Crypto engine — the same standardised implementation your banking app uses — and it is exact, not illustrative. Worked example, the standard test vector from RFC 4231 (test case 1): a key of twenty bytes each equal to 0x0b, signing the message “Hi There”, gives HMAC-SHA-256 b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7 — set the key format to hex, type 0b twenty times over (0b0b0b…), and this page reproduces that digest digit for digit, as it does the SHA-1 and SHA-512 vectors from the same RFC.
Your key and message never leave this device: the HMAC is computed by your own browser’s Web Crypto engine in page memory, and the key and message are never uploaded, stored or put into a link. Close the page and both are gone. Even so, treat a real production secret with care — prefer testing with a throwaway key.
Quick answers
How do I generate an HMAC-SHA-256 signature?
Choose SHA-256, enter the key (text as UTF-8, or hex if your key is given in hex), type the exact message, and read the signature as hex or base64. The standard check: key of twenty 0x0b bytes over “Hi There” gives b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7.
Computation is done by your browser’s Web Crypto engine on your device — the key and message never leave the page.
Why do HMAC signatures fail to verify?
Byte mismatches, in practice: key read as text instead of hex, a message with a trailing newline the other side did not sign, or a hex signature compared against a base64 one. Check byte counts and encoding first — the algorithm itself is deterministic.
This page reports the key and message byte counts and shows both output encodings precisely so those three causes can be ruled out one by one.
How to use
- Choose the hash algorithm your protocol specifies — SHA-256 is the common default for webhook signatures and API signing; SHA-1 remains only for legacy protocols that still name it.
- Enter the secret key, and say whether it is plain text (read as UTF-8 bytes) or hex (decoded byte by byte). The same characters mean different bytes in the two modes, and the result line states the key length so you can check.
- Type or paste the message exactly as it will be signed — every byte counts, including trailing newlines and the order of any fields you concatenated to build it.
- Read the signature as hex or base64, whichever your verifier expects, and compare like for like: a hex signature will never match a base64 one even when both are correct.
About this tool
Two practical warnings decide whether real-world signatures verify. First, key encoding: a key given as text is signed as its UTF-8 bytes, while the same characters read as hex are entirely different bytes — most “my HMAC never matches” bugs are this, or a message that differs by one trailing newline, which is why the result line reports both byte counts. Second, secrecy: an HMAC key is a password-grade secret, and while this page computes entirely on your device — the key and message never leave it, are never uploaded, stored or put into a link, and vanish when the page closes — the right habit is to test with throwaway keys and sign production payloads in your own infrastructure. Note also what HMAC is not: it authenticates, it does not encrypt; anyone can read the message, they just cannot forge the signature without the key.
Frequently asked questions
Which algorithm should I choose?
Whichever your protocol specifies — the signer and verifier must match exactly. SHA-256 is the current default for webhooks and APIs; SHA-384 and SHA-512 serve protocols that name them; SHA-1 appears in legacy systems and should only be used where the protocol still requires it.
Why does my signature not match the one from my server?
Almost always one of three byte-level causes: the key was read as text where the server used hex (or the reverse), the message differs by an invisible byte such as a trailing newline, or the outputs are being compared in different encodings — hex against base64. This page shows key and message byte counts and both encodings so each cause can be eliminated in turn.
Is it safe to paste a real secret key here?
The computation is performed by your own browser’s Web Crypto engine in page memory; the key is never uploaded, stored, sent or written into the address, and it disappears when the page closes. That said, the disciplined habit is to verify integrations with a test key and keep production secrets inside your own systems.
What is the difference between the hex and base64 outputs?
Nothing but spelling: both encode the same signature bytes. Hex writes each byte as two characters (a SHA-256 signature becomes 64 characters); base64 packs them tighter (44 characters). Verifiers expect one specific form — match the form your protocol names.
First time embedding? Read the step-by-step guide →
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
JSON Formatter & Validator
Format, minify and validate JSON in one click.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
Regex Tester
Test, check and validate regular expressions with live highlighting.
JWT Decoder
Decode a JWT token without the secret — see its header and payload.
SHA-256 Hash Generator
Generate SHA-256 / SHA-512 hashes instantly.