Hex to text converter
Paste hexadecimal to read it as text, or type text to see it in hex. It accepts hex with spaces, colons, or 0x in front, and handles accents and emoji correctly because it reads the bytes as UTF-8.
13 bytes.
Text is read and written as UTF-8. The conversion runs in your browser, and nothing is uploaded.
How to use the converter
- Hex to text. Paste hex into the left box. The text appears on the right
- Text to hex. Type in the right box. The hex appears on the left
The decoder is forgiving about how the hex is written. All of these give the same result:
48656c6c6f
48 65 6c 6c 6f
48:65:6C:6C:6F
0x48, 0x65, 0x6c, 0x6c, 0x6f
\x48\x65\x6c\x6c\x6f
How hex represents text
Computers store text as bytes, and a byte is a number from 0 to 255. Hexadecimal is a compact way of writing those numbers, using sixteen digits: 0-9 and then a-f for ten to fifteen. Two hex digits cover exactly one byte, from 00 to ff.
So "hex to text" is two steps: turn each pair of digits back into a byte, then turn the bytes into characters.
| Character | Decimal | Hex |
|---|---|---|
A |
65 | 41 |
Z |
90 | 5a |
a |
97 | 61 |
z |
122 | 7a |
0 |
48 | 30 |
9 |
57 | 39 |
| space | 32 | 20 |
| line feed | 10 | 0a |
Those values are ASCII, which covers unaccented English letters, digits and punctuation in one byte each. The word Hello is 48 65 6c 6c 6f.
Accents, emoji and other scripts
Characters outside ASCII take more than one byte. This converter uses UTF-8, the encoding used almost everywhere now:
| Character | UTF-8 bytes in hex |
|---|---|
é |
c3 a9 |
€ |
e2 82 ac |
日 |
e6 97 a5 |
✓ |
e2 9c 93 |
That's why a string's hex can be longer than twice its number of characters, and why decoding one byte at a time turns é into é. If you see that pattern, the text was UTF-8 and something read it as a single-byte encoding.
If the hex you paste isn't valid UTF-8, the converter says so and shows each byte as one character, so you can still see what's there.
Hex to text in code
JavaScript
const bytes = Uint8Array.from("48656c6c6f".match(/../g), (pair) => parseInt(pair, 16))
new TextDecoder().decode(bytes) // "Hello"
Array.from(new TextEncoder().encode("Hello"), (b) => b.toString(16).padStart(2, "0")).join("") // "48656c6c6f"
Python
bytes.fromhex("48656c6c6f").decode() # 'Hello'
"Hello".encode().hex() # '48656c6c6f'
Command line
echo "48656c6c6f" | xxd -r -p # Hello
echo -n "Hello" | xxd -p # 48656c6c6f
When hex isn't text
Plenty of hex isn't meant to be read as text at all. If the result is gibberish, it's probably one of these:
- A hash or a checksum. A SHA-256 is 64 hex digits of what is effectively random data. The checksum calculator makes and compares them
- A key or a secret. Random bytes written in hex. The API key generator makes them
- A UUID. 32 hex digits with a structure of its own. The UUID generator can tell you its version
- Part of a file. A hex dump of an image or a program shows its raw bytes
For binary data that has to travel as text, Base64 is more compact than hex: it uses four characters for every three bytes where hex uses six. The Base64 encoder converts both ways.
Common questions about hex and text
How do I convert hex to text?
Paste the hex into the left box above. By hand, split it into pairs of digits, convert each pair to a number, and look up the character with that number.
How do I convert text to hex?
Type the text into the right box. Each character becomes one or more bytes, and each byte is written as two hex digits.
What does 48 65 6c 6c 6f mean?
It's the word "Hello" in ASCII: 48 is H, 65 is e, 6c is l, and 6f is o.
Why is my decoded text full of strange characters?
Either the hex isn't text, as with a hash or a key, or it's text in a different encoding. Stray à characters usually mean UTF-8 text was read one byte at a time.
Is hex the same as ASCII?
No. ASCII assigns numbers to characters. Hex is a way of writing numbers. "Hex to ASCII" means reading hex bytes as ASCII characters.
Why does hex use letters?
It's base sixteen, so it needs sixteen digits. After 0 to 9, the letters a to f stand for ten to fifteen.
Does upper or lower case matter in hex?
No. 6C and 6c are the same byte. Tick "Uppercase" if you need the output in capitals.
What happens if I paste an odd number of hex digits?
Each byte needs two digits, so an odd count means one is missing. The converter tells you so and doesn't guess.