An HMAC generator on a Mac can produce HMAC-SHA-256, HMAC-SHA-384, or HMAC-SHA-512 tags in a browser without sending the key or message to the site server.
This browser workflow is useful when a macOS application, API, webhook receiver, or other verifier expects an HMAC signature. HMAC authenticates exact message bytes with a shared secret: a verifier holding the same secret can calculate the same tag, detect changes to the message, and confirm that the sender knew the key. It does not encrypt or conceal the message, so the original content must still be protected separately.

Generate an HMAC on macOS in a browser
The HMAC Generator uses the browser Web Cryptography API rather than a native macOS application. Open its page in a browser on your Mac, then follow these steps.
- Open the generator and select the hash. Choose SHA-256, SHA-384, or SHA-512 according to the governing protocol. Confirm that the protocol expects a complete HMAC tag; a specification that defines truncation, a prefixed algorithm identifier, or another envelope requires additional handling after generation.
- Select the key’s input representation. Choose UTF-8 for text or hexadecimal for exact bytes. The key and message can use these modes independently, so a text key can authenticate a hexadecimal message when the protocol defines it that way.
- Select the message’s input representation. Apply the same decision to the message bytes. Use UTF-8 only when both parties treat the text as UTF-8. Prefer hexadecimal for binary fields, published vectors, and other values whose byte sequence is already specified.
- Enter the exact key and message. In UTF-8 mode, type the intended characters without quotation marks or extra spaces. Do not add a trailing newline unless the protocol includes it. In hexadecimal mode, enter only an even number of hexadecimal digits; prefixes, spaces, colons, and odd nibbles are rejected so formatting cannot silently alter the value.
- Generate the tag. The browser imports the selected bytes as a non-exportable Web Crypto HMAC key and uses the selected hash to produce the complete authentication tag.
- Copy the required output. The page provides the full tag in lowercase hexadecimal and padded standard Base64. Choose the representation required by the protocol rather than converting the tag by eye.
- Validate the receiving side. Confirm that the verifier uses the same hash, key bytes, message bytes, and output encoding. Production servers should compare authentication tags with a constant-time function rather than an ordinary string comparison.
Match the hash to the protocol
HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512 produce different tags from the same key and message. The selected hash also determines the full tag length:
| Hash | Full tag length | Lowercase hexadecimal length |
|---|---|---|
| SHA-256 | 32 bytes | 64 characters |
| SHA-384 | 48 bytes | 96 characters |
| SHA-512 | 64 bytes | 128 characters |
The generator always exposes the full tag for the selected hash. If an API accepts only a shorter value, its specification must state the required truncation rule. Removing characters from the end without an explicit protocol rule can produce a tag that appears plausible but fails verification. A hash name embedded in a request, such as an algorithm prefix, is also part of the protocol format rather than part of the raw HMAC output.
Choose the right input representation
Input mode determines the bytes used in the calculation, not merely how they appear in the form.
| Input mode | Accepted content | Best use | Important detail |
|---|---|---|---|
| UTF-8 | Text encoded as UTF-8 | Keys or messages defined by the protocol as UTF-8 text | Accented letters, CJK characters, and emoji can occupy multiple bytes; whitespace and newlines are also bytes. |
| Hexadecimal | An even number of hexadecimal digits | Binary keys, binary messages, and published vectors | Every byte is preserved, including zero bytes; prefixes, spaces, colons, and odd digit counts are rejected. |
For example, an accented character can look like one character on screen while representing several UTF-8 bytes. The receiving system must decode the same characters into the same bytes before calculating its HMAC. When a protocol publishes hexadecimal test values, hex mode removes uncertainty about character encoding. It also makes leading zero bytes visible, which a text representation can conceal.
Be careful not to treat visible similarity as byte identity. A key ending in one newline is different from a key ending in two, and a space after the message is different from no space. If a signed request is reconstructed from several fields, verify the canonical ordering, separators, encoding, and line-ending convention specified by that API.
Copy the representation the protocol expects
Hexadecimal and Base64 are two renderings of the same HMAC tag bytes. Lowercase hexadecimal is compact and easy to inspect, while padded standard Base64 may be required by APIs that transmit signatures as text. Neither rendering encrypts the tag, and neither changes which bytes are authenticated.
The generator does not emit Base64url, prepend an algorithm identifier, attach the message to the tag, or package the result as a binary envelope. A protocol may require one of those constructions, but the transformation must follow its specification. Do not assume that standard Base64 and Base64url are interchangeable: their alphabets and padding rules differ, and decoding them produces different bytes.
- Full hexadecimal tag: Copy it when the protocol compares or transmits hexadecimal.
- Padded standard Base64: Copy it when the protocol explicitly requires RFC-style standard Base64.
- Protocol-specific tag: Truncate, prefix, convert, or package only under explicit rules from the governing specification.
Limits that matter on a Mac
- Each decoded key or message field is limited to 1,000,000 bytes. For hexadecimal input, the limit applies after the hex digits are decoded into bytes.
- Empty keys and messages are rejected by the interface to prevent accidental tags, even though some low-level standards define behavior for zero-length data.
- Hex input is deliberately strict. It requires an even digit count and rejects common separators rather than silently ignoring them.
- Output is never shortened automatically. The full tag remains available, so any protocol-specific truncation stays visible and deliberate.
If you change an input while a calculation is running, an identity token prevents an older asynchronous result from replacing the newer state. For production signing, avoid pasting secrets into an untrusted device or browser environment. The no-server-upload behavior applies to the tool’s processing, but the security of the Mac, browser profile, extensions, and surrounding session still matters.
Diagnose a mismatched HMAC
Two systems can produce different tags without either calculation being broken. Check the following in order:
- Hash: Confirm both sides use SHA-256, SHA-384, or SHA-512 rather than a plain unkeyed hash.
- Key bytes: Compare the complete secret, including leading zeros, trailing whitespace, and any line ending.
- Message bytes: Confirm that both sides sign the same content rather than a display form, normalized JSON value, or differently ordered request string.
- Encoding: Check whether one side interprets text as UTF-8 and the other supplies raw hexadecimal bytes.
- Tag rules: Verify the specified truncation length, algorithm prefix, canonical request format, and binary envelope.
- Output alphabet: Determine whether the protocol expects hexadecimal, standard Base64, or Base64url.
Matching tags show that both parties possess the same key and processed identical bytes. They do not show that the message was encrypted or that the key cannot later be compromised.
Protect the secret key
Use independently generated, high-entropy key material appropriate for the protocol. Distribute it through a protected channel, use separate keys for different purposes, and rotate a key after suspected compromise. A human password is not automatically a strong HMAC key because passwords often contain limited entropy and are reused. When a specification permits a password-based key, use its exact password-based derivation scheme and parameters rather than improvising a replacement.
Never embed a production secret in a command copied from an untrusted page, screenshot, shared document, or chat transcript. Keep the key separate from the public message, and remember that anyone who obtains both the key and the ability to modify the message can generate valid authentication tags.
Verify before production use
For a protocol with published examples, compare the complete tag against its test vectors. The generator’s correctness checks are locked to eight full RFC 4231 test-vector tags, covering short and binary keys, keys smaller than the digest, repeated-byte data, and messages that cross hash block boundaries. SHA-256 and SHA-512 are checked across four independent inputs, while SHA-384 is also exposed by the interface.
The browser behavior follows the W3C Web Cryptography HMAC specification. Before relying on a Mac workflow for a live integration, run a known vector and then test the actual application’s request format. That catches algorithm, encoding, canonicalization, and output-format mistakes before a valid request is rejected in production.
For a deeper look, see Morse Code Translator on Mac: Browser Workflow.
For a deeper look, see SHA256 Hash Generator Alternative: Compare Exact Options.