Accurate hexadecimal encoder/decoder: convert any text (ASCII, Unicode, Emoji) to hexadecimal representation and back. Follows the Base16 encoding scheme defined in RFC 4648 and the WHATWG Encoding Standard.
Hexadecimal (hex) is a base‑16 numeral system using digits 0‑9 and letters A‑F. Each hex digit represents exactly 4 bits. When encoding text, the string is first transcoded to a sequence of UTF‑8 bytes; each byte is then represented by two hexadecimal digits. This encoding is formally defined as Base16 in RFC 4648 and is widely used in computing: memory dumps, color values, cryptographic hashes, and low‑level data inspection.
⚙️ How it works (algorithmic description):
1. Input text → UTF‑8 encoded byte sequence using TextEncoder (standard Web API, compliant with WHATWG).
2. Each byte (0–255) is converted to a two‑character hex representation (e.g., 65 → "41").
3. Optional formatting: spaces, colons, or no delimiter between bytes.
4. Decoding reverses: sanitize hex string (strip spaces, colons, optional "0x" prefixes), group into bytes, then decode via TextDecoder (UTF‑8).
You can manually test the tool against these known input/output pairs to confirm correctness. All examples follow RFC 4648 and UTF‑8 encoding.
| Input Text | UTF‑8 Hex (lowercase, no delimiter) | Expected output |
|---|---|---|
"A"
|
41
|
Decodes back to "A" |
"Hello"
|
48656c6c6f
|
Decodes back to "Hello" |
"€" (Euro sign)
|
e282ac
|
Decodes to "€" (U+20AC, UTF-8: 0xE2 0x82 0xAC) |
"?" (rocket)
|
f09f9a80
|
Decodes to "?" (U+1F680, 4-byte UTF-8) |
"こんにちは"
|
e38193e38293e381abe381a1e381af
|
Decodes to original Japanese |
Unlike naive ASCII‑only converters, this tool fully supports the entire Unicode repertoire (including emojis, CJK ideographs, and mathematical symbols). It uses the browser’s native TextEncoder and TextDecoder, which are maintained by browser vendors to comply with the latest Unicode standard (v15.1 as of 2025). The hex conversion itself is a simple mapping: each byte is transformed using byte.toString(16).padStart(2,'0'), and decoding uses parseInt(byteHex, 16). This is deterministic and can be verified against any reference implementation.
The decoder is intentionally robust: it strips spaces, colons, newlines, and even optional "0x" prefixes before converting. This makes it compatible with hex dumps from various sources (Wireshark, xxd, etc.). However, it does not attempt to guess missing leading zeros – if the hex string has an odd number of characters, an error is raised.