- Home
- Generators & Encoders
- HMAC Generator
HMAC Generator
Sign text with a shared secret using HMAC-SHA256. The calculation stays in your browser.
What it is for?What it is for?
HMAC proves that a message came from someone who knows a shared secret and was not changed on the way. Payment providers, Git hosts and many APIs sign webhooks and requests this way. Use this page to work out what signature your code should produce, or to find out why your check fails.
A signature, not a checksum
HMAC mixes the secret into the hash, so someone who can see the text still cannot produce the same signature without the secret. Both the secret and the text are read as UTF-8. This is SHA-256. It is the same construction used by many API signatures.
Example
With the secret key and the text The quick brown fox jumps over the lazy dog, the hex result is f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8. The result updates as you type, in hex and in Base64. Check which of the two the API expects.
Why a signature does not match
- The text is not byte for byte the same. Sign the raw request body; parsing and re-encoding JSON changes spaces and key order.
- A newline at the end of the text or the secret, often added when copying from a file.
- The provider signs more than the body, for example a timestamp, a dot and then the body. Read its documentation for the exact string.
- The secret is given as hex or Base64 and should be decoded first. This page uses the secret as plain text.
- A prefix such as sha256= in the header. Remove it before you compare.
In your server code, compare signatures with a constant-time function such as hash_equals in PHP.
It stays in the browser
The secret and the text are not sent to a server. The calculation runs in this tab.