What this tool calculates
HMAC authenticates a message using a shared secret and a selected hash function. This tool defaults to HMAC-SHA256 and also supports SHA384 and SHA512. It is not the same as hashing the key and message concatenated together, and it does not encrypt or conceal the message.
Message text is encoded as UTF-8. The key has a separate encoding control: UTF-8 interprets visible characters as text, while Hex interprets pairs of hexadecimal digits as raw bytes. For example, the Hex key 4a656665 represents the same bytes as the UTF-8 key Jefe. Spaces, odd-length strings and non-hexadecimal characters are rejected in Hex mode.
The example uses public test data from RFC 4231, not a secret generated for your application. Empty keys are supported by the implementation but do not provide a useful secret. Keys remain in this tab's memory and are not included in exports. Clear the page when finished, and use an audited implementation in your own application for real protocol verification.
Worked example
HMAC-SHA256 · UTF-8 · Jefe · what do ya want for nothing?
5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
How to calculate and compare
- Enter the text to authenticate in Message. Its UTF-8 bytes are used without removing spaces or changing line endings.
- Enter Secret key and select Key encoding. UTF-8 uses the key as text; Hex reads pairs of hexadecimal digits as bytes. Hex must have an even number of digits and no spaces.
- Select HMAC-SHA-256, HMAC-SHA-384 or HMAC-SHA-512, then click Generate hash. HMAC never recalculates automatically; after changing the message, key, encoding or algorithm, generate again.
- Compare the full result with a reference produced using the same message bytes, key bytes and HMAC algorithm. SHA-256, SHA-384 and SHA-512 results contain 64, 96 and 128 hexadecimal characters respectively.
- Copy or download the result, then click Clear to remove the message, key and result from the form.
Example loads the public RFC 4231 message and the UTF-8 key Jefe; it is not a private key for your application. TXT and CSV exports include the algorithm and HMAC value, never the key or message. This page processes one text message at a time; file HMAC and line-by-line HMAC are not available.
Limits, privacy and next steps
The message is limited to 10 MiB of UTF-8 data; the decoded key is also limited to 10 MiB. A Hex key needs two hexadecimal digits per byte. HMAC runs in a Web Worker and can be cancelled. Keys are not saved to browser storage or included in URLs or exports. Clear the form when finished; releasing browser memory is not a certified secure-erasure guarantee. Normal page and asset requests still reach the host.