This HMAC Generator runs in your browser, so you can produce a keyed authentication tag without sending the key or message to the site server.
Open the HMAC Generator to create an HMAC-SHA-256, HMAC-SHA-384 or HMAC-SHA-512 tag from text or exact hexadecimal bytes. The implementation uses native browser cryptography and keeps the operation in the current tab rather than transferring your inputs to the site server.
The W3C Web Cryptography HMAC specification defines the browser-based HMAC operation used by tools of this kind. For the result to be accepted, however, your application’s algorithm, key bytes, message bytes and output format must all match its protocol exactly.

What a browser-based HMAC generator produces
HMAC combines a cryptographic hash with a shared secret key. A verifier that possesses the same secret and the exact message bytes can calculate the same tag. This allows the verifier to detect changes to the message and authenticate the party that knew the key.
HMAC does not encrypt or conceal the message. Its purpose is authentication and integrity checking, so the original plaintext remains readable to anyone who can access it.
Select the hash named by your protocol. The selected algorithm determines the complete tag length, which the generator always displays in full:
| Algorithm | Full tag length | Available representations |
|---|---|---|
| HMAC-SHA-256 | 32 bytes | Lowercase hexadecimal and standard padded Base64 |
| HMAC-SHA-384 | 48 bytes | Lowercase hexadecimal and standard padded Base64 |
| HMAC-SHA-512 | 64 bytes | Lowercase hexadecimal and standard padded Base64 |
Hexadecimal and Base64 are simply two renderings of the same tag bytes. They are not interchangeable with different encoding rules, so copy the representation required by the receiving system.
Match UTF-8 or hexadecimal to the exact protocol bytes
The generator lets you select UTF-8 or hexadecimal independently for the secret key and the message. This matters because the text “1234” and the hexadecimal bytes 31323334 represent the same bytes. A valid HMAC requires the same byte sequence on both sides.
| Input mode | Use it when | Exact behavior |
|---|---|---|
| UTF-8 | The protocol defines the field as UTF-8 text | Text is encoded as UTF-8. Whitespace and line endings remain part of the message. |
| Hexadecimal | The protocol publishes exact byte values | Only an even number of hexadecimal digits is accepted. Every byte is preserved, including 00. |
UTF-8 is not always one byte per visible character. Accented letters, CJK characters and emoji occupy multiple bytes, and a trailing space or newline can change the result. Enter the exact content specified by the protocol without adding labels, quotation marks or other formatting that is not part of the value.
Hex mode is stricter for good reason: it rejects 0x prefixes, spaces, colons and odd numbers of digits so a formatting character cannot silently alter a protocol value. Prefer hexadecimal for published test vectors and binary fields.
Before generating anything, identify which bytes represent the key, which bytes represent the message, and whether the protocol wants their complete values or a separately defined representation.
Generate a tag
- Open the tool and choose the hash. Select SHA-256, SHA-384 or SHA-512 according to the governing specification. Confirm that the protocol expects a full HMAC tag before continuing.
- Choose an input mode for each field. Set UTF-8 or hexadecimal separately for the key and message. The two fields do not have to use the same mode, but each selection must reflect the protocol’s byte definition.
- Enter the exact key and message bytes. Include every required space, newline and non-ASCII character when using UTF-8. In hexadecimal mode, remove accidental prefixes, spaces, colons and stray nibbles.
- Generate the tag. The tool imports the selected bytes as a non-exportable Web Crypto HMAC key and signs the exact message bytes with the selected hash. The full tag is returned without being shortened.
- Copy the required output. Choose lowercase hexadecimal or standard padded Base64. If the protocol explicitly requires a conversion, prefix, envelope or truncation, apply that rule precisely after generation instead of editing the tag by eye.
The generated tag is ready to copy into the application or protocol field that expects it.
Apply only the output rules required by the protocol
The page produces the complete HMAC tag as lowercase hexadecimal or standard padded Base64. It does not emit Base64url, prepend an algorithm identifier, attach the message to the tag or package the result in a binary envelope.
Some protocols require a shortened tag, a prefixed algorithm name, a canonical request string or a particular envelope format. Those rules belong to the protocol, not to HMAC itself. If the protocol requires a canonical request string, construct it first and use its exact bytes as the message input. Then generate the full tag and apply any specified output transformation, such as truncation, exactly; do not trim a tag manually, because even a small change can make an otherwise valid authentication value fail.
Store and transmit the key, message and tag in the form required by the receiving system. Standard Base64 and Base64url may look similar but decode differently, so copying a visually similar value into the wrong field can cause a mismatch.
Find the cause when two HMAC results differ
If your generated tag does not match another implementation, compare the inputs and output treatment in this order:
- Hash algorithm: Confirm that both sides use SHA-256, SHA-384 or SHA-512 rather than another hash or a different HMAC construction.
- Key bytes: Check whitespace, encoding, leading zeros and whether one side treated the key as text while the other treated it as hexadecimal.
- Message bytes: Look for an added newline, trailing space, different Unicode normalization or a difference between the displayed text and its underlying bytes.
- Input interpretation: Confirm that UTF-8 was encoded as UTF-8 and that hexadecimal input contains a valid, complete byte sequence.
- Tag treatment: Determine whether one side truncates the tag, compares only part of it or uses Base64url instead of standard Base64.
- Password derivation: If the key comes from a human password, verify that both sides use the exact password-based derivation scheme and parameters required by the application.
After exchanging a tag, compare the complete value in the required encoding. Verification should use a constant-time comparison function on the server rather than an ordinary early-exit string comparison.
Keep key handling and confidentiality in view
Use independently generated, high-entropy key material appropriate for the protocol. Distribute it through a protected channel, use separate keys for separate purposes and rotate a key after a suspected compromise. A human password is not automatically a strong HMAC key. When an application must derive a key from a password, use the exact password-based derivation scheme and parameters specified by that application.
A matching tag shows that the parties possess the same key and calculated the tag from consistent bytes. It does not prove that the message is confidential. Anyone who sees plaintext can read it, and anyone who learns the key can create a valid tag for modified data.
The generator operates locally in the current tab, and its inputs are not sent to the site server. Even with local processing, avoid pasting production secrets into an untrusted device or browser profile. Use the tool on hardware and under an account you trust, especially when the secret grants access to a live system.
Understand the limits and built-in checks
Each decoded field is limited to 1,000,000 bytes. The interface also rejects empty keys and empty messages to prevent accidental submissions, even though some low-level standards can define behavior for zero-length data. If the generator refuses an otherwise valid empty field, use an implementation that accepts the required zero-length bytes. Do not substitute non-empty bytes, because that changes the HMAC input and tag.
Long operations carry an identity token. If you change an input while Web Crypto is still working, the older result cannot overwrite the newer state. This protects the displayed tag from being accidentally replaced with output calculated from previous values.
Correctness is locked to eight full RFC 4231 test vectors. The cases cover short keys, binary repeated-byte keys and data, keys smaller than the digest, and data crossing hash block boundaries. SHA-256 and SHA-512 are checked for four independent inputs, while the interface also exposes the WebCrypto-defined SHA-384 option.
Use the generator only after identifying the governing algorithm, the exact key bytes, the exact message bytes and the required output encoding. Those four decisions determine whether the resulting HMAC will be accepted.
If you're weighing options, Get SHA-1 Hash of a File in Windows: Two Methods covers this in detail.
If you're weighing options, HMAC Generator for Large Text: Limits and Exact Steps covers this in detail.