What is HMAC?
HMAC (Hash-based Message Authentication Code) combines a secret key with a cryptographic hash function to produce a digest that authenticates a message. Receivers with the same secret can recompute the digest and confirm the message was not changed and came from a trusted party.
Generate vs verify
Generate creates a new digest from your secret and message. Verify recomputes the digest and compares it to an expected value. Use the same algorithm and encodings on both sides or verification will fail even when the secret is correct.
Choosing an algorithm
- HMAC-SHA256: Default for most APIs and webhooks.
- HMAC-SHA512: Larger digest when policies require it.
- HMAC-SHA1: Still seen in older systems; prefer SHA-256 for new work.
- Key length: Prefer a random secret at least as long as the hash output when possible.
Using this HMAC tool
All signing runs in your browser with the Web Crypto API. Secrets and messages are not uploaded. For encoding payloads or inspecting tokens, see the Base64 Encoder and JWT Decoder.