🔣Text to Hex Converter

Convert text to and from hex

How text and hex are converted here

The same characters produce completely different hex depending on how they are split into bytes, so this tool asks you to pick the basis first. The default, UTF-8 bytes, is what the web and almost every text file use today: letters and digits take one byte, most accented and Greek letters take two, Hangul and CJK syllables take three, and most emoji take four. The letter H is 48, and the emoji U+1F600 is f0 9f 98 80.

The second basis, UTF-16 code units, is how JavaScript and Windows hold strings in memory. There every character in the basic plane is one four-digit unit, and emoji above it become a surrogate pair, so one emoji shows up as two four-digit groups. Because the two bases disagree, always check which one produced a value before you try to turn it back into text.

When decoding, spaces, commas and 0x or \x prefixes are stripped automatically, so you can paste values in most common formats. If the digit count does not match the chosen basis, or the bytes are not valid UTF-8, the tool stops and tells you exactly what went wrong instead of returning garbled characters. Upper and lower case digits are both accepted. Everything runs in your browser and nothing is uploaded.

Frequently asked questions

Why does one emoji produce eight hex digits?

Most emoji take four bytes in UTF-8 and each byte is written as two digits. Choose the UTF-16 basis and the same emoji becomes two four-digit units instead, because it is stored as a surrogate pair.

Can I turn the hex back into the original text?

Yes. Switch the direction to hex to text and pick the same encoding basis, and the original string comes back exactly. Picking the other basis produces garbled output or an error message.