Free HMAC Generator: HMAC-SHA-1, SHA-256, SHA-384, SHA-512 in Your Browser
Compute HMAC signatures via the browser's native Web Crypto API — the same primitive used by AWS Sig V4, GitHub webhooks, Stripe, and JWT HS256. Hex, Base64, and Base64URL output. Keys and messages never leave your browser.
Default for modern API signing (AWS Sig V4, GitHub webhooks, Stripe, JWT HS256).
Key bytes: 15 · Recommended ≥32⚠ shorter than hash output — reduces effective security
—Most standard signing protocols (AWS, GitHub, Stripe)
—PHP, Java, generic HTTP headers
—JWT signatures, OAuth — URL-safe alphabet, no padding
HMAC alone does not prevent replay attacks. For request signing, always include a timestamp and a nonce in the signed payload, and reject requests older than a short window (5-15 minutes is standard).
Four Algorithms
HMAC-SHA-1 (legacy compatibility), SHA-256 (modern default), SHA-384, and SHA-512 — covering JWT HS256/384/512, AWS Sig V4, GitHub webhooks, and TOTP.
Three Output Formats
Hex (lowercase, standard for most signing protocols), Base64 (PHP, Java APIs), Base64URL (JWT signatures, OAuth). One-click copy for each format.
Native Web Crypto
Uses crypto.subtle.importKey + sign — the browser's vetted implementation. No JavaScript SHA implementation; exact same bytes a Node.js or Python HMAC would produce.
100% Client-Side
Secret keys are highly sensitive. They never leave your browser tab. No fetch, no analytics, no logging. Works offline once loaded.
Keyed Message Authentication, Done in the Browser
HMAC is the workhorse of API authentication. AWS Sig V4 chains HMAC-SHA-256 four times through derived keys. GitHub signs every outgoing webhook with HMAC-SHA-256 and sends an X-Hub-Signature-256 header for receivers to verify. Stripe does the same. JWT HS256 / HS384 / HS512 are all HMAC variants. If you are doing anything secret-keyed at the API boundary in 2026, you are computing HMACs. Our Free HMAC Generator uses the browser's native Web Crypto API — the same vetted implementation that powers HTTPS and TLS — so the bytes you see here are exactly what a Node.js, Python, or Go HMAC of the same inputs would produce. Useful for sanity-checking signatures during development, debugging webhook receivers, or generating JWT HS256 secrets to paste into a config.
Pair this with our Hash Generator (one-way hashes without a key), JWT Decoder (inspect HS256/384/512 JWT signatures), Password Generator (generate strong random HMAC secrets), and the UUID Generator (produce request IDs to include as nonces in signed payloads).
Plain Hash vs HMAC — When Each Applies
| Aspect | Plain Hash (SHA-256, MD5) | HMAC (HMAC-SHA-256, etc.) |
|---|---|---|
| Inputs | One: the message | Two: message + secret key |
| Purpose | Detect accidental corruption; one-way mapping | Detect tampering by attackers; authenticate sender |
| Security model | No secret — anyone can compute and verify | Verifier needs the secret; attackers without it cannot forge |
| Output length | Same as underlying hash (e.g. 256 bits for SHA-256) | Same as underlying hash |
| Replay protection | None inherent | None inherent — include timestamp + nonce in the signed payload |
| Length-extension | SHA-1, SHA-2 vulnerable when used as raw signature | Designed to defeat length-extension attacks (RFC 2104) |
Where HMAC Is Standard in 2026
| Context | How HMAC Is Used |
|---|---|
| JWT signing (HS256/384/512) | Secret-keyed token signing. HS256 = HMAC-SHA-256 is the default JWT signature; key MUST be at least as long as the hash output. |
| Webhook verification | GitHub, Stripe, Slack, GitLab — all sign outgoing webhooks with HMAC-SHA-256 and an X-Hub-Signature header for receivers to verify. |
| AWS Signature V4 | Every authenticated AWS request signs the canonical request with HMAC-SHA-256 chained four times through derived keys. |
| OAuth 1.0 (legacy) | OAuth 1.0a uses HMAC-SHA-1 to sign requests. Modern OAuth 2.0 dropped HMAC in favor of TLS + Bearer tokens. |
| API request signing | Custom API auth schemes (HMAC headers on requests). Always include a timestamp in the signed payload to prevent replay attacks. |
| TOTP-derived secrets | Google Authenticator and similar use HMAC-SHA-1 over time + secret. The HOTP/TOTP RFCs (4226, 6238) standardize the algorithm. |
Five Rules for Using HMAC Safely
1. Use SHA-256 or stronger
SHA-1 has known collision attacks (since 2017). For new code, default to HMAC-SHA-256 unless an existing protocol requires a specific algorithm.
2. Key length ≥ hash output length
A 16-byte key for HMAC-SHA-256 leaves ~128 bits of brute-force resistance — minimum for production. Use 32 bytes (= 256 bits) ideally.
3. Constant-time comparison when verifying
Naive string equality leaks timing information. Use crypto.subtle.verify or a timing-safe comparison function on the server side.
4. Include timestamp + nonce in signed payload
HMAC alone does not prevent replay — an attacker can re-send a captured request. Sign body + timestamp; reject requests older than 5 minutes.
5. Rotate keys regularly
Compromised keys forge unlimited valid signatures. Maintain key-rotation procedures and use key IDs (kid) so receivers know which key to verify with.