Text to Hex or Binary and Back (UTF-8)
Convert text to hex or binary, or decode UTF-8 bytes back to text. Choose a separator for the output. Persian text and emoji are supported.
Use this tool in your browser without installing software.
About this tool
The Persian word سلام has four letters but takes eight bytes in UTF-8. Each byte is written as two hex digits or eight binary digits. To decode bytes back to text, they must form a valid UTF-8 sequence. If you know the input format, select hex or binary rather than relying on automatic detection.
How to use it
- 1
Choose “Encode text” to get hex or binary, or “Decode to text” to read bytes as text.
- 2
To encode text, choose a format and separator. To decode, choose the incoming format or use automatic detection.
- 3
Copy the result from the output box, or press Swap to send it back and check the round trip.
If the answer looks wrong
- My output does not match another site.
That site may read the text with a different encoding, such as UTF-16 or a legacy local one. This tool always writes UTF-8, the form the web uses and the one browsers use for Persian text.
- Why is the byte count different from the letter count?
Hex represents bytes, not letters. Spaces, zero-width non-joiners and emoji all contribute to the byte count. Use a character counter if you need the length of the text.
- My input is rejected.
If the error names an invalid character, check it against the source. If the hex digit count is odd, check the pairs in the original: the tool cannot tell which digit is missing or extra.
Frequently asked questions
Why is سلام longer than four hex pairs?
Each pair of hex digits is one byte. In UTF-8, سلام takes eight bytes. A takes one byte, but é takes two, so counting hex pairs does not tell you how many letters there are.
Does it matter if I leave out the spaces between bytes?
No. A continuous string reads the same way, because each byte is exactly two hex digits. The digit count only has to stay even. In binary each byte is eight bits, and a continuous run is accepted too.
What does “these bytes are not valid text” mean?
The bytes do not form a valid UTF-8 sequence. Check that the source uses UTF-8 and that no bytes were lost when you copied it.
Can I use the output in code or another file?
Yes. A space or colon separator gives output that is easy to read and paste in most programming languages, and No separator gives one continuous string. Values with 0x prefixes are accepted on the way back as well.
Is my text sent anywhere?
No. The conversion happens on this page, in your browser, and no request carries the text. Closing the page clears it.