HMAC Generator — Hash-based Message Authentication Codes
Hash or verify HMAC tags — with webhook signature presets for Stripe, GitHub, and Slack. Runs entirely in your browser.
Your input never leaves your device; HMAC is computed locally using the Web Crypto API.
What is HMAC Generator?
HMAC (Hash-based Message Authentication Code) combines a cryptographic hash function with a secret key to create a message authentication code. It verifies both the integrity and authenticity of a message. HMAC is the "H" in HS256 — sign and verify JWTs with our JWT tool.
Zero-Server Tool Data Guarantee
All computation happens locally in your browser using the Web Crypto API. Your message and secret key are never sent to any server.
How to Use
Enter Message
Type or paste the message (or webhook payload) you want to authenticate.
Enter Secret Key
Provide a secret key that is shared between the sender and receiver.
Select Algorithm or Preset
Choose SHA-256/SHA-512, or pick a Stripe, GitHub, or Slack preset to build the exact signature header those services expect.
Copy the HMAC
The HMAC is computed instantly. Use the copy button to save the hex string or the full webhook header.
Common Use Cases
API Request Signing
Sign each API request with HMAC so the server can verify it wasn't modified in transit and came from a trusted client.
Webhook Verification
Many services (Stripe, GitHub, Slack) send HMAC signatures with webhooks. Verify them to ensure requests are authentic.
JWT (HS256/HS512)
HMAC is the 'H' in HS256 — it's used to sign JWTs when you want symmetric (shared-secret) authentication.
Data Integrity
Append an HMAC tag to sensitive data (like cookies or URLs) and verify it before processing to detect tampering.
Implementation Examples
async function hmacSign(message, secret, algo = 'SHA-256') {const enc = new TextEncoder();const key = await crypto.subtle.importKey('raw', enc.encode(secret),{ name: 'HMAC', hash: algo }, false, ['sign']);const sig = await crypto.subtle.sign('HMAC', key, enc.encode(message));return Array.from(new Uint8Array(sig)).map(b => b.toString(16).padStart(2, '0')).join('');}const mac = await hmacSign('hello', 'my-secret-key');// "c0e5d7337d0470a..."
HMAC vs Plain Hash vs Digital Signature
| Feature | HMAC | Plain Hash (SHA-256) | Digital Signature (RSA/ECDSA) |
|---|---|---|---|
| Provides integrity? | Yes | Yes | Yes |
| Provides authenticity? | Yes (shared key) | No | Yes (public key) |
| Key type | Symmetric (shared) | None | Asymmetric (public/private) |
| Performance | Fast | Fastest | Slow (especially RSA) |
| Use case | API auth, webhooks | Checksums, dedup | Code signing, certificates |
| Non-repudiation? | No (both parties have key) | No | Yes |
Production Best Practices & Security
Frequently Asked Questions
HMAC (Hash-based Message Authentication Code) is a keyed-hash construct defined in RFC 2104 and FIPS 198-1. It uses a cryptographic hash function (like SHA-256) combined with a secret key to produce a fixed-length authentication tag.
Unlike a plain hash — which anyone can compute — HMAC ensures that only parties who possess the shared secret key can generate or verify the tag.
This makes HMAC essential for API authentication (where the server verifies requests come from an authorized client), JWT signatures (HS256), and any scenario requiring both message integrity and origin authenticity.