An online HMAC generator creates a keyed authentication tag from exact key and message bytes; it authenticates data but does not encrypt or hide the message.
HMAC combines a cryptographic hash with a shared secret key. A verifier that has the same secret and exact message bytes can calculate the same tag, allowing it to detect modification and authenticate a party that knew the key.
The HMAC Generator supports SHA-256, SHA-384 and SHA-512 and renders every full tag in lowercase hexadecimal and standard padded Base64. It uses native browser Web Crypto, and it does not send the key or message to the site server.

HMAC hashing is not encryption
HMAC is often grouped with hashes because it produces a fixed-length digest, but the shared secret changes an ordinary public hash into a keyed authentication code. The construction is specified in NIST FIPS 198-1.
Encryption protects readability by transforming plaintext into ciphertext. HMAC performs no such transformation. The message remains readable to anyone who receives it, and anyone who learns the secret key can forge valid tags for altered or new messages.
Use HMAC when a protocol needs integrity and sender authentication. Add a separate encryption mechanism when the message itself must remain confidential.
Choose the hash specified by the protocol
Use only the algorithm named by the governing specification. HMAC-SHA-256, HMAC-SHA-384 and HMAC-SHA-512 are different constructions, and the selected hash determines the full tag length.
| Algorithm | Full tag length | Lowercase hex length |
|---|---|---|
| SHA-256 | 32 bytes | 64 characters |
| SHA-384 | 48 bytes | 96 characters |
| SHA-512 | 64 bytes | 128 characters |
The generator always displays the complete tag. A protocol may require a truncated tag, but you should not trim one by eye. Apply the specification’s exact truncation rule to the full result.
Generate a byte-exact HMAC tag
- Identify the protocol inputs. Locate the exact hash algorithm, key representation, message bytes, canonicalization rule, required tag length and output encoding. If a request body is signed, determine whether it includes a trailing newline, timestamp or other field.
- Choose the hash. Select SHA-256, SHA-384 or SHA-512 in the generator, and confirm that the receiver expects a full HMAC tag.
- Select each input mode independently. Choose UTF-8 or hexadecimal for the secret key and for the message. A UTF-8 key paired with a hexadecimal message is supported.
- Enter the exact bytes. Paste text without changing its spaces or line breaks in UTF-8 mode, or paste an even number of hexadecimal digits in hex mode. Do not add a prefix, colon, separator or accidental trailing newline unless it belongs to the protocol.
- Generate and copy the result. Produce the tag, then copy either the complete lowercase hexadecimal value or the complete standard padded Base64 value. Both represent the same tag bytes.
- Apply only required protocol rules. Convert or truncate only when the specification explicitly requires it. The generator does not prepend an algorithm identifier, package the message with its tag or emit Base64url; prepare any canonical request string or binary envelope yourself.
- Verify with identical inputs. Use the same key bytes, message bytes, hash and required representation on the receiving side. Compare complete tags with a constant-time comparison function on the server.
Match the exact input bytes
The input mode determines how each field becomes bytes; it is not merely a display label. A difference in whitespace, Unicode encoding or hexadecimal formatting can produce a completely different tag.
| Input mode | Accepted content | Important byte rule |
|---|---|---|
| UTF-8 text | Text for either the key or message | Text is encoded as UTF-8. Spaces and line breaks remain part of the input, while accented letters, CJK characters and emoji can occupy multiple bytes. |
| Hexadecimal | An even number of hexadecimal digits | Each pair represents one byte, including 00. Prefixes, spaces, colons and odd numbers of digits are rejected. |
Hex mode is particularly useful for published vectors and binary protocol fields because it exposes the byte sequence directly. Never remove a zero byte, insert a separator or reformat a value without checking whether those characters are part of the specified input.
Choose the representation required by the receiver
Lowercase hexadecimal and standard padded Base64 are two renderings of identical HMAC bytes. They are not interchangeable in a protocol: a verifier expecting hexadecimal must not receive the Base64 text merely because it represents the same tag.
Standard Base64 and Base64url are also different formats. Their alphabets and padding rules differ, so a Base64url value must not be substituted for standard padded Base64 without following the protocol.
- Use the full tag unless the specification defines a particular truncation.
- Add an algorithm identifier only when its exact prefix and format are defined.
- Construct any canonical request string or binary envelope before calculating the HMAC when required.
- Select standard Base64 or Base64url exactly as specified; do not swap them.
For a compact reference while checking a request, see the HMAC generator cheat sheet for hash, encoding, and output rules.
Protect the key and verify tags correctly
Treat the secret key as a credential. Use independently generated, high-entropy key material appropriate for the protocol, distribute it through a protected channel, separate keys by purpose and rotate a key after a compromise.
A human password is not automatically a strong HMAC key. When an application requires a password-derived key, use the exact password-based derivation scheme and parameters specified by that application rather than improvising them.
A matching tag shows that the verifier possesses the same key and calculated over the same message bytes. It does not prove that the message was confidential. Anyone who learns the key can forge valid tags, so production verification should use a constant-time comparison function on the server.
Even though inputs are not sent to the site server, avoid entering production secrets on an untrusted device. The product is designed to keep key material in the current tab.
Resolve mismatches with a byte-level checklist
When two HMAC results differ, compare one setting at a time instead of changing the hash and encoding simultaneously.
- Confirm that both systems use the same hash algorithm.
- Check that the secret keys contain exactly the same bytes.
- Check the message for spaces, line breaks, trailing newlines and Unicode differences.
- Confirm that UTF-8 text was not intended as raw hexadecimal bytes.
- Verify whether one result is full and the other is truncated.
- Compare hexadecimal with hexadecimal, standard Base64 with standard Base64, or Base64url with Base64url.
Correctness in the generator is locked to eight full RFC 4231 conformance tags. 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 each, while SHA-384 remains available as the Web Crypto-defined option. The published RFC 4231 test vectors provide the external reference cases.
Understand the browser-side limits
The interface rejects empty keys and empty messages to prevent accidental calculations, even though some low-level standards can define behavior for zero-length data. Each decoded field is limited to 1,000,000 bytes.
The selected bytes are imported as a non-exportable Web Crypto HMAC key, and the signing operation returns the complete tag. The page then renders those same bytes independently as lowercase hex and padded Base64.
Asynchronous jobs carry an identity token, so changing an input while Web Crypto is working prevents an older result from overwriting the newer state.
Before using a result, confirm the governing algorithm, exact byte construction, tag length and required encoding. Successful generation confirms the browser’s calculation for the entered bytes; successful verification confirms that the receiver calculates the same tag.
For a deeper look, see SHA256 Hash Generator for Bulk Hashing: What Works.