LocalToolkit
HomeEncoding & Decoding › Hex Encoder / Decoder

Hex Encoder & Decoder

Two hex characters per byte, in both directions.

🔒 Runs in your browser. Nothing is uploaded — verify it in the network panel, or disconnect and try again.

Why hex exists

One byte is eight bits, and one hex digit is four bits — so a byte is always exactly two hex characters, with no padding rules and no ambiguous grouping. That one-to-one alignment is why hex, not decimal, is the notation for digests, memory addresses, colour values, and byte dumps.

Encoding goes through UTF-8, not code points

The letter A is byte 0x41, one byte, 41. The character is U+4E2D, which UTF-8 encodes as three bytes E4 B8 AD, printed as e4b8ad. An emoji like 🚀 (U+1F680) becomes four bytes F0 9F 9A 80, printed as f09f9a80. Hex is a view of bytes, so the byte length of a string is not its character count.

Where you meet hex strings

Case, separators, and the odd-length error

Case is cosmetic: E4B8AD and e4b8ad are the same bytes, and any correct decoder accepts both. Separators such as spaces, colons, or 0x prefixes appear in logs and dumps; a good decoder strips them, but the strictest output form — no separators, lowercase — is what you should store and compare, because a byte-for-byte comparison of two differently formatted hex strings fails even when the bytes are identical.

A hex string with an odd number of characters cannot be decoded: half a byte is not a byte. It almost always means a character was dropped in a copy-paste, and the decoder should tell you the length rather than silently guess.

How to use it

  1. Paste text to encode, or a hex string to decode.
  2. Read the byte count alongside the result.
  3. Strip separators if a downstream tool requires a bare string.

Worth knowing

  • Two hex characters always represent exactly one byte.
  • UTF-8 uses one byte for ASCII, three for most CJK characters, four for emoji and rare scripts.
  • Hex is not a number base you should store in — it is a byte notation, not arithmetic.
  • Padding matters for numerals (0x0A is one byte; 0x0A0B is two).

Limitations

  • Hex doubles the size of ASCII text, worse than Base64's 33 percent overhead.
  • Mixed-case hex is a valid byte string but a poor comparison key.
  • Odd-length input is an error, not something a decoder should repair.
  • Hexadecimal numerals and hex byte strings look alike but mean different things.

Frequently asked questions

How many hex characters is one byte?
Exactly two, always — one digit per nibble. That is why a 32-byte SHA-256 digest prints as 64 characters.
Why is my Chinese text so many hex bytes?
Because UTF-8 encodes most CJK characters as three bytes, so each character appears as six hex digits. The byte count, not the character count, is what hex shows.
Is lowercase or uppercase hex better?
Both are valid. Lowercase is the convention for digests and is what sha256sum prints; uppercase is common in hardware documentation. Pick one for storage and normalise on input.
Can I decode hex without separators?
Yes — that is the normal form for digests. Spaces, colons and 0x prefixes are display conveniences and should be stripped before decoding.
Related tools
Base64 Encoder / DecoderSHA-256 Hash GeneratorURL Encoder / DecoderBinary / Text ConverterHTML Entity Encoder / DecoderJWT Decoder
Keep reading
How browser-only processing worksAll Encoding & Decoding toolsEvery tool on the site