Search tools

HMAC Generator

Sign a message with a secret key, or check that a webhook signature is genuine.

HMAC Generator tool

The message must be byte-for-byte what was signed. For webhooks, sign the raw request body, not a re-formatted copy: one extra space changes the result.

Processing runs in your browser.

Payment providers, chat platforms and source-code hosts all use HMAC to sign the webhooks they send. When an event arrives at your server, the signature proves it came from them and wasn’t altered on the way. When an integration fails with “invalid signature”, the quickest way to find out why is to compute the HMAC yourself and compare.

A typical check

  1. Copy the raw request body from your logs. Use the exact bytes, not a pretty-printed version.
  2. Copy the signing secret from the provider’s dashboard.
  3. Paste the signature from the request header, such as X-Signature: sha256=…, into the verify box.

If the tool says the signature is valid, your server’s code is the problem, often because a framework parsed the JSON before you hashed it. If it says invalid, check the secret, the key format and whether the provider signs extra data such as a timestamp.

Signing your own requests

Many APIs ask you to sign requests with HMAC too. Build the string to sign exactly as the documentation describes, usually the method, path, timestamp and body joined together, then paste it here to check your code produces the same signature.

Keep the key secret

An HMAC is only as safe as its key. Use a long random key (32 bytes or more), keep it out of source code, and rotate it if it might have leaked. In your own code, compare signatures with a constant-time function so attackers can’t learn anything from response timing.

How to use the HMAC Generator

  1. Paste the message, such as the raw body of a webhook request.
  2. Enter the secret key and choose its format: text, hex or Base64.
  3. Pick the algorithm and output format your service uses, usually SHA-256 and hex.
  4. To verify, paste the signature you received. The tool says whether it matches.

Features

  • HMAC with SHA-256, SHA-384, SHA-512, SHA-1 or MD5.
  • Keys as plain text, hex or Base64, as different providers supply them.
  • Hex or Base64 output, updated as you type.
  • Verification that accepts prefixes like sha256= and either output encoding.
  • Uses the browser’s Web Crypto API; your secret key stays on your device.

Frequently asked questions

What is HMAC?

A hash-based message authentication code: a signature made by hashing a message together with a secret key. Anyone with the key can check the message wasn’t changed and came from someone who knows the key.

How do I verify a webhook signature?

Take the raw request body exactly as received, the signing secret from your provider’s dashboard and the signature from the request header. If the HMAC of the body matches the header, the webhook is genuine. Some providers sign a timestamp plus the body, so check their docs for the exact message format.

Why doesn’t my signature match?

Usually the message isn’t byte-for-byte identical: the body was parsed and re-encoded, whitespace changed, or a timestamp prefix was left out. Other causes are using the key in the wrong format (hex vs text) or comparing hex to Base64.

Is HMAC-SHA1 still safe?

HMAC-SHA1 is still considered secure for message authentication, because HMAC doesn’t rely on the weaknesses found in SHA-1. For new systems, use HMAC-SHA256 anyway.

Written by