Guide
Computing and verifying HMAC signatures
A hash on its own proves nothing about who made a message, since anyone can compute it. An HMAC, a hash-based message authentication code, mixes in a secret key, so only a party who holds the key can produce or check the tag. That is why payment providers, code hosts and cloud APIs sign webhooks and requests with it, and why the HS256 algorithm in JWT is just HMAC-SHA-256. This page computes an HMAC for any message and key and verifies a signature you received.
How HMAC is built
RFC 2104 defines the construction. The key is padded to the hash’s block size and combined with two fixed byte patterns, an inner and an outer pad. The hash runs twice: once over the inner padded key followed by the message, and then over the outer padded key followed by that first result. This double wrapping avoids the length-extension attacks that break a naive hash of key plus message with SHA-256. A key longer than the block size is hashed first, which is why very long keys give no extra strength.
Checked example one: a webhook
The Sample buttons fill the message with {"event":"payment.succeeded","id":"evt_1042","amount":4999} and the key with whsec_test_key_do_not_use. With HMAC-SHA-256 the page shows 86ba756dfc43fd38855ef51267b699da9dcb1dec7af5e9cf3562ace26abd7aec, which is 32 bytes. The Base64 form is hrp1bfxD/TiFXvUSZ7aZ2p3LHex69enPNWKs4mq9euw= and the Base64URL form, which swaps / and + for _ and - and drops padding, is the one you would paste into a JWT. Paste that hex into the verify box and the page confirms a match; change one character of the message and it reports a mismatch.
Checked example two: RFC 4231
To test an implementation of your own, set the message to Hi There, change the key format to hex and enter twenty bytes of 0b. HMAC-SHA-256 is then b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7. Test vectors like this one are the quickest way to find whether a bug sits in the hash, the key handling or the encoding.
Encoding pitfalls
Most failed signature checks come from the bytes, not the algorithm. Hash the raw request body exactly as received: parsing and re-serialising JSON changes spacing and key order. Know whether the key is text, hex or Base64 and choose the matching format here. Remember that a trailing newline counts. Some services sign more than the body, such as a timestamp prefix; build that exact string first.
Algorithms
HMAC-SHA-256 is the modern default. SHA-512 and SHA-384 give larger tags, and SHA-3 and RIPEMD-160 appear in specific systems. HMAC-SHA-1 and HMAC-MD5 are still considered safe as MACs because the construction is robust to collisions, but use SHA-256 for anything new.
Limits
Do not paste a live production secret into any website, including this one, even though the calculation runs locally; use a test key. HMAC proves integrity and authenticity between key holders, and does not hide the message.
Related tools
- JWT Decoder shows how HS256 tokens carry an HMAC.
- PBKDF2 and HKDF Calculator derives keys to use with HMAC.
- BLAKE2 and BLAKE3 Hash Generator offers keyed hashing with BLAKE.
- Hash Generator computes the plain hash without a key.
Checked against the current version of the HMAC Generator on .

