Hex to ASCII Converter
Hex to ASCII converter: paste hexadecimal and read each byte as an ASCII character. Pairs such as 48 54 54 50 become HTTP. Bytes above 7F are not ASCII and are reported with their position. Conversion runs in your browser.
Use Hex to ASCII for a strict 7-bit reading with a character table; use the hex decoder for general hex-to-text decoding in UTF-8 and other encodings.
Byte table (8 bytes)
| # | Hex | Dec | Binary | Char |
|---|---|---|---|---|
| 1 | 48 | 72 | 01001000 | H |
| 2 | 54 | 84 | 01010100 | T |
| 3 | 54 | 84 | 01010100 | T |
| 4 | 50 | 80 | 01010000 | P |
| 5 | 2F | 47 | 00101111 | / |
| 6 | 31 | 49 | 00110001 | 1 |
| 7 | 2E | 46 | 00101110 | . |
| 8 | 31 | 49 | 00110001 | 1 |
Hex dump, xxd style (8 bytes)
00000000: 4854 5450 2f31 2e31 HTTP/1.1
Hex to ASCII: how pairs of digits become letters
ASCII assigns a number from 0 to 127 to each of its characters, and a byte holds a number from 0 to 255. A hex pair is one byte, so converting hex to ASCII means reading the pairs, turning each into its number and printing the character with that number. 48 is 4 × 16 + 8 = 72, and character 72 is H. The first digit is how many sixteens, the second how many ones.
The example below is the start of an HTTP request line as it appears in a packet capture. Every byte is below 80, so the whole thing is ASCII, and the output reads HTTP/1.1.
| Byte | Hex | Decimal | Character |
|---|---|---|---|
| 1 | 48 | 72 | H |
| 2 | 54 | 84 | T |
| 3 | 54 | 84 | T |
| 4 | 50 | 80 | P |
| 5 | 2F | 47 | / |
| 6 | 31 | 49 | 1 |
| 7 | 2E | 46 | . |
| 8 | 31 | 49 | 1 |
Two things in that table are worth a second look. The slash (2F) and the full stop (2E) sit next to each other because punctuation is stored in the gaps between the digit, upper case and lower case runs. And the character 1 has its own code, 31 in hex (49 in decimal); the byte 01 is a control code that prints nothing.
Hex to ASCII chart, 20 to 7E
Find the first hex digit in the left column and the second in the top row. The cell is the character, for example row 4 and column 1 is A (41), and row 6 and column 1 is a (61). The chart skips 00 to 1F because those codes do not print; they are covered next. The ASCII table lists all 128 codes with decimal, octal and binary values.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | space | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
| 3 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
| 4 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
| 5 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
| 6 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
| 7 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL |
Control characters in hex: 00 to 1F and 7F
Bytes below 20 are control codes. They do not draw a glyph; they tell a terminal, printer or protocol what to do. In converted text they appear as line breaks, tabs, or nothing at all, and the byte table under the decoder names each one. A handful turn up constantly in captured data.
| Hex | Name | What it does in a hex dump of text |
|---|---|---|
| 00 | NUL | Ends a C string; a run of 00 between letters usually means UTF-16 |
| 07 | BEL | Makes the terminal beep |
| 08 | BS | Backspace |
| 09 | TAB | Horizontal tab |
| 0A | LF | Line feed, the newline on Unix, Linux and macOS |
| 0D | CR | Carriage return; CR then LF (0D 0A) ends a line on Windows and in HTTP headers |
| 1B | ESC | Starts terminal escape sequences; 1B 5B 31 6D is ESC [ 1 m, which switches on bold |
| 7F | DEL | Delete; all seven bits set |
If a hex string decodes to readable text with a box or a stray symbol between the lines, the culprit is almost always 0D. HTTP, SMTP and many other text protocols end every header line with 0D 0A, so a captured request has an invisible 0D before each line break.
Bytes above 7F are not ASCII
ASCII is a 7-bit code, so every valid ASCII byte has its top bit clear, which is the same as saying it is 7F or less. A byte from 80 to FF is something else: a piece of a UTF-8 character, a letter in a legacy code page, or part of binary data. The converter treats the byte as an error and names it, rather than substituting a character that might be wrong.
The same byte means different things depending on what the sender used. E9 is the letter é in Latin-1 and Windows-1252, but in UTF-8 it is the lead byte of a three-byte sequence and invalid on its own.
| Reading | Result |
|---|---|
| ASCII | error: above 7F |
| Latin-1 | é |
| Windows-1252 | é |
| UTF-8 | error: cut-off sequence |
When a message says a byte is above 7F, pick the encoding the data came from in the selector. If you do not know, try UTF-8 first, then Windows-1252. The decoder page at hex code decoder explains how to tell them apart from the symptoms.
Hex to char: converting a single byte or code
Searching for hex to char usually means one value, such as 41 or 0x7E. Enter it with or without the 0x prefix and the output is that one character. A few cases cause confusion. A value above 7F has no ASCII character. A value written with four digits, such as 00E9, is not a byte but a Unicode code point or a 16-bit unit, and it needs a text encoding rather than ASCII. A value like 20 is a space, which looks like an empty result but is a real character.
Hex numbers are also sometimes the character's position in Unicode instead of its byte. U+0041 and byte 41 agree for A because the first 128 Unicode code points are ASCII. They stop agreeing from U+0080: U+00E9 is é, whereas the UTF-8 bytes of é are C3 A9. For numbers rather than characters, see hex to decimal.
Reading ASCII hex without a chart
Most English text can be read from the first digit alone. A first digit of 3 means a decimal digit (30 is 0, 39 is 9). A 4 or a 5 means a capital letter, with 41 for A and 5A for Z. A 6 or a 7 means lower case, 61 to 7A. A 2 is punctuation, led by the space, 20. The second digit then picks the position within the run: in the capital run 41 is the first letter, so 4F is the fifteenth letter, O.
Lower case is upper case plus 20. That makes 68 65 6C 6C 6F easy to read as h, e, l, l, o and 48 45 4C 4C 4F as the same word in capitals. It also explains a common slip: a hex string that decodes to the right letters in the wrong case was typed with the first digit one or two steps off.
ASCII hex in the wild
Hex dumps of files and network traffic are full of short ASCII strings sitting among binary data, and recognizing them is the quickest way to know what a dump is. File formats start with a signature that is partly or fully ASCII text. Protocol messages such as HTTP, SMTP and FTP are ASCII from start to finish.
| First bytes | Format | Reads as |
|---|---|---|
| 25 50 44 46 2D | PDF document | %PDF- |
| 47 49 46 38 39 61 | GIF image | GIF89a |
| 53 51 4C 69 74 65 | SQLite database | SQLite |
| 50 4B 03 04 | ZIP archive | PK, then two control bytes |
| 7F 45 4C 46 | ELF executable | DEL, then ELF |
| 4D 5A | Windows executable | MZ |
A dump that begins 47 45 54 20 is the text GET followed by a space, the start of an HTTP request. One that begins 48 54 54 50 is a response. Anything printed to a serial console, including GPS sentences that start with $GP, is ASCII too, which is why serial logs can often be read straight from the hex column.
Cleaning hex copied from a log or a capture
Hex rarely arrives clean. Wireshark's Copy as Hex Stream gives one unbroken string, while Copy as Hex + ASCII Dump gives the offset column and the printable column along with the bytes, and only the middle part is data. Debuggers print 0x-prefixed values separated by commas. Serial terminals print pairs separated by spaces, sometimes with a line number in front. The converter accepts the first three forms directly; anything else needs a quick trim.
Two signals show that a paste contained more than hex. A message about a character that is not a hex digit points at the first foreign character, and the Show button moves the cursor to it, which is usually the start of an ASCII column or a label. A message about an odd number of digits means one digit was lost or an offset was left in. A dump line such as 00000010: 636f 6e64 contains the offset 00000010 before the colon; removing it first avoids four bytes of invented data at the start of the output.
Hex to ASCII in Python, JavaScript and the shell
bytes.fromhex("48 54 54 50 2F 31 2E 31").decode("ascii") # 'HTTP/1.1'
# raises UnicodeDecodeError for any byte above 7FBuffer.from("485454502F312E31", "hex").toString("ascii") // 'HTTP/1.1'
String.fromCharCode(0x48, 0x54, 0x54, 0x50) // 'HTTP'Node.js's "ascii" decoder does not reject high bytes. It clears the top bit, so E9 comes out as i (69). That is a different result from this converter, which refuses the byte, and it can hide corrupted data. Use "latin1" or "utf8" when the data may contain bytes above 7F.
echo 485454502f312e31 | xxd -r -p # HTTP/1.1
[Text.Encoding]::ASCII.GetString([byte[]](0x48,0x54,0x54,0x50)) # HTTPPowerShell's ASCII decoder replaces any byte above 7F with a question mark and does not report it. The ASCII definition in RFC 20 lists the full code, and the reverse conversion has its own page, ASCII to hex.
Questions about converting hex to ASCII
What is 41 in ASCII?
41 hex is 65 decimal, which is the capital letter A. Lower case a is 61 hex (97 decimal). The two differ by 20 hex, which is 32.
Why does the converter reject some bytes?
ASCII has only 128 values, 00 to 7F. A byte of 80 or more cannot be an ASCII character, so the converter reports it with its position instead of showing a guess. Switch to UTF-8, Latin-1 or Windows-1252 if the data is not pure ASCII.
What do 0A and 0D mean in ASCII hex?
0A is the line feed and 0D is the carriage return. Unix and macOS end a line with 0A, Windows with 0D 0A. They show as line breaks or as nothing in the text output, and the byte table names them.
Is hex to ASCII the same as hex to text?
For bytes below 80 the result is identical. They differ above 7F, where text normally means UTF-8 and can use several bytes for one character, while ASCII rejects the byte.
How do I convert hex to ASCII without a tool?
Split the hex into pairs, convert each pair to decimal (first digit times 16, plus the second), and look the number up in an ASCII table. Digits are 30 to 39, capital letters 41 to 5A and lower case letters 61 to 7A, which covers most readable text.
