HMAC-SHA256 Generator — Sign & Verify Webhooks and API Requests Online
Compute HMAC-SHA256 signatures with any secret key. Outputs hex, base64, and base64url encodings. Verify a signature against an expected value in one click. Used by AWS SigV4, JWT HS256, Stripe / GitHub / Slack webhooks. 100% local via Web Crypto API.
Last updated:
CommentsEnter a message and secret to get the HMAC-SHA256 signature in hex, base64, and base64url formats. Paste an expected signature into the Verify field to check webhook authenticity. Runs 100% locally via the Web Crypto API — the secret never leaves your browser.
The secret never leaves your browser — HMAC runs locally via Web Crypto API.
(enter a message and secret)(enter a message and secret)(enter a message and secret)Need a different HMAC algorithm?
What is HMAC-SHA256?
HMAC-SHA256 is the workhorse of modern web-service signing. AWS Signature Version 4 uses it. JWT's HS256 alt uses it. Stripe, GitHub, Slack, Discord, Twilio, and virtually every REST-webhook provider signs their outbound requests with HMAC-SHA256 so you can verify they're really from them. This tool computes and verifies HMAC-SHA256 signatures locally, showing the three encodings that different vendors use interchangeably (hex is most common in AWS / Stripe; base64 in JWT and some others; base64url is JWT-style). The Verify field accepts all three, so you don't need to know which encoding your vendor picked.
How to compute or verify HMAC-SHA256 online
- 1Paste the exact message bytes you want to sign — for webhooks, this is the raw request body, not a re-serialized version.
- 2Enter the shared secret (from the webhook config or API key management).
- 3The tool computes the signature in hex, base64, and base64url instantly.
- 4To verify an incoming webhook: paste its signature header into the Verify field — a green checkmark means it matches, red means it doesn't (secret wrong, body altered, or encoding mismatch).
Use Cases
Verify a Stripe / GitHub / Slack webhook
Every major webhook provider signs outbound requests with HMAC-SHA256. Paste the request body and secret; paste the signature header; get instant verify.
Debug AWS SigV4 signatures
AWS SigV4 nests multiple HMAC-SHA256 calls (date → region → service → aws4_request). Test each layer here to isolate where your implementation diverges from AWS's expected value.
Compute JWT HS256 signatures
The HS256 alg in JWT is exactly HMAC-SHA256 over the header.body string, base64url-encoded. Confirm your signing math before shipping a JWT library.
Sign outbound API requests
When integrating with a partner API that requires HMAC-signed requests (custom schemes are common), test signing here before writing library code.
Code Examples
HMAC-SHA256 in Node.js
import { createHmac } from "crypto";
const sig = createHmac("sha256", secret)
.update(rawBody)
.digest("hex");HMAC-SHA256 in Python
import hmac, hashlib
sig = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()HMAC-SHA256 in Go
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(rawBody)
sig := hex.EncodeToString(mac.Sum(nil))Key Concepts
- HMAC construction
- HMAC(key, msg) = H((K ⊕ opad) ‖ H((K ⊕ ipad) ‖ msg)). The nested hash resists length-extension attacks that would break a naive H(key ‖ msg).
- Base64 vs base64url
- Base64 uses +, /, and = padding. Base64url replaces + with -, / with _, and drops padding. JWT signatures use base64url; most REST APIs use standard base64 or hex.
Tips & Best Practices
- ▸Sign the raw bytes of the request body — never a re-serialized JSON. Frameworks that auto-parse JSON often break signatures by dropping insignificant whitespace or reordering keys.
- ▸Use constant-time comparison (`crypto.timingSafeEqual` in Node, `hmac.compare_digest` in Python) when verifying — never `===` or `==`. Timing side-channels are real.
- ▸When comparing hex, be case-insensitive. When comparing base64, be exact (no whitespace, no padding drift).
- ▸Never log the secret. Never bake it into client-side code — HMAC-SHA256 is a server-side operation.
Frequently Asked Questions
What is HMAC-SHA256 used for?
HMAC-SHA256 is the industry-standard message authentication code. AWS SigV4, JWT HS256, Stripe / GitHub / Slack webhook signatures, and most modern REST API signing schemes use it. It proves both integrity (message wasn't tampered) and authenticity (only someone with the shared secret could produce it).
How long is an HMAC-SHA256 signature?
256 bits — 64 hex chars, or 44 characters in base64 (with padding). The tool shows all three common encodings side-by-side.
How do I verify a webhook signature?
Compute HMAC-SHA256 of the raw payload (bytes, not the parsed JSON) using the shared secret from the webhook config. Compare the result against the signature in the request header. Paste the header value in the Verify field for a one-click check.
Why does my signature not match?
The three most common causes: (1) the message you signed is subtly different from what the sender signed — check trailing newlines and whitespace, (2) wrong encoding — the sender uses base64 but you compare hex, (3) wrong secret. This tool's Verify panel accepts hex, base64, and base64url so encoding mismatches are handled automatically.
Is my secret sent anywhere?
No. HMAC-SHA256 is computed locally via the browser's Web Crypto API. Nothing leaves your device.
Try Next
AES Encrypt / Decrypt
Encrypt and decrypt text with AES (128 / 192 / 256, GCM authenticated or CBC legacy) using a password. PBKDF2 key derivation with 200,000 iterations. 100% local — the Web Crypto API runs entirely in your browser.
Related Tools
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes of any text online. Free, no signup — all hashing runs entirely in your browser via the Web Crypto API, so nothing is uploaded.
HMAC Generator
Compute HMAC signatures with SHA-1, SHA-256, SHA-384, or SHA-512 online. Verify API requests, sign webhooks, and authenticate messages. Free, no signup — signing runs locally via the Web Crypto API, secrets never leave your browser.
JWT Decoder
Decode JSON Web Tokens (JWT) to inspect the header, payload, and signature. Runs entirely in your browser — tokens are never sent to any server.
RSA Key Generator
Generate RSA key pairs (2048, 3072, or 4096 bits) online for OAEP encryption, PSS signing, or RS256 JWTs. Exports PKCS#8 private key + SPKI public key as PEM, JWK, or DER (hex/base64). 100% local — the Web Crypto API runs in your browser, private keys never leave the tab.
Public Key Extractor
Paste an RSA or EC private key (PEM PKCS#8 or JWK) and instantly extract the matching public key in PEM (SPKI), JWK, or DER format. Perfect for publishing a JWKS endpoint, verifying a token against a private-key-only backup, or distributing a public key to peers. 100% local — the private key never leaves your browser.
RSA Encrypt / Decrypt
Encrypt text with an RSA public key or decrypt ciphertext with the private key, using RSA-OAEP (SHA-256/384/512). Accepts PEM (PKCS#8 / SPKI) or JWK. 100% local — keys and plaintext never leave your browser tab.