Webhook signature verifier

Runs in your browser

Check webhook signatures from Stripe, GitHub, Shopify, Slack, Svix, Clerk, Paddle, Twilio, Square and Discord, and find out why a check fails.

Try:
The secret from the provider’s dashboard.
Waiting for input

Paste headers, body and secret

Try the Stripe or GitHub example: the secrets are whsec_demo and demo-secret.

Cheat sheet

How each provider signs its webhooks

ProviderHeaderSigned contentAlgorithm
StripeStripe-Signature: t=…,v1=…timestamp.bodyHMAC-SHA256, hex; secret used as text including whsec_; 5 min tolerance
GitHubX-Hub-Signature-256: sha256=…raw bodyHMAC-SHA256, hex
GitLabX-Gitlab-Token–no signature: the secret token itself is sent
ShopifyX-Shopify-Hmac-Sha256raw bodyHMAC-SHA256, Base64
SlackX-Slack-Signature: v0=… + X-Slack-Request-Timestampv0:timestamp:bodyHMAC-SHA256, hex; 5 min tolerance
Svix, Clerk, Resend, Standard Webhookssvix-signature: v1,… / webhook-signatureid.timestamp.bodyHMAC-SHA256, Base64; secret after whsec_ is Base64-decoded
Paddle BillingPaddle-Signature: ts=…;h1=…ts:bodyHMAC-SHA256, hex
Squarex-square-hmacsha256-signaturenotification URL + bodyHMAC-SHA256, Base64
TwilioX-Twilio-SignatureURL + POST parameters sorted by nameHMAC-SHA1, Base64, key is the Auth Token
DiscordX-Signature-Ed25519 + X-Signature-Timestamptimestamp + bodyEd25519 signature, checked with the app’s public key
In your code

Verify the raw body, compare in constant time

Nearly every failed check has the same cause: the framework parsed the JSON and the code signs a re-serialized copy. Sign the raw bytes before anything touches them.

Node.js (Express)
import express from "express";
import crypto from "node:crypto";

// express.raw keeps the exact bytes. express.json() would re-serialize them.
app.post("/webhooks/github", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto.createHmac("sha256", process.env.WEBHOOK_SECRET)
    .update(req.body).digest("hex");
  const got = req.get("X-Hub-Signature-256") || "";
  const ok = got.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
  if (!ok) return res.sendStatus(401);
  const event = JSON.parse(req.body);
  res.sendStatus(204);
});
Python (Flask)
import hmac, hashlib, os
from flask import request, abort

@app.post("/webhooks/github")
def github():
    body = request.get_data()  # raw bytes, not request.json
    expected = "sha256=" + hmac.new(os.environ["WEBHOOK_SECRET"].encode(), body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, request.headers.get("X-Hub-Signature-256", "")):
        abort(401)
    return "", 204
PHP
$body = file_get_contents('php://input');   // Laravel: $request->getContent()
$expected = 'sha256=' . hash_hmac('sha256', $body, getenv('WEBHOOK_SECRET'));
if (!hash_equals($expected, $_SERVER['HTTP_X_HUB_SIGNATURE_256'] ?? '')) {
    http_response_code(401);
    exit;
}
Stripe
// Use the SDK, it also checks the timestamp
const event = stripe.webhooks.constructEvent(
  req.body,                                  // raw Buffer from express.raw()
  req.headers["stripe-signature"],
  process.env.STRIPE_WEBHOOK_SECRET          // whsec_..., used as is
);
Command line
# GitHub / any HMAC-SHA256 hex
printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET"

# Stripe: sign "timestamp.body"
printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET"

# Shopify: Base64 instead of hex
printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64
Why the check fails

The usual suspects, in order of likelihood

The body was changed

Parsed and re-serialized JSON (other spacing, key order, escaped umlauts), a trailing newline from a file or echo, or CRLF line endings. The tool tries all of these and tells you which one matches.

Wrong secret

Test mode and live mode have different secrets, and so does every endpoint. Stripe’s secret is used as text including whsec_; Svix’s is Base64-decoded after the prefix.

Old timestamp

Stripe, Slack and Svix reject requests older than five minutes to stop replays. A request you saved earlier fails for that reason alone.

Hex vs Base64

GitHub, Stripe and Slack send hex, Shopify, Svix, Square and Twilio Base64. Comparing a hex digest with a Base64 header never matches.

Comparing with ==

Use crypto.timingSafeEqual, hmac.compare_digest or hash_equals so the time a comparison takes reveals nothing.

FAQ

Questions about the webhook signature verifier

Why does my Stripe webhook signature fail?

Almost always because the body is not the raw request body: express.json() or a framework parsed it first. Use express.raw() for the webhook route. Second most common: the secret of another endpoint or of test mode.

Is it safe to paste my webhook secret here?

The check runs in your browser and nothing is sent anywhere; the page’s Content-Security-Policy forbids it. If in doubt, roll the secret afterwards in the provider’s dashboard, or use the command line examples on this page.

What is the signed content for GitHub webhooks?

The raw body only. GitHub sends HMAC-SHA256 of the body with your secret, as hex with the prefix sha256= in X-Hub-Signature-256.

Why is there a timestamp in the signature?

So that an attacker who captures one valid request can’t send it again later. Verify the signature first, then reject timestamps older than a few minutes.

Does GitLab sign webhooks?

Not with an HMAC. GitLab sends the secret token you set in the X-Gitlab-Token header. Compare it with a constant-time comparison.

Searches the list of pages on this site. What you type stays in your browser.