Developer tools

HMAC Generator

HMAC Generator

Compute HMAC-SHA256, SHA-512, SHA-1 or MD5 of a message with a secret key.

About this tool

About HMAC Generator

An HMAC is a hash that only someone holding the secret key can produce, which is why payment gateways, chat platforms and cloud APIs use it to sign webhooks and requests. Enter the message and your secret key and you get the HMAC with SHA-256, SHA-512, SHA-384, SHA-1 and MD5 at the same time, so you can see which one a provider uses without guessing. Keys can be typed as plain text or pasted as hex or Base64, which matters because many services hand out secrets in an encoded form and expect the decoded bytes. Choose hex, HEX, Base64 or Base64URL output to match the signature header you are comparing against, then paste that header into Compare with expected hash to confirm it. The message is hashed as UTF-8, exactly as most server libraries do. Everything runs in your browser (Web Crypto for the SHA family, a bundled library for MD5), so the secret key never leaves your device.

Built and maintained by Abhi JainUpdated

How to Generate an HMAC

  1. 1

    Enter the message

    Paste the exact message or request body into Text to hash.

  2. 2

    Add the secret key

    Type it into Secret key and set Key is to Text, Hex or Base64 to match how the key was given to you.

  3. 3

    Compare

    Pick the Output format and paste the received signature into Compare with expected hash.

HMAC Generator: questions and answers

What is the difference between a hash and an HMAC?

Anyone can compute a plain hash of a message, so it only detects accidental changes. An HMAC (RFC 2104) also needs the secret key, so it proves the message came from someone who has the key and was not altered.

Why doesn't my HMAC match the provider's signature?

Check four things: you hashed the raw body byte for byte (not re-serialised JSON), the key is in the right form (text vs Base64 or hex), the algorithm matches, and the output encoding (hex vs Base64) matches the header.

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. Longer keys than the hash's block size are hashed first and add no strength.

Is HMAC-MD5 or HMAC-SHA1 still safe?

HMAC remains secure even with MD5 and SHA-1 because its security does not depend on collision resistance, but both are deprecated. Prefer HMAC-SHA256 for anything new.