100% Client-side  |  SHA256 • SHA384 • SHA512 • SHA1 • MD5  |  Hex & Base64 output

HMAC Generator & Verifier

Compute and verify HMAC signatures using SHA256, SHA384, SHA512, SHA1 or MD5. Output in Hex and Base64. Runs entirely in your browser — nothing sent to the server.

Key encoding:  

Verify HMAC

Paste an expected HMAC value to verify it matches your message and key.

What is HMAC?

HMAC (Hash-based Message Authentication Code) is a cryptographic technique that combines a secret key with a hash function to produce a message authentication code. It provides both integrity (the message hasn't been tampered with) and authenticity (the message came from someone who knows the secret key).

HMAC is defined in RFC 2104 and is used in TLS, JWT signatures (HS256/HS384/HS512), webhook verification, API authentication, and many other security protocols.

How HMAC works

HMAC(K, m) = H((K' XOR opad) || H((K' XOR ipad) || m))

Where:
  H    = hash function (SHA-256, SHA-512, etc.)
  K    = secret key (padded/hashed to block size → K')
  m    = message
  ipad = 0x36 repeated (inner padding)
  opad = 0x5C repeated (outer padding)

Algorithm comparison

AlgorithmOutput sizeSecurityUse caseStatus
HMAC-SHA256256 bits (64 hex)128-bitJWT HS256, webhooks, API authRecommended
HMAC-SHA384384 bits (96 hex)192-bitJWT HS384, high securityRecommended
HMAC-SHA512512 bits (128 hex)256-bitJWT HS512, maximum securityRecommended
HMAC-SHA1160 bits (40 hex)80-bitLegacy systems, GitLegacy only
HMAC-MD5128 bits (32 hex)64-bitNon-security checksumsAvoid

Common use cases

Use caseAlgorithmExample
JWT signaturesHMAC-SHA256/384/512HS256, HS384, HS512 in JWT header
Webhook verificationHMAC-SHA256GitHub, Stripe, Shopify webhooks
API authenticationHMAC-SHA256AWS Signature v4, HMAC-based API keys
Cookie integrityHMAC-SHA256Signed session cookies
TLS record MACHMAC-SHA256TLS 1.2 record layer (deprecated in 1.3)

HMAC vs plain hash

A plain hash (e.g. SHA-256) of a message can be computed by anyone — it provides no authentication. HMAC requires the secret key, so only parties that know the key can produce or verify the MAC. This prevents length extension attacks that affect plain SHA-256 used naively.

References

  1. RFC 2104 — HMAC: Keyed-Hashing for Message Authentication
  2. RFC 4868 — Using HMAC-SHA-256/384/512 with IPsec
  3. NIST FIPS 198-1 — The Keyed-Hash Message Authentication Code