Use this free HMAC generator to create a keyed signature for a message, or to check that a signature matches. Enter a secret key, the message, and an algorithm, then copy the signature in hex or Base64. Everything is calculated in your browser with the standard Web Crypto API, so the key and message are never sent to a server.

An HMAC proves a message came from someone who knows the key and was not changed. It does not hide the message, so use it for authenticity, not secrecy.

How to use the HMAC generator

  • Create a signature: enter the secret key and the message, pick an algorithm, and copy the result.
  • Verify a signature: switch modes, enter the key and message, and paste the signature you received.
  • Algorithm: HMAC-SHA256 is the common choice for APIs and webhooks. SHA-512 is also widely used.
  • Output: choose hex or Base64 to match the system you are working with.

How an HMAC is calculated

  • Key padding: the key is padded or hashed so it fits the hash block size.
  • Inner hash: the padded key is XORed with an inner pad, then hashed with the message.
  • Outer hash: the padded key is XORed with an outer pad, then hashed with the inner result.
  • Result: the output has the same length as the chosen hash, for example 32 bytes for SHA-256.

Common HMAC algorithms at a glance

AlgorithmOutput lengthTypical use
HMAC-SHA25632 bytes (64 hex characters)Webhooks, API request signing, and tokens.
HMAC-SHA51264 bytes (128 hex characters)Systems that want a longer output.
HMAC-SHA38448 bytes (96 hex characters)Systems that standardise on SHA-384.
HMAC-SHA120 bytes (40 hex characters)Legacy systems only. Not recommended for new designs.

Worked example

With the key "key" and the message "The quick brown fox jumps over the lazy dog", HMAC-SHA256 gives f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8 in hex. Change one letter of the message and the signature changes completely.

Common HMAC mistakes

  • Comparing signatures with ==. Use a constant-time comparison in your own code so timing does not leak information.
  • Mismatched encoding. A signature in Base64 will not match one in hex, even if the bytes are the same.
  • Hashing the key instead of using it. The key is an input to HMAC, not a value to hash first.
  • Signing the wrong text. Whitespace, line endings, and JSON key order all change the signature.

Frequently asked questions

Is this HMAC generator free?

Yes. There is no sign-up and no limit on how many signatures you create or check.

Is my key or message sent or stored?

No. The signature is calculated in your browser and nothing is sent to a server. Fields are cleared when you click Clear or close the page.

Is HMAC the same as hashing a password?

No. An HMAC needs a secret key and checks messages. Password storage uses a dedicated function such as bcrypt, scrypt, or argon2.

Does an HMAC encrypt my message?

No. The message stays readable. An HMAC only proves that it came from someone with the key and was not changed.

Which algorithm should I choose?

Use the algorithm your API or webhook provider specifies. If you have a choice, HMAC-SHA256 is a safe default.

Share this article