Hex Encoder & Decoder

Free hex encoder and decoder. Convert text to hexadecimal bytes or decode hex back to text. Supports lowercase/uppercase output, a 0x prefix, per-byte 0x prefixes, and space-separated bytes. Runs entirely in your browser, no data uploaded.

Enter text above.

How hex encoder & decoder works

Hexadecimal encoding represents every byte of input as two hex digits (0-9, a-f or A-F). This is the most common way to inspect raw bytes — in hex dumps, debuggers, network captures, and source code — because every byte maps to exactly two characters.

Enter text to encode it to hex, or paste hex to decode it back to text. Choose lowercase or uppercase output, add a single leading 0x prefix, add per-byte 0x prefixes (e.g. 0x48 0x65), or separate bytes with spaces. When decoding, all 0x / \x prefixes and whitespace are stripped automatically, so you can paste formatted hex straight from a dump.

Hex encoding is an encoding, not encryption — it provides no security and anyone can reverse it. Use it to inspect, share, and transport raw bytes. All processing happens in your browser using built-in UTF-8 conversion.

Frequently asked questions

What is the 0x prefix option?
The 0x prefix marks a number as hexadecimal in source code and data dumps. The "0x" option adds a single leading 0x to the whole output; the "per-byte 0x" option prefixes every byte (e.g. 0x48 0x65) which is common in C-style byte arrays.
Can I decode hex that has spaces and 0x prefixes?
Yes. When decoding, the tool strips all whitespace, 0x prefixes, and \x escapes automatically, so you can paste formatted hex straight from a hex dump or source code without cleaning it first.
Why does my decoded text show replacement characters?
If the hex you decode does not represent valid UTF-8, invalid byte sequences become the U+FFFD replacement character. Make sure the hex came from UTF-8 text (or accept the replacement characters for non-text binary).
Is hex encoding the same as URL encoding?
No. Hex encoding converts bytes to hexadecimal digits. URL (percent) encoding wraps each hex byte in % signs (e.g. %48) so it is safe in URLs. Use the URL Encoder for web-safe escaping and this tool for raw hex inspection.