HMAC-SHA256 Generator

Signing happens locally. Prefer throwaway keys for testing; rotate anything used in production.

HMAC-SHA-256 signature

Output size: 64 hex characters (256 bits). Key is not stored in localStorage.

About this tool

Compute HMAC-SHA256 signatures over any message using a secret key, locally in your browser. The 256-bit signature renders as 64 hex characters, in lowercase, uppercase, or Base64. This is the algorithm most APIs mean when they say "sign the request body". Nothing is uploaded and the key is not persisted.

How to use

  1. Type or paste the message into Message — the signature updates as you type.
  2. Enter the secret key and choose whether it is plain text (UTF-8) or hex bytes.
  3. Pick hex (64 characters) or Base64 (44 characters) for the signature.
  4. Copy the signature, or paste an expected signature to verify it.

Example

Algorithm: HMAC-SHA-256
Message:   hello
Key:       secret (plain text)

Signature: 88aab3ede8d3adf94d26ab90d3bafd4a2083070c3bcce9c014ee04a443847c0b

Encoding the same key as hex bytes (736563726574) produces the same signature, because both describe the identical bytes.

HMAC-SHA-256 parameters

PropertyValue
Underlying hashSHA-256
Digest size256 bits (32 bytes)
Hex length64 characters
Block size64 bytes
Web Crypto nameHMAC with hash "SHA-256"

Why HMAC-SHA-256?

HMAC-SHA256 is the default choice for authenticating messages. It backs Stripe and GitHub webhook signatures, AWS Signature Version 4, JWT HS256 tokens, and countless internal request-signing schemes. It offers a full 256-bit output, is fast in both software and hardware, and avoids the length-extension property of a bare hash. If you are unsure which HMAC to implement, this is almost always the right answer.

FAQ

What is HMAC-SHA256?

It is a keyed message authentication code built on SHA-256. Given a message and a shared secret key it produces a 256-bit signature that proves the message came from someone holding that key.

What is HMAC-SHA256 used for?

Webhook verification (Stripe, GitHub, Slack), API request signing (AWS Signature V4), JWT HS256 tokens, and any case where two parties share a secret and need to confirm a payload was not altered.

Is HMAC-SHA256 the same as SHA-256?

No. SHA-256 uses no key and only detects accidental corruption. HMAC-SHA256 folds in a secret key, so an attacker without the key cannot produce a valid signature.

How long is an HMAC-SHA256 signature?

256 bits — 32 bytes, written as 64 hexadecimal characters or 44 Base64 characters with padding.

Should I use HMAC-SHA256 or HMAC-SHA512?

Both are currently secure. HMAC-SHA256 is more widely required and produces a shorter signature; HMAC-SHA512 has a larger margin and is often faster on 64-bit CPUs. Follow whatever your protocol specifies.

Why does my signature not match?

Check the key bytes (plain UTF-8 versus hex), the exact message including line endings, and whether the expected value is hex or Base64. A single extra newline changes the signature completely.

Is my key uploaded or stored?

No. Signing runs in the browser with Web Crypto, and the key is intentionally kept out of localStorage.