Free tool · runs in your browser
GitHub webhook signature validator: check X-Hub-Signature-256
This page validates a GitHub webhook delivery in your browser: paste the webhook secret, the X-Hub-Signature-256 header and the raw payload, and it tells you whether the delivery is genuine and why a check fails.
Verify a GitHub signature
The verifier opens on a sample GitHub request signed with a demo secret. Replace the secret, headers and body with your own. Everything is computed in your browser; nothing you paste is sent.
The interactive tool needs JavaScript. The same core runs locally: npx @teamshift/webhook-inspect
How GitHub signs a webhook
| Header | X-Hub-Signature-256, in the form sha256=<hex>. The older X-Hub-Signature header carries an HMAC-SHA1 and is kept for old integrations. |
|---|---|
| Signed content | The raw request body, byte for byte |
| Algorithm and encoding | HMAC-SHA256, lowercase hex |
| Secret | The secret you typed when you created the webhook. GitHub sends no signature header at all when the webhook has no secret. |
| Replay protection | None in the signature. Deduplicate on the X-GitHub-Delivery id. |
A minimal check in Node.js
import crypto from 'node:crypto';
const sameBytes = (a, b) => a.length === b.length && crypto.timingSafeEqual(a, b);
export function verifyGitHub(rawBody, header, secret) {
if (typeof header !== 'string') return false; // no header: the webhook has no secret, or the request is not from GitHub
const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
return sameBytes(Buffer.from(header), Buffer.from(expected));
}Pass the body exactly as it arrived, before any parsing. The tool on this page runs the same check and, when it fails, tries the common fixes to tell you which one applies.
Why GitHub verification fails
- The payload was parsed first. Hash the raw bytes GitHub sent, not a re-serialized object. Non-ASCII characters in commit messages make this visible quickly.
- The content type is form-encoded. With
application/x-www-form-urlencodedthe body ispayload=<url-encoded JSON>, and that whole string is what is signed. - The wrong header was read. Comparing a SHA-256 result with the SHA-1 header, or forgetting the
sha256=prefix, never matches. - No secret is set. Then there is nothing to verify, and anyone who learns the URL can post to it.
Test your own endpoint
Enter your endpoint URL under "Send a signed test request to your endpoint" and the tool writes a curl command signed the way GitHub signs. Run it in a POSIX shell (macOS, Linux, WSL or Git Bash) to confirm your handler accepts a good signature, then change one character of the body and confirm it is rejected.
Other providers
- Stripe webhook signature verifier
- Shopify webhook signature verifier
- Slack webhook signature verifier
- Twilio webhook signature verifier
The main verifier also handles any generic HMAC header.
FAQ
How do I validate a GitHub webhook signature?
Compute HMAC-SHA256 over the raw request body with the webhook secret, hex-encode it, prefix it with sha256=, and compare it to the X-Hub-Signature-256 header with a constant-time comparison.
How do I send myself a signed GitHub webhook for testing?
Load the GitHub sample on this page or paste a payload, enter your secret and endpoint URL, and press "Build signed curl command". The command includes the X-GitHub-Event and X-GitHub-Delivery headers from the request above.
Is it safe to paste my secret here?
The page sends nothing: the signature is computed in your browser with WebCrypto, and no field is stored or uploaded. Even so, prefer a test secret, and rotate any live secret you have pasted into a tool you do not control.