HMAC Generator
Create and verify HMAC signatures with SHA-256, SHA-512, SHA-1, MD5, SHA-3 and more, using text, hex or Base64 keys.
This guide is not yet available in your language and is shown in English.
Tool guide
What this tool does
HMAC Generator computes RFC 2104 keyed hashes over text, raw bytes or whole files with 20 hash functions. Enter the shared secret as text, hex or Base64, add a webhook prefix such as sha256= and paste a received signature to check it matches.
An HMAC proves that a message came from someone who knows a shared secret and was not altered on the way. Payment providers, GitHub, Slack and most webhook senders sign each request body with HMAC-SHA256, and many REST APIs sign requests the same way. When a signature check fails you need to recompute the value yourself to see whether the body, the key or the encoding is wrong.
This tool implements HMAC as defined in RFC 2104: the key is padded to the hash block size (64 bytes for SHA-256, 128 for SHA-512, hashed first if longer), XORed with the inner and outer pads, and the message is hashed twice. It supports MD5, SHA-1, the SHA-2 and SHA-3 families, Keccak, BLAKE2, RIPEMD-160, Whirlpool and SM3 through WebAssembly. Keys and messages can be UTF-8, hex or Base64, files are streamed, and everything runs locally so secrets never leave the page.
How to use HMAC Generator
- Choose Text or File as the message source.
- Enter the Secret key, or click Random key to create a 256-bit key in hex.
- Set “Key is” and “Message is” to match how your values are encoded.
- Pick the Hash function, for example HMAC-SHA-256.
- Choose the Output format and, for webhooks, a Signature prefix such as sha256=.
- Paste a received value into “Verify against signature” to see Match or Does not match, then copy the result.
Tips for better results
- RFC 4231 test case 2 is a quick self-check: key “Jefe” and message “what do ya want for nothing?” give HMAC-SHA-256 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843.
- GitHub sends X-Hub-Signature-256 as sha256= followed by lowercase hex of the raw body, signed with your webhook secret.
- Slack signs the string v0:timestamp:body, so paste that exact basestring as the message, not just the body.
- Keys from dashboards are often hex or Base64 encoded. Treating them as plain text is the most common cause of a mismatch.
Common use cases
- Debugging a webhook endpoint that rejects valid-looking requests.
- Creating signed test requests for an API that uses HMAC authentication.
- Checking an HMAC implementation against known test vectors.
- Computing a keyed checksum of a file so only holders of the key can produce it.
Common mistakes to avoid
- Signing a re-formatted body. Parsing and re-serialising JSON changes spacing or key order and therefore the signature.
- Mixing up hex and Base64 output when comparing with a header value.
- Comparing signatures in production code with ordinary string equality instead of a constant-time comparison, which can leak timing information.
Frequently asked questions
What is the difference between HMAC and a plain hash?
Anyone can compute SHA-256 of a message, so a plain hash only detects accidental change. An HMAC also needs the secret key, so it proves authenticity as well as integrity.
Is HMAC-SHA1 or HMAC-MD5 still safe?
Collision attacks on SHA-1 and MD5 do not directly break HMAC, and both remain hard to forge today. New designs should still use HMAC-SHA-256 or stronger.
How long should the key be?
At least as long as the hash output: 32 random bytes for HMAC-SHA-256. Longer keys add nothing because keys above the block size are hashed down first.
Is my secret key sent anywhere?
No. The HMAC is computed in your browser and the key is not stored in saved projects.
Feedback & suggestions
Help us improve HMAC Generator. We read every message.