Your webhook handler rejects every delivery. The provider swears the signature is correct, your code swears it is not, and both sides are looking at the same secret key. Arguments like this almost never turn out to be about the algorithm. They are about bytes: a newline one side added, a JSON body one side re-serialised before signing, a key one side read as hex and the other as plain text.

To settle it, you need a reference signer you can feed the exact message and the exact key, then compare outputs. That is what the free HMAC Generator on Ovatly does. It signs with your browser's Web Crypto API and shows the signature in hex and Base64, and neither the key nor the message is sent to a server. Developers use it to test webhook signatures, API request signing and message authentication without handing their secret to a third-party site.

Contents

  • Quick answer
  • What an HMAC actually proves
  • Hex or Base64: one signature, two spellings
  • How to create an HMAC signature, step by step
  • Worked example: a published test value you can reproduce
  • Why your signature does not match theirs
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

To create an HMAC signature for an API request: paste the exact message that will be signed, byte for byte, into the HMAC Generator, enter the shared secret key, pick SHA-256, SHA-384 or SHA-512, press Compute HMAC, and copy the signature in the format the receiving system expects, hex or Base64. Before you trust your own setup, reproduce the published test value in the worked example below. If your code produces a different value for those inputs, the bug is in the code, not in the tool.

What an HMAC actually proves

HMAC stands for hash-based message authentication code. It mixes a secret key into a hash of the message, so the output depends on both. Anyone who holds the key can produce the signature, and anyone who holds the key can check it: sign the message again and compare. If a single byte of the message changed on the way, the recomputed signature will not match, which is how the receiver knows the message arrived untouched.

Two consequences follow. First, an HMAC authenticates; it does not encrypt. The message itself travels in plain view, and the signature hides nothing about its contents. Second, because the same key both signs and verifies, HMAC suits shared-secret setups, where the two ends already trust each other with the key. It is not a public-key signature, where one side can verify without being able to sign.

The generator offers SHA-256, SHA-384 and SHA-512 only. HMAC-SHA-1 and HMAC-MD5 are legacy options and are deliberately omitted, so there is no way to talk yourself into a weaker choice.

Hex or Base64: one signature, two spellings

The tool shows every signature twice, as hex and as Base64. These are not two different signatures. They are the same bytes written in two encodings, the way the same number can be written in decimal or in binary. Neither is stronger, shorter in any way that matters, or more correct.

Use whichever the receiving system specifies. Most webhook providers document one format explicitly in their verification guide, and matching their documentation exactly removes one whole class of mismatch before you start. If a provider shows example signatures, count the characters: a SHA-256 signature is 64 hex characters, and noticeably shorter in Base64, which tells you which spelling they expect.

How to create an HMAC signature, step by step

  1. Open the HMAC Generator and paste the exact message that will be signed, byte for byte. Do not retype it, and do not tidy it up: whitespace and line endings are part of the message.
  2. Enter the shared secret key, exactly as your system stores it.
  3. Pick the algorithm your system uses: SHA-256, SHA-384 or SHA-512.
  4. Press Compute HMAC and copy the signature in the format your system expects, hex or Base64.

Worked example: a published test value you can reproduce

This example uses a published test value, so you can check both the tool and your own code against a known answer.

Key:        key
Message:    The quick brown fox jumps over the lazy dog
Algorithm:  HMAC-SHA-256
Signature:  f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8

Set the key to the word key, paste the message exactly as shown, choose SHA-256 and compute. The generator returns the signature above. Now run the same inputs through your own signing code. If your code produces a different value for these inputs, the bug is in the code, not in this tool, and you have a fixed reference point to debug against instead of a live webhook feed.

Why your signature does not match theirs

When two honest implementations disagree, the cause is almost always a byte-level difference between what each side actually signed. The usual suspects, in the order worth checking:

  • A trailing newline. A message saved from an editor or copied from a terminal often ends with a line break the other side never signed. A trailing newline changes the signature completely.
  • A different encoding. The same visible text can be different bytes underneath. Both sides must agree on how the text becomes bytes.
  • The key read the wrong way. A key stored as hex characters but treated as plain text, or the reverse, signs with entirely different key bytes.
  • A re-serialised body. Signing a JSON body after your framework has parsed and re-printed it is not signing the body that was sent. Key order, spacing and number formatting can all shift. Sign the raw bytes.

The fastest way through the list is the worked example above: prove your code against the published value first, then sign the disputed message in the generator and compare all three outputs.

Limitations and honest tradeoffs

The key and message are processed on your device only, which is the right design for a signing tool, but it does not make every machine safe: do not sign production secrets on a computer you do not trust, because the browser can only protect you from the network, not from the device itself.

An HMAC also cannot be undone. There is no decrypt step and no recovery of the message from the signature; verification is always re-signing and comparing. And because the key is shared, a signature proves the message came from a key holder, never from one specific person: anyone with the key could have produced it.

Finally, key quality is on you. A random key of 32 bytes or more is a sound default for HMAC-SHA-256. A short or guessable key undermines the scheme no matter which hash you pick.

Common mistakes

  • Signing the re-serialised JSON body instead of the raw bytes that were sent, then wondering why the provider disagrees.
  • Letting an editor add a trailing newline to the message before signing it.
  • Treating a hex key as text, or a text key as hex, so both sides sign with different key bytes while looking at the same string.
  • Expecting the signature to hide the message. HMAC authenticates a message; it does not encrypt it.
  • Reaching for HMAC-SHA-1 or HMAC-MD5 in a new system. They are legacy, and this tool omits them on purpose.

FAQs

Why does my signature not match the one from my API provider? Almost always a byte-level difference: a trailing newline, a different encoding, a hex key being treated as text (or the reverse), or signing a re-serialised JSON body instead of the raw bytes that were sent. Sign the exact bytes with this tool and compare; the side that differs from the reference output is where the bug sits.

Hex or Base64, which should I use? Whichever the receiving system specifies. They are the same bytes in two encodings, and most webhook providers document one explicitly.

How long should my secret key be? A random key of 32 bytes or more is a sound default for HMAC-SHA-256. Whatever length you choose, be consistent about whether the key is treated as text or as hex, because reading it the other way produces a different signature.

Can I decrypt an HMAC back to the message? No. HMAC is one-way. Verification means signing the received message again with the same key and comparing signatures.

Does the tool send my key or message to a server? No. The key and message are processed on your device only, using the browser's Web Crypto API. Even so, do not sign production secrets on a machine you do not trust.

Conclusion

Most HMAC bugs are byte bugs, not algorithm bugs. Sign the exact bytes, keep the key's format consistent, and prove your code against a published test value before you debug against a live system. The HMAC Generator gives you that reference signer in the browser, with nothing leaving your device. If signatures prove a message is genuine but you want to see how content itself gets hidden, our worked guide to how encryption works, with a hands-on AES example encrypts a real note and opens it again. For more guides in this series, see our Security and Privacy guides, which pair each technique with the free tool that performs it.

References