Skip to main content

Hex

Hexadecimal (Base16) encoding maps every byte to two characters from 0-9 and a-f. Developers use hex strings to inspect binary protocols, checksums, packet dumps, and UTF-8 byte sequences.

2 tools

Encoding and decoding hex strings

Use the Hex encoder to turn UTF-8 text into lowercase or uppercase hexadecimal bytes, with optional spacing or 0x prefixes. Use the Hex decoder to convert a valid even-length hex string back into text.

Because each byte expands to two hex characters, hex output is always twice the byte length of the input. Multi-byte UTF-8 characters produce 4, 6, or 8 hex digits.

Common hex decoding errors

An odd number of hex digits or characters outside 0-9 and a-f causes decoding to fail. Strip prefixes such as 0x or spaces if you are copying from a debugger, or use the Base64 converters when you need a more compact ASCII representation.