Hex Encoder / Decoder

Encode text to hexadecimal and decode hex back to text. Pure client-side.

Hex Encode / Decode

Converts text to its underlying UTF-8 bytes shown as space-separated lowercase hex pairs, and back again. It is the fastest way to see what a string actually looks like at the byte level — including the multibyte sequences hiding inside accented characters, which is where most 'string length' bugs live.

Encode
Input: Hi
Output: 48 69
Multibyte UTF-8
Input: café
Output: 63 61 66 c3 a9
Four characters, five bytes: é is the two-byte sequence c3 a9. This is why a 'four-character' string can blow a five-byte column limit.

Questions people ask

Why won't 68656c6c6f decode?

The decoder splits input on whitespace and requires each token to be exactly two hex digits, so a ten-digit run is rejected as one invalid token with the error 'Invalid hex value: 68656c6c6f'. Add a space after every pair — 68 65 6c 6c 6f — and it decodes to hello. If you are pasting from a tool that emits unspaced hex, break it into pairs first.

My hex pairs are valid, so why does decoding still fail?

Decoding runs a strict UTF-8 decode, so byte sequences that are not legal UTF-8 fail with 'Decoding failed — invalid hex format' even when every pair parses. A lone ff is the simplest case — 0xff never appears anywhere in valid UTF-8. This tool is for text round-trips; for arbitrary binary data, file to base64 is the better fit.

Base64 encodes the same bytes at about 33 percent overhead versus hex's 100 percent, and the number base converter is the right tool when you have a single number rather than a byte string.

Further reading