Skip to content

Generate HMAC SHA256 Online

HMAC is a message authentication code computed with a shared secret and a hash function.

With this online tool, you can generate a hash-based message authentication code with HMAC-SHA256, SHA-384, or SHA-512, or verify a received MAC in Hex or Base64.

Generate HMAC

Local HMAC example

Use UTF-8 message.txt and key.txt with exactly the intended bytes, including any line endings. Verification reads mac.txt in the detected encoding.

Verify HMAC

Verification recomputes the HMAC using the provided message and secret, then compares it securely with the received MAC.

This key is shorter than 16 UTF-8 bytes.

Local HMAC example

Use UTF-8 message.txt and key.txt with exactly the intended bytes, including any line endings. Verification reads mac.txt in the detected encoding.

What Is HMAC?

HMAC is a message authentication code computed with a shared secret and a hash function. For example, a webhook receiver can check whether a payload matches the tag created by a service that knows the secret.

How HMAC Works:

  • Components:
    • Message:The data you want to authenticate.
    • Key:A secret key known only to the sender and the receiver.
    • Hash Function:Typically, a cryptographic hash function like SHA-256 or SHA-512.
  • Calculation
    • Initialization:Choose an appropriate hash function (e.g., SHA-256) and a secret key K.
    • Key ModificationIf necessary, modify the key to fit the hash function's block size.
    • PaddingIf needed, pad the key so it fits the block size of the hash function.

When Should You NOT Use HMAC?

HMAC is not suitable for password storage or password hashing. If you are storing user passwords or deriving encryption keys from passwords, use a password hashing function instead:

Usage Guide - HMAC-SHA256 Online Tool

  1. Under Generate HMAC, enter the message and a test secret, then leave the hash function set to SHA-256.
  2. Choose Generate HMAC to see the Hex tag in Result. For Base64, change the selector beside Result and generate again.
  3. Choose Send to verification to try the generated tag. To check a tag from another source, enter the original message and shared secret, then select the matching hash function under Verify HMAC.
  4. Check the Received MAC (Hex or Base64) field, pasting the external tag if needed, then choose Verify HMAC.

Why does verification fail?

Try adding a space to the message and verifying the same tag again. Even one byte changes the calculation. For a webhook, use the exact text the sender authenticated, including any timestamp, line endings, or JSON whitespace covered by its signing rules.

Comparison between Hashing and Mac tools

Algorithm Purpose Use for Passwords?
HMAC-SHA256 Message authentication ❌ No
Poly1305 Message authentication ❌ No
Argon2 Password hashing ✅ Yes
PBKDF2 Password hashing / KDF ✅ Yes

If you need a modern and fast MAC algorithm, you should use: Poly1305 MAC Generator– High-performance MAC commonly used with ChaCha20.

❤️ Liked this tool?

If it saved you time, consider buying me a coffee to support future improvements.

Help Others Find This

References