Generate cryptographically secure webhook secrets for verifying webhook signatures. Our webhook secret generator creates strong keys for GitHub, Stripe, Shopify, and any webhook-based integration.
Secure, random, and client-side generated.
Output format: Custom character set
Reject payloads that are older than five minutes to limit replay attacks.
Use crypto.timingSafeEqual (Node) or hmac.compare_digest (Python) when comparing signatures.
Store two secrets so you can rotate without missing webhooks from providers like Stripe or GitHub.
A webhook secret is a shared cryptographic key used to sign webhook payloads and verify their authenticity. When a service like GitHub, Stripe, or Shopify sends a webhook to your application, they include an HMAC signature computed using the webhook secret. Your application can then verify the signature to ensure the webhook genuinely came from the service and wasn't tampered with in transit.
Our webhook secret generator creates cryptographically secure secrets suitable for production webhook integrations. The webhook secret should be kept confidential and shared only between you and the webhook provider. Never expose webhook secrets in client-side code or public repositories.
GitHub sends webhook secrets in the X-Hub-Signature-256 header using HMAC-SHA256.
Header format: sha256=<signature>
Stripe sends signatures in Stripe-Signature header with timestamp and versioned signatures.
Uses HMAC-SHA256, includes replay attack protection
Shopify sends signatures in X-Shopify-Hmac-SHA256 header using Base64-encoded HMAC.
Signature is Base64-encoded HMAC-SHA256
Most webhook systems use similar patterns: HMAC-SHA256 signature sent in HTTP headers.
Common header names: X-Signature, X-Webhook-Signature
Here's how to verify webhook signatures using your webhook secret:
const crypto = require('crypto');
function verifyGitHubWebhook(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret);
const digest = 'sha256=' + hmac.update(payload).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(digest)
);
}
// Usage
app.post('/webhook', (req, res) => {
const signature = req.headers['x-hub-signature-256'];
const payload = JSON.stringify(req.body);
const secret = process.env.WEBHOOK_SECRET;
if (verifyGitHubWebhook(payload, signature, secret)) {
// Webhook is authentic
res.status(200).send('OK');
} else {
res.status(401).send('Unauthorized');
}
});import stripe
import os
# Stripe provides a helper library
stripe.api_key = os.environ['STRIPE_API_KEY']
endpoint_secret = os.environ['WEBHOOK_SECRET']
@app.route('/webhook', methods=['POST'])
def webhook():
payload = request.data
sig_header = request.headers.get('Stripe-Signature')
try:
event = stripe.Webhook.construct_event(
payload, sig_header, endpoint_secret
)
# Webhook verified successfully
return 'OK', 200
except ValueError:
return 'Invalid payload', 400
except stripe.error.SignatureVerificationError:
return 'Invalid signature', 401We recommend at least 32 characters (256 bits) for webhook secrets. This provides strong security against brute-force attempts. Our webhook secret generator defaults to secure lengths suitable for production use.
No, you should use different webhook secrets for each service or endpoint. This limits the impact if one secret is compromised and makes it easier to rotate secrets independently.
If a webhook secret is compromised, attackers could forge webhooks from that service. Immediately generate a new webhook secret, update it in your application and the webhook provider's settings, and investigate any suspicious webhook activity.
No, typically one webhook secret per service is sufficient. The same secret can verify all webhook types from that service (e.g., all GitHub events, all Stripe events). However, if you have multiple webhook endpoints for the same service, use different secrets for each endpoint.
All webhook secrets are generated locally in your browser using the Web Crypto API. No data is sent to our servers. Your secrets are never stored, logged, or transmitted. This tool is open source and uses cryptographically secure randomness.