HMAC Generator — SHA-256, SHA-1, SHA-512

Compute an HMAC (hash-based message authentication code) from a message and a secret key. Choose the hash algorithm and hex or Base64 output. Everything runs in your browser using the native Web Crypto API — your key and message are never sent anywhere.

HMAC

What an HMAC is

An HMAC proves two things at once: that a message hasn't been tampered with, and that whoever produced the code knows a shared secret key. It runs a hash function (SHA-256, SHA-1, …) over the message combined with the key in a specific way. Anyone with the same key and message gets the same code; anyone without the key can't forge it, even though the hash algorithm itself is public.

HMAC vs a plain hash

A bare SHA-256(message) only detects accidental changes — anyone can recompute it, so it proves nothing about who made it. HMAC mixes in a secret key, so the code also authenticates the sender. That's why webhooks (Stripe, GitHub, Slack) sign their payloads with HMAC: you recompute the HMAC with your shared secret and compare it to the header to confirm the request is genuine.

Gotchas worth knowing

Frequently asked questions

How do I generate an HMAC-SHA256?

Type your message and secret key above with HMAC-SHA256 selected. The hex digest appears instantly — switch to Base64 with the output dropdown if your system expects it.

Is my key sent to a server?

No. The HMAC is computed locally with your browser's built-in Web Crypto API. Nothing you type leaves the page.

Why doesn't my HMAC match the server's?

Almost always an input difference: a trailing newline, a different character encoding, or comparing a hex digest against a Base64 one. Make the message bytes and output format match exactly.

Need other developer utilities? Browse all tools on the home page.