Skip to content

HMAC Generator

Generate HMAC-SHA-256, HMAC-SHA-384 or HMAC-SHA-512 from exact UTF-8 or hexadecimal key and message bytes.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Choose SHA-256, SHA-384 or SHA-512 and confirm the protocol expects a full HMAC tag.
  2. 2.Select UTF-8 or hex independently for the key and message, then enter the exact bytes without extra formatting.
  3. 3.Generate the tag and copy hex or standard Base64; convert or truncate only when the protocol explicitly requires it.

About HMAC Generator

HMAC Generator calculates a keyed-hash message authentication code with SHA-256, SHA-384 or SHA-512. Enter the secret key and message as UTF-8 text or exact hexadecimal bytes, choose the hash, and receive the complete tag in lowercase hex and standard padded Base64. The operation uses the browser Web Cryptography API and does not send inputs to the site server.

HMAC combines a cryptographic hash with a shared secret key. A verifier that possesses the same secret and exact message bytes can calculate the same tag, which can detect modification and authenticate the party that knew the key. HMAC does not hide the message. Anyone who sees plaintext can still read it, and anyone who learns the key can forge valid tags.

Byte identity is essential. Text mode encodes both fields as UTF-8, so accented letters, CJK characters and emoji occupy multiple bytes. Hex mode accepts only an even number of hexadecimal digits and preserves every byte, including zero. It rejects prefixes, spaces, colons and odd nibbles so an accidental formatting character cannot silently change a protocol value.

The selected hash changes tag length: SHA-256 returns 32 bytes, SHA-384 returns 48, and SHA-512 returns 64. This page always displays the full output. A protocol may require truncation, a prefixed algorithm identifier, a canonical request string, a binary envelope or Base64url rather than standard Base64. Apply those rules only from the protocol specification; do not trim a tag by eye.

Key handling determines security. Use independently generated high-entropy key material appropriate for the protocol, distribute it through a protected channel, separate keys by purpose, rotate after compromise and compare tags with a constant-time function on the server. A human password is not automatically a strong HMAC key. When a password must become a key, use the exact password-based derivation scheme and parameters required by the application.

The page limits each decoded field to 1,000,000 bytes. Asynchronous jobs carry an identity token, so changing input while Web Crypto is working prevents an older result from overwriting the new state. Empty keys and messages are rejected by this interface to prevent accidental clicks, even though some low-level standards can define behavior for zero-length data.

Correctness 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, while the UI also exposes the WebCrypto-defined SHA-384 option.

Use the generator only after identifying the exact bytes and algorithm from the governing protocol. Prefer hex mode for published vectors and binary fields. Compare the complete tag in the required encoding, avoid pasting production secrets into an untrusted device, and remember that successful agreement proves shared key and byte consistency, not message confidentiality. Hex and Base64 are only renderings of identical tag bytes. The page does not emit Base64url, prepend an algorithm identifier or package the message with its tag. Store and transmit each field according to the protocol, since visually similar encodings are not interchangeable and decoding them produces different bytes.

Methodology & sources

The chosen bytes are imported as a non-exportable WebCrypto HMAC key with SHA-256, SHA-384 or SHA-512. subtle.sign returns the full tag, which is rendered independently as lowercase hex and padded Base64.

Frequently asked questions

Encoding & Crypto guides

View all