HMAC Generator — Guide

Generate HMAC signatures online with SHA-256/SHA-512 and a secret key — debug webhook signature mismatches, output hex or Base64. Keys stay in your browser.

What it is and when to use it

A hash tells you something is intact; an HMAC tells you the right person made it. That difference is why webhook signatures, API request signing and cookie integrity all use HMAC instead of a plain SHA: the computation mixes a secret key with the message, so only someone holding the same key can reproduce the tag. Three practical rules fall out of the construction. One: the key must match on both sides byte-for-byte — trailing newlines and spaces copied from a dashboard are the number-one cause of "my signature never matches", so paste exactly, not loosely. Two: compare signatures in constant time on the server; a naive string comparison leaks how early the first wrong byte is, and that is an oracle. Three: order matters — HMAC covers the exact bytes you feed it, so JSON that re-serializes with different key order produces a different tag; sign the raw body, not the reparsed object. The algorithm choice is usually boring: SHA-256 is the default for good reason, SHA-512 is marginally faster on 64-bit CPUs, and SHA-1 HMAC is not broken for the MAC construction but no one should be choosing it in new systems. Nothing here is stored or transmitted; the secret stays in the tab while you compute.

Computes an HMAC with MD5, SHA-1, SHA-2, SHA-3 or RIPEMD-160 from a message and a shared key — for API request signing and verifying a message origin.

How to use it

  1. Enter the message
  2. Enter the key
  3. Choose a hash algorithm to get the HMAC

A worked example

Fill in a sample message

hello world

Copy this into the tool, or open HMAC Generator

Things that trip people up

  • HMAC depends on the key: a different key gives a completely different result, so both sides must agree on it

Questions people ask

Why not just hash the message?
A plain hash proves integrity but not authorship — anyone can recompute it for a tampered message. HMAC mixes in a shared secret, so only key holders can produce a valid tag.
My signature differs from the server every time — common causes?
Key copied with an extra newline or space, signing the re-serialized JSON instead of the raw body bytes, or hashing the hex string instead of the text. Match byte-for-byte against the raw payload.
Is HMAC-SHA1 still safe?
As a MAC, no practical break is known, but it signals outdated defaults. Use SHA-256 for new systems; it is the boring correct answer.
Should the server compare with ==?
No — use a constant-time comparison. Ordinary equality leaks the position of the first differing byte through timing, which over many requests becomes an attack surface.

Next steps

Open the HMAC Generator tool

Spotted something wrong on this page? Tell us via Contact Us