HMAC Generator
HMAC Generation
Generate and verify HMAC signatures with 8 algorithms, key/message encoding options, and file support. 100% client-side.
What Is an HMAC Generator?
An HMAC generator computes a Hash-based Message Authentication Code (HMAC) by combining a message with a secret key through a cryptographic hash function. Unlike a plain hash, the output changes completely if either the message or the key changes, so it proves both that the data is intact and that it came from someone who holds the key. This tool runs the full HMAC calculation in your browser, so you can generate and verify signatures for APIs, webhooks, and tokens without sending your secret anywhere.
How to Use This HMAC Generator
Generating an HMAC signature takes a few seconds:
How HMAC Signatures Are Calculated
HMAC pads the secret key to match the hash function's block size, then combines it with the message using two passes of the underlying hash. The inner pass XORs the key with a fixed inner padding value and hashes it together with the message; the outer pass XORs the key with a different padding value and hashes it together with the result of the inner pass.
This nested construction is what protects HMAC against length-extension attacks that affect plain hashes like SHA-256 used alone. It is formally defined in RFC 2104 and used everywhere from TLS handshakes to signed API requests.
HMAC vs. a Plain Hash
A plain hash such as MD5 or SHA-256 turns any input into a fixed-size fingerprint, but anyone can recompute that fingerprint, so it only proves the data was not corrupted. HMAC adds a secret key into the calculation, so only someone who knows the key can produce or check a matching value.
That extra step turns a hash into a message authentication code: proof of integrity and proof that the signer holds the shared secret. If you only need to detect corrupted files, use our Hash Generator; if you need to authenticate a message between two parties, HMAC is the right tool.
Every HMAC Algorithm This Generator Supports
This generator computes HMAC with eight underlying hash functions, matching or exceeding what most competing HMAC tools offer:
As a rule of thumb, use HMAC-SHA256 unless a specific protocol or legacy system requires something else.
Algorithm | Output Length | Security Status | Best For |
|---|---|---|---|
| MD5 | 128 bits | Legacy | Compatibility with old systems only |
| SHA-1 | 160 bits | Legacy | Deprecated protocols |
| SHA-224 | 224 bits | Secure | Compact SHA-2 signatures |
| SHA-256 | 256 bits | Recommended | APIs, webhooks, JWT (HS256) |
| SHA-384 | 384 bits | Secure | Higher-security SHA-2 signatures |
| SHA-512 | 512 bits | Secure | High-throughput 64-bit systems |
| SHA3-512 | 512 bits | Secure | Modern Keccak-based signing |
| RIPEMD-160 | 160 bits | Legacy | Older banking / PGP systems |
HMAC-SHA256: The Modern Standard
HMAC-SHA256 is the default choice for signing webhooks and API requests at companies like Stripe, GitHub, and Shopify, and it is also the algorithm behind the HS256 signature used in most JSON Web Tokens.
It offers a strong security margin, wide library support, and a 64-character hex output that is short enough to fit comfortably in HTTP headers.
SHA3-512: The Keccak-Based Alternative
SHA-3 uses a completely different internal design (Keccak) from the SHA-2 family, so an HMAC-SHA3 signature does not share any structural weaknesses that might one day be found in SHA-256 or SHA-512.
Choose it when a protocol specifically requires the SHA-3 family or when you want algorithm diversity alongside an existing SHA-2 signature.
MD5, SHA-1, and RIPEMD-160: Legacy Algorithms
HMAC-MD5 and HMAC-SHA1 are still considered cryptographically sound as message authentication codes, unlike plain MD5 or SHA-1 hashing, because the secret key mitigates the known collision attacks on the underlying hash.
Even so, most current guidance recommends moving to SHA-256 or better for new systems, and these variants are included here mainly to verify or interoperate with older APIs.
Compute Every Algorithm at Once
Switch the result mode to "All algorithms" to generate all eight HMAC variants for the same message and key in a single click, useful when you are testing which algorithm a legacy API expects.
Each result can be copied individually, or use "Copy all" to grab every signature at once.
Key and Message Encoding: UTF-8, Hex, and Base64
Most APIs treat the secret key as plain UTF-8 text, but some issue keys as hexadecimal or Base64 strings, and signing with the wrong encoding is the most common reason a computed HMAC does not match what a server expects. This generator lets you tell it exactly how to interpret both the key and the message before hashing.
If your provider's documentation says the key is "base64-encoded", select Base64 for the key encoding rather than hashing the literal Base64 string as UTF-8 text -- the two produce completely different signatures.
Choosing an Output Format: Hex vs. Base64
Hexadecimal output is longer but easy to read and compare by eye, and it is the format most debugging tools and documentation examples use. Base64 output is roughly 25% shorter, which matters when a signature has to fit in an HTTP header such as Authorization or X-Signature.
Use whichever format the receiving system expects; this generator can produce lowercase hex, uppercase hex, or Base64 without recomputing anything.
Generate an HMAC for a File
Switch to the File tab to compute an HMAC over a file's raw bytes instead of typed text, useful for signing downloads, verifying software packages, or authenticating file uploads before they reach a server.
The file never leaves your device: it is read and hashed locally in your browser, then discarded.
Verify and Compare an HMAC Signature
Paste an HMAC value you received into the compare field and this tool checks it against the signature it just computed, so you can confirm a webhook payload or API response is authentic without writing any code.
In "All algorithms" mode, the comparison checks every variant at once, which is handy when you are not sure which hash function the sender used.
Common HMAC Use Cases
HMAC shows up anywhere two parties need to trust a message without exposing the secret that protects it:
API Request Signing
Services like AWS, Stripe, and many REST APIs sign each request with an HMAC so the server can confirm it was not altered or forged in transit.
Webhook Verification
Payment processors and SaaS platforms attach an HMAC signature header to webhook payloads, letting your endpoint reject anything that was not sent by the real service.
JSON Web Tokens (HS256)
The HS256 algorithm used by many JWTs is HMAC-SHA256 under the hood, signing the token header and payload with a server-side secret.
Secure File and Data Transfer
Systems that exchange files or backups often attach an HMAC so the recipient can detect tampering or corruption before trusting the contents.
HMAC Security Best Practices
A few habits keep HMAC signatures trustworthy:
Use a Long, Random Secret Key
A short or predictable key undermines HMAC's security regardless of algorithm; generate keys with a cryptographically secure random source, ideally at least as long as the hash's output.
Prefer SHA-256 or Stronger
Reserve MD5, SHA-1, and RIPEMD-160 for compatibility with existing systems, and default new integrations to HMAC-SHA256 or HMAC-SHA512.
Rotate Keys Periodically
Treat HMAC secrets like passwords: rotate them on a schedule and immediately if a key may have been exposed.
Compare Signatures in Constant Time
When verifying HMAC values on a server, use a constant-time comparison function to avoid leaking timing information that could help an attacker guess the correct signature.
Client-Side Security and Related Tools
Every calculation on this page, including HMAC generation, key parsing, and file hashing, runs locally in your browser using JavaScript. Your message, secret key, and any uploaded file are never transmitted to our servers or any third party.
Frequently Asked Questions (FAQ)
Frequently Asked Questions