HMAC Generator and Webhook Signature Verifier
Enter a message and key to get an HMAC, or paste a webhook body, header and secret to see whether the signature matches and, if not, why. The key stays in your browser, and Node and Python code with a timing-safe compare is included.
Updated
HMAC-SHA256, hex
f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8
256 bits
Verify it on your server (Node.js)
import crypto from "node:crypto";
// Compare in constant time. timingSafeEqual needs equal lengths, so check that first.
const safeEqual = (a, b) => { const x = Buffer.from(a), y = Buffer.from(b); return x.length === y.length && crypto.timingSafeEqual(x, y); };
export function hmac(message, key) {
return crypto.createHmac("sha256", key).update(message).digest("hex");
}- Algorithm
- HMAC-SHA256
- Message size
- 43 bytes (UTF-8)
- Key size
- 3 bytes
- The key and message are processed in this tab by the Web Crypto API and are not sent anywhere. The key is not shown in the results.
How is an HMAC calculated, and how do webhook signatures use it?
An HMAC (RFC 2104) mixes a secret key into a hash of a message, so only someone who holds the key can produce the right value. This page does it with the browser's Web Crypto API: it imports your key, signs the message's UTF-8 bytes with HMAC and the hash you chose (SHA-256, SHA-384, SHA-512 or SHA-1), and shows the digest as hex or Base64. Your key and message stay in this tab and nothing is sent to a server.
A webhook provider signs what it sends with a secret the two of you share, and your server repeats the sum and compares. Each provider fixes what is signed. Razorpay signs the raw body with your webhook secret and sends hex in X-Razorpay-Signature; its payment signature is the HMAC-SHA256 of order_id|razorpay_payment_id with your API key secret. Stripe signs the timestamp, a dot and the raw body, and puts t= and one or more v1= entries in Stripe-Signature. GitHub sends sha256= and the hex digest of the raw payload in X-Hub-Signature-256. Shopify sends the Base64 digest of the raw body in X-Shopify-Hmac-Sha256. Slack signs v0:timestamp:body and sends v0= and the hex digest.
Most failures are about bytes, not the secret. The signature covers the raw body exactly as it arrived, so a framework that parses the JSON and re-serializes it, a trailing line break, different line endings or the wrong encoding all give a different digest. In a preset mode, if the signature does not match, this page tries those causes one by one and tells you which one reproduces your signature. Your own server must compare in constant time (crypto.timingSafeEqual in Node, hmac.compare_digest in Python) and, for Stripe and Slack, reject old timestamps.
HMAC(K, m) = H((K' xor opad) || H((K' xor ipad) || m)) (RFC 2104)
Razorpay webhook: HMAC-SHA256(rawBody, webhookSecret) → hex
Razorpay payment: HMAC-SHA256(order_id + "|" + payment_id, apiKeySecret) → hex
Stripe: HMAC-SHA256(t + "." + rawBody, signingSecret) → hex, compared with each v1
GitHub: "sha256=" + HMAC-SHA256(rawBody, secret) → hex Shopify: → Base64
Slack: "v0=" + HMAC-SHA256("v0:" + timestamp + ":" + rawBody, signingSecret) → hexWhat does each provider sign, and how is it sent?
| Provider | Header | Signed string | Key | Digest | Replay check |
|---|---|---|---|---|---|
| Razorpay webhook | X-Razorpay-Signature | raw body | webhook secret | hex | none documented on the page |
| Razorpay payment | razorpay_signature (Checkout) | order_id|razorpay_payment_id | API key secret | hex | none |
| Stripe | Stripe-Signature (t=, v1=) | timestamp + "." + raw body | endpoint signing secret (whsec_…) | hex, any v1 may match | timestamp; libraries default to 5 minutes |
| GitHub | X-Hub-Signature-256 | raw payload | webhook secret token | sha256= + hex | none |
| Shopify | X-Shopify-Hmac-SHA256 | raw body | app client secret | Base64 | none |
| Slack | X-Slack-Signature + X-Slack-Request-Timestamp | v0:timestamp:body | signing secret | v0= + hex | reject beyond 5 minutes |
How to verify a webhook signature
- 1Pick the providerChoose the Razorpay, Stripe, GitHub, Shopify or Slack mode, or plain HMAC for any other message and key.
- 2Paste the raw body and the headerPaste the body exactly as your server received it (a request log or the provider's delivery view), then the signature header value. For Stripe paste the whole header; for Slack also enter the timestamp header.
- 3Enter the secretUse the secret the provider documents for that signature: the webhook secret, the endpoint signing secret or the API key secret. It stays in this tab.
- 4Read the verdictA match means your server's maths is right. A mismatch comes with the most likely cause: encoding, whitespace, line endings, re-serialized JSON or a wrong secret. Copy the Node or Python code for your own endpoint.
Frequently asked questions
Why does my webhook signature not match when the secret is correct?
Is it safe to paste my real webhook secret here?
Should I compare signatures with ==?
What are the several v1 values in Stripe-Signature?
What is the Razorpay payment signature, and is it the same as the webhook signature?
Why is the same digest hex in one provider and Base64 in another?
Does HMAC-SHA1 still work for signing?
Sources
- RFC 2104: HMAC: Keyed-Hashing for Message Authentication (checked 11 Nov 2026)
- RFC 4231: HMAC-SHA test vectors (test case 1 is used in the self-test) (checked 11 Nov 2026)
- Razorpay: Validate webhooks (X-Razorpay-Signature, raw body, webhook secret, hex) (checked 11 Nov 2026)
- Razorpay: Payment gateway integration, verify payment signature (order_id|razorpay_payment_id, API key secret) (checked 11 Nov 2026)
- Stripe: Receive Stripe events in your webhook endpoint, verify manually (t, v1, signed_payload, 5-minute tolerance) (checked 11 Nov 2026)
- GitHub Docs: Validating webhook deliveries (X-Hub-Signature-256, sha256=, UTF-8, constant-time compare) (checked 11 Nov 2026)
- Shopify: Deliver webhooks through HTTPS (X-Shopify-Hmac-SHA256, Base64, client secret) (checked 11 Nov 2026)
- Slack: Verifying requests from Slack (v0:timestamp:body, v0= prefix, five-minute window) (checked 11 Nov 2026)
- MDN: SubtleCrypto.sign() with HMAC (checked 11 Nov 2026)
- Node.js crypto: crypto.timingSafeEqual and createHmac (checked 11 Nov 2026)
- Python hmac: hmac.compare_digest (checked 11 Nov 2026)
Need a custom dev tool for your team?
We build internal tools, dashboards, APIs, and SaaS platforms. If you can describe it, we can ship it.
Built by CountryDevs · No signup · No ads · We count visits, never what you enter