Skip to main content
Tools

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.

Byte format

0 characters · 1 line

0 characters · 1 line

How to use

  1. Choose “Text to hex” or “Hex to text”.
  2. Paste or type into the input, or click “Example” to try it. The result updates instantly.
  3. When converting to hex, separate bytes with spaces, nothing, or a 0x, \x or % prefix, in upper or lower case.
  4. When converting back, UTF-8 is checked strictly. Errors name the byte and its place in your input.
  5. 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.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.