Text to Hex
Convert text to UTF-8 bytes in hex or decode hex back to text, with strict UTF-8 validation that points at the bad byte.
0 characters · 1 line
0 characters · 1 line
Shortcut: Ctrl/⌘ + Enter uses the result as input and switches mode
How to use
- Choose “Text to hex” or “Hex to text”.
- Paste or type into the input, or click “Example” to try it. The result updates instantly.
- When converting to hex, separate bytes with spaces, nothing, or a 0x, \x or % prefix, in upper or lower case.
- When converting back, UTF-8 is checked strictly. Errors name the byte and its place in your input.
- Click “Copy” to grab the result, or “Use result as input” to convert it back and check that it matches.
FAQ
Is my data uploaded?
No. Every conversion happens in your browser, and your data never leaves your device.
Why is one Chinese character three bytes?
This tool uses UTF-8: letters and digits take 1 byte, most Chinese characters 3 (你 is e4 bd a0) and emoji usually 4. Tools that show 2 bytes are probably using Big5 or UTF-16.
Where is each byte format used?
Spaces are easiest to read. The 0x prefix is common in C and Java arrays, \x in Python, JavaScript and shell strings, and % is URL percent-encoding. When converting back, you can paste any of them, even mixed together.
What does “not valid UTF-8” mean?
The bytes cannot form UTF-8 text. Usually part of the data is missing, it uses another encoding such as Big5 or Latin-1, or it is binary data such as an image. The message points at the first bad byte so you can check it.
Related tools
Base64 Encode/Decode
Encode text to Base64 or decode it back, with full UTF-8 support for Chinese and emoji and a URL-safe option.Unicode Escape
Convert text to \uXXXX, \u{…}, &#x…;, U+XXXX and other escapes or back, with each character’s code point and UTF-8 bytes.URL Encode/Decode
Percent-encode or decode URLs and query parameters, with full UTF-8 support and exact error positions.