Text to hex converter
Turn text into its UTF-8 bytes in hexadecimal and hex back into text, with the separator and letter case you need, and see exactly which bytes are not valid text. It runs on your device: nothing is sent.
How it works
Choose Text to hex to see the bytes a text is made of, or Hex to text to read bytes back as text. The result appears on the right as you type.
- Separator: how the bytes are written, with a space (
48 69), with nothing (4869), with colons (48:69), as escapes for a string in code (\x48\x69), as a C array (0x48, 0x69) or as in a web address (%48%69). - Letter case:
c3 a9orC3 A9. - Byte table shows the offset, the bytes and the characters, 8 or 16 bytes to a row.
- Swap puts the result into the input and turns the direction round.
- A file can be opened or dropped onto the input. A text file is read as text; any other file is shown as its bytes in hex.
Hexadecimal and UTF-8
A byte is a number from 0 to 255. Hexadecimal writes it with two digits from 0 to 9 and a to f: 48 is 72, the letter H, and ff is 255. UTF-8 decides which bytes stand for which character. The first 128 characters, the English letters, digits and punctuation, are one byte each, the same as in ASCII. Every other character takes two, three or four bytes: é is c3 a9, € is e2 82 ac, 🎉 is f0 9f 8e 89.
Bytes that are not text
Hex can hold any bytes, and many runs of bytes are not UTF-8: ff fe, for example, is how UTF-16 text begins, and c3 alone is the start of a character with no end. These bytes are flagged, never replaced in silence: the status says which bytes, at which offset and why, they are marked in the hex you typed, and they appear as � in the text, marked too.
Questions and answers
Is what I paste or open sent anywhere?
No. It is converted in your browser, on your device. Nothing you type, paste or open is uploaded, and nothing is kept once you close the page.
Why is é two bytes, c3 a9, and not one?
Text is turned into bytes with UTF-8, the encoding of the web. A letter of the English alphabet is one byte, é and most accented letters two, most Greek, Arabic or Hebrew letters two, Chinese and Japanese characters three, an emoji four. The tool shows each character's bytes in the same colour, so you can see where one ends and the next begins.
What does "not valid UTF-8 text" mean?
Not every run of bytes is UTF-8. A byte such as ff never appears in it, and a character's first byte must be followed by the right number of continuation bytes. When bytes break these rules, the tool names each run, says why and where it is, and marks it in the input and the result, instead of quietly replacing it as many tools do.
Which ways of writing hex can it read?
Any of the ones it writes, and a mix of them, such as 48 69, 4869, 48:69, 48-69, \x48\x69, 0x48, 0x69 and %48%69, in capitals or not, across several lines. Spaces, commas, colons, semicolons, dashes and line breaks between bytes are passed over.
What is the byte table?
The bytes as a hex dump, the way xxd or hexdump draw them. Each line starts with its offset, the place of its first byte counted from 0 in hex, then 8 or 16 bytes, then the characters they hold. It is a quick way to find a stray byte or a hidden character such as a tab or a non-breaking space.
Runs on your device. Nothing you type or open is sent anywhere.