How to convert hex to text
Hexadecimal writes each byte as two digits, 00 to ff. To convert hex to text, the tool turns every pair of digits back into a byte, then reads the bytes as characters in the character set you choose. The built-in sample is:
48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a 43 61 66 c3 a9 20 e2 82 ac 35 20 f0 9f 98 80Read as UTF-8, those 29 bytes give 23 characters over two lines:
Hello, world!
Café €5 😀Plain letters take one byte each, so 48 is H. The accent, the euro sign and the emoji take two, three and four bytes. That is why the byte count is higher than the character count.
Hex formats the converter reads
Hex shows up in many shapes, and most converters accept only one. This one detects the shape and tells you which it found. It reads:
- Spaced bytes, one per line or in a row: 48 65 6c 6c 6f
- Continuous digits: 48656c6c6f, also wrapped over several lines
- 0x prefixes, with or without commas: 0x48 0x65 or {0x48, 0x65}, as in a C array, and a single 0x in front of a long run
- \x escapes: \x48\x65, including a Python bytes literal such as b'\x48\x65' and quoted lines
- Percent codes from a URL: %48%65%6c
- SQL literals: X'48656C6C6F'
- Separators of colons, dashes, commas or semicolons, as in a MAC address or a fingerprint
- Dump output from xxd and hexdump -C, with the offset column and the text on the right removed
Letters can be upper or lower case. Mixed shapes are accepted too, and the status line says mixed. A group of one digit, such as 0xA, is read as 0A. The tool tells you when it did that.
Convert a hex dump from xxd or hexdump to text
Dump tools print an offset, the bytes and a text column. Paste the whole output and the tool keeps only the bytes. This input, written by xxd:
00000000: 5468 6520 6b65 7920 6973 2073 6574 2e0a The key is set..
00000010: 4361 6665 cc81 20e2 9c93 Cafe.. ..decodes to the line The key is set. followed by Café and a check mark. Here the letter é is written as e followed by a combining accent, which is why the bytes are cc 81. A line with only a star in hexdump output means repeated lines were skipped by hexdump itself. Those bytes are not in your paste, so the tool leaves them out and tells you.
Why you may see strange symbols
The same bytes give different text in different character sets. Take these six bytes:
43 61 66 e9 20 80In Windows-1252, the older Western European set, they read as Café followed by a space and a euro sign. In UTF-8 the byte e9 starts a three-byte character that never finishes, and 80 is a stray continuation byte. Each shows as the replacement character, so you see Caf followed by two replacement symbols. The note under the output counts them and suggests trying another character set.
If you pick ASCII, any byte above 7f cannot be a character and is shown as the replacement symbol too. UTF-16 reads two bytes for each character, and the order matters: 48 00 is H in little-endian and a different character in big-endian.
When the hex is wrong
A byte needs exactly two digits. If a group has three, the message names the line and column where the group starts. If a character is not hex, the message names it and its position. For the input 48 65 6c 6g it reads: Unexpected character "g" at line 1, column 11, with a reminder that hex uses 0 to 9 and a to f.
Text that is not hex at all often has a different cause. A string such as SGVsbG8= is Base64, which Base64 Decode handles. Text with percent signs inside a link is covered by URL Decode, and entities such as & by HTML Decoder.
Hex to text in Python, JavaScript and on the command line
In Python, bytes.fromhex ignores spaces and decode picks the character set:
print(bytes.fromhex("48 65 6c 6c 6f").decode("utf-8"))In Node.js, use a Buffer. On the command line, xxd reverses plain hex:
Buffer.from("48656c6c6f", "hex").toString("utf8")echo 48656c6c6f | xxd -r -pIn Excel, HEX2DEC turns one byte into a number and CHAR turns that number into a character. That works for a single ASCII byte per cell, so longer text is easier to paste here. To go the other way, use Text to Hex. If you need to find odd characters in text you already have, Remove Unicode Characters can strip them.
Limits
- The tool decodes bytes to text. It does not open binary files, so images or archives pasted as hex give meaningless characters.
- Bytes that are not valid in the chosen character set show as the replacement symbol, and the original value cannot be recovered from the text.
- Latin-1 here means Windows-1252, the set browsers use under that name. It differs from strict ISO-8859-1 only for the bytes 80 to 9f.
- Hex shown as Unicode escapes such as \u0048, and numbers in other bases, are different formats and are not read.
- Very large input is limited to 2,000,000 characters.
Your hex is decoded in your browser. It is not uploaded or stored. See the Privacy Policy for details.