Hex to Text Converter
Convert between hexadecimal and text.Runs in this tab.⌘ ↵ runs it
Next step
Turn a click-through into an interactive demo
AtriumKit records your web app once in Chrome and turns every click into a step of a demo you can embed or share. There’s a free plan.
Try AtriumKit freeAbout Hex to Text Converter
Hex to text, one byte at a time
The encoder turns the text into UTF-8, then writes each byte as two uppercase hex digits with a space between bytes. “Hi” is two bytes:
Hi → 48 69
“Hello” is five:
Hello → 48 65 6C 6C 6F
A character outside ASCII takes more than one byte. é is the two bytes C3 A9, so “café” is five bytes:
café → 63 61 66 C3 A9
The binary to text converter does the same split in base 2. The UTF-8 byte viewer shows the code point and the byte length of one character at a time.
What the decoder accepts
Set the mode to Hex to Text and paste 48656C6C6F. The output is Hello. The same digits with a space every two characters, 48 65 6C 6C 6F, decode to the same word.
A decode comes out wrong in a few predictable ways:
- Spaces, commas, and line breaks are all separators, so
48 65and48,65both decode to “He”. - A
0xprefix is removed before the digits are read.0x48 0x69decodes to “Hi”. - Upper and lower case are the same value.
6cand6Care both the letter l. - One long run of hex, with no spaces, is split into pairs from the left.
- An odd number of digits leaves the last digit as its own byte.
486is the bytes 48 and 06, which is “H” followed by a control character.
The same conversion in code
' '.join(f'{b:02X}' for b in 'Hello'.encode())
bytes.fromhex('48 65 6C 6C 6F').decode()
[...new TextEncoder().encode('Hello')].map(b => b.toString(16).padStart(2, '0').toUpperCase()).join(' ')
new TextDecoder().decode(new Uint8Array('48 65 6C 6C 6F'.split(' ').map(h => parseInt(h, 16))))
Python’s bytes.fromhex rejects an odd number of digits. This page keeps the leftover digit as a one-digit byte, as with 486 above.
Questions
What is hexadecimal encoding?
What format does this tool use?
How do I decode a hex dump?
Where is hex encoding commonly used?
How do I convert a hex color code to text?
Does the hex converter handle non-ASCII characters?
Comments
More in Encoding & Decoding
- Base64 Encoder / Decoder
- URL Encoder / Decoder
- HTML Entity Encoder / Decoder
- JWT Decoder
- Base32 Encoder / Decoder
- ROT13 Encoder / Decoder
- Morse Code Translator
- Binary to Text Converter
Comments