What is hex to text conversion?
Hex to text conversion decodes hexadecimal (hex) byte values into readable characters. Each pair of hex digits is one byte, and each byte maps to a character through an encoding table such as ASCII or UTF-8. The hex string 48 65 6C 6C 6F becomes “Hello” because 48 = H, 65 = e, 6C = l, 6C = l and 6F = o.
Hex to text, hex to ASCII, hex to string and hex decoder all name the same operation: turning hex-encoded bytes into the characters they stand for. Only the character encoding differs. ASCII covers 128 characters (codes 0–127). UTF-8 covers every Unicode character with one to four bytes each, and it keeps the ASCII codes unchanged.
Programmers, network analysts and security researchers read hex daily in packet captures, log files, memory dumps and encoded payloads. A hex to text converter turns those raw bytes into readable output without manual calculation. Edit the bytes in the visual, or pick an example.
How hex to text conversion works
To convert hex bytes to text, follow three steps:
- Split the hex string into pairs of two digits. Each pair is one byte. Remove spaces, commas and the 0x prefix first.
- Convert each hex pair to its decimal value. Multiply the first digit by 16 and add the second. For hex 48: 4 × 16 + 8 = 72.
- Look up the decimal value in the character table. Decimal 72 is the letter H in ASCII and UTF-8.
Repeat for every pair. The decoded characters, read from left to right, form the text.
Worked example: decode 48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 21
| Hex | Decimal | Char |
|---|---|---|
| 48 | 72 | H |
| 65 | 101 | e |
| 6C | 108 | l |
| 6C | 108 | l |
| 6F | 111 | o |
| Hex | Decimal | Char |
|---|---|---|
| 2C | 44 | , |
| 20 | 32 | (space) |
| 77 | 119 | w |
| 6F | 111 | o |
| Hex | Decimal | Char |
|---|---|---|
| 72 | 114 | r |
| 6C | 108 | l |
| 64 | 100 | d |
| 21 | 33 | ! |
Result: Hello, world!
Text to hex (reverse conversion)
To convert text to hex, reverse the process: look up each character’s decimal code, then write it as a two-digit hex value. The letter A has decimal code 65, and 65 in hex is 41. A space is decimal 32, hex 20. Type any text below to see its bytes.
Character encoding: ASCII, UTF-8 and Unicode
Three standards decide how hex bytes map to characters. The encoding you choose affects which characters decode correctly.
ASCII (American Standard Code for Information Interchange)
ASCII is a 7-bit encoding that defines 128 characters: 33 control codes (hex 00–1F and 7F), a space (hex 20), the digits 0–9 (hex 30–39), uppercase A–Z (hex 41–5A), lowercase a–z (hex 61–7A) and 32 punctuation marks. It uses one byte per character and covers English text, digits and common symbols.
An uppercase letter and its lowercase twin differ by hex 20 (decimal 32): A is 41 and a is 61. That holds for all 26 letters, because only one bit changes.
UTF-8
UTF-8 is a variable-length encoding that covers every Unicode character. It uses one to four bytes per character:
| First byte (hex) | Total bytes | Character range | Example |
|---|---|---|---|
00–7F | 1 | ASCII (U+0000–U+007F) | 41 = A |
C2–DF | 2 | Latin, Greek, Cyrillic, Arabic (U+0080–U+07FF) | C3 A9 = é |
E0–EF | 3 | CJK, symbols, currency (U+0800–U+FFFF) | E2 82 AC = € |
F0–F4 | 4 | Emoji, rare scripts (U+10000–U+10FFFF) | F0 9F 98 80 = 😀 |
UTF-8 keeps every ASCII code identical, so valid ASCII text is also valid UTF-8. The first byte of a multi-byte sequence tells the decoder how many bytes follow. Most files and web pages use UTF-8. Type a character to see how its code point fills the byte template.
Unicode
Unicode gives every character a unique number called a code point, written U+ followed by hex digits. UTF-8 is the most common way to store code points as bytes. Other formats are UTF-16 (2 or 4 bytes per character) and UTF-32 (4 bytes per character).
| Character | Code point | UTF-8 bytes | Decimal |
|---|---|---|---|
| A | U+0041 | 41 | 65 |
| é | U+00E9 | C3 A9 | 233 |
| € | U+20AC | E2 82 AC | 8,364 |
| 😀 | U+1F600 | F0 9F 98 80 | 128,512 |
Unicode supports over 149,000 characters from more than 160 writing systems, including Latin, Arabic, Chinese, Japanese, Korean, Devanagari and emoji. Compare the storage cost of one character below.
Useful ASCII ranges in hex
Tap a block on the number line to see what lives there.
| Hex range | Decimal | Characters |
|---|---|---|
00–1F | 0–31 | 32 control codes: 0A is line feed (LF), 0D is carriage return (CR), 09 is tab |
20 | 32 | Space |
21–2F | 33–47 | Punctuation: ! " # $ % & ' ( ) * + , - . / |
30–39 | 48–57 | Digits 0–9 |
41–5A | 65–90 | Uppercase letters A–Z |
61–7A | 97–122 | Lowercase letters a–z |
7F | 127 | DEL (delete), the last ASCII code |
Hex to ASCII table
All 128 ASCII codes with their hex value, decimal value and character. Codes 00–1F and 7F are control codes, shown by their standard abbreviations. Hover or tap a cell in the map to read its code.
| Dec | Hex | Char |
|---|---|---|
| 0 | 00 | NUL |
| 1 | 01 | SOH |
| 2 | 02 | STX |
| 3 | 03 | ETX |
| 4 | 04 | EOT |
| 5 | 05 | ENQ |
| 6 | 06 | ACK |
| 7 | 07 | BEL |
| 8 | 08 | BS |
| 9 | 09 | TAB |
| 10 | 0A | LF |
| 11 | 0B | VT |
| 12 | 0C | FF |
| 13 | 0D | CR |
| 14 | 0E | SO |
| 15 | 0F | SI |
| 16 | 10 | DLE |
| 17 | 11 | DC1 |
| 18 | 12 | DC2 |
| 19 | 13 | DC3 |
| 20 | 14 | DC4 |
| 21 | 15 | NAK |
| 22 | 16 | SYN |
| 23 | 17 | ETB |
| 24 | 18 | CAN |
| 25 | 19 | EM |
| 26 | 1A | SUB |
| 27 | 1B | ESC |
| 28 | 1C | FS |
| 29 | 1D | GS |
| 30 | 1E | RS |
| 31 | 1F | US |
| Dec | Hex | Char |
|---|---|---|
| 32 | 20 | space |
| 33 | 21 | ! |
| 34 | 22 | " |
| 35 | 23 | # |
| 36 | 24 | $ |
| 37 | 25 | % |
| 38 | 26 | & |
| 39 | 27 | ' |
| 40 | 28 | ( |
| 41 | 29 | ) |
| 42 | 2A | * |
| 43 | 2B | + |
| 44 | 2C | , |
| 45 | 2D | - |
| 46 | 2E | . |
| 47 | 2F | / |
| 48 | 30 | 0 |
| 49 | 31 | 1 |
| 50 | 32 | 2 |
| 51 | 33 | 3 |
| 52 | 34 | 4 |
| 53 | 35 | 5 |
| 54 | 36 | 6 |
| 55 | 37 | 7 |
| 56 | 38 | 8 |
| 57 | 39 | 9 |
| 58 | 3A | : |
| 59 | 3B | ; |
| 60 | 3C | < |
| 61 | 3D | = |
| 62 | 3E | > |
| 63 | 3F | ? |
| Dec | Hex | Char |
|---|---|---|
| 64 | 40 | @ |
| 65 | 41 | A |
| 66 | 42 | B |
| 67 | 43 | C |
| 68 | 44 | D |
| 69 | 45 | E |
| 70 | 46 | F |
| 71 | 47 | G |
| 72 | 48 | H |
| 73 | 49 | I |
| 74 | 4A | J |
| 75 | 4B | K |
| 76 | 4C | L |
| 77 | 4D | M |
| 78 | 4E | N |
| 79 | 4F | O |
| 80 | 50 | P |
| 81 | 51 | Q |
| 82 | 52 | R |
| 83 | 53 | S |
| 84 | 54 | T |
| 85 | 55 | U |
| 86 | 56 | V |
| 87 | 57 | W |
| 88 | 58 | X |
| 89 | 59 | Y |
| 90 | 5A | Z |
| 91 | 5B | [ |
| 92 | 5C | \ |
| 93 | 5D | ] |
| 94 | 5E | ^ |
| 95 | 5F | _ |
| Dec | Hex | Char |
|---|---|---|
| 96 | 60 | ` |
| 97 | 61 | a |
| 98 | 62 | b |
| 99 | 63 | c |
| 100 | 64 | d |
| 101 | 65 | e |
| 102 | 66 | f |
| 103 | 67 | g |
| 104 | 68 | h |
| 105 | 69 | i |
| 106 | 6A | j |
| 107 | 6B | k |
| 108 | 6C | l |
| 109 | 6D | m |
| 110 | 6E | n |
| 111 | 6F | o |
| 112 | 70 | p |
| 113 | 71 | q |
| 114 | 72 | r |
| 115 | 73 | s |
| 116 | 74 | t |
| 117 | 75 | u |
| 118 | 76 | v |
| 119 | 77 | w |
| 120 | 78 | x |
| 121 | 79 | y |
| 122 | 7A | z |
| 123 | 7B | { |
| 124 | 7C | | |
| 125 | 7D | } |
| 126 | 7E | ~ |
| 127 | 7F | DEL |
When the decoded text looks wrong
Three encoding problems cause garbled output:
- Wrong encoding selected. ASCII mode shows a dot or question mark for any byte above 7F. Switch to UTF-8 to decode accented letters, symbols and emoji.
- Truncated multi-byte sequence. UTF-8 characters above U+007F use 2–4 bytes. Cutting the hex in the middle of a sequence produces the replacement character (�). Paste the complete hex string to fix it.
- Source used a different encoding. Some older systems store text as Latin-1 (ISO 8859-1), Windows-1252 or Shift-JIS. Those bytes decode wrongly as UTF-8. Identify the source encoding and convert to UTF-8 first.
Pick bytes and a decoder below to see each failure.
Hex to text use cases
Hex to text conversion applies in five areas of computing and security:
- Debugging and log analysis. Error logs and system dumps show raw data in hex. Decoding it reveals error messages, file paths and the user input that caused the fault.
- Network packet analysis. Tools such as Wireshark show packet payloads in hex. Converting the payload to text exposes HTTP headers, DNS queries, protocol messages and transmitted data.
- Data recovery and forensics. Recovering deleted files from a disk image means reading raw hex bytes. Decoding them reveals file headers, text fragments and metadata that help rebuild the data.
- Reverse engineering. Disassemblers and hex editors show binary files as hex. Converting selected byte ranges shows embedded strings, error messages and configuration values inside compiled programs.
- Cryptography and security. Encrypted payloads, hashes and digital signatures appear in hex. Converting the surrounding metadata and plaintext parts helps analysts understand the data structure.
Each button below loads a real-looking sample from one of these areas.
Hex to text in programming
Most languages decode hex to text with built-in functions. Pick a language to see the call and its output for your hex string.
Python
import binascii
hex_string = "48656c6c6f20576f726c64"
text = binascii.unhexlify(hex_string).decode('utf-8')
print(text) # Hello WorldPython’s binascii.unhexlify() converts the hex string to bytes, and .decode('utf-8') turns the bytes into a string. For the full guide, see hex to decimal in Python.
JavaScript
const hex = "48656c6c6f20576f726c64";
const bytes = hex.match(/.{2}/g).map(b => parseInt(b, 16));
const text = new TextDecoder().decode(new Uint8Array(bytes));
console.log(text); // Hello WorldSplit the hex string into pairs, parse each pair as a base-16 integer, and pass the byte array to TextDecoder. For the full guide, see hex to decimal in JavaScript.
Java
import java.util.HexFormat;
public class Main {
public static void main(String[] args) {
String hex = "48656c6c6f20576f726c64";
byte[] bytes = HexFormat.of().parseHex(hex);
String text = new String(bytes, java.nio.charset.StandardCharsets.UTF_8);
System.out.println(text); // Hello World
}
}Java 17’s HexFormat parses the hex string into a byte array, and the String constructor with the UTF-8 charset decodes the bytes. For the full guide, see hex to decimal in Java.
Other languages
| Language | Method | Example | Result |
|---|---|---|---|
| C | sscanf and a loop | Parse each pair with sscanf(pair, "%2hhx", &byte) | Byte array, then text |
| Excel | =HEX2DEC() and CHAR() | =CHAR(HEX2DEC("48")) | "H" |
| Bash | xxd -r -p | echo "48656c6c6f" | xxd -r -p | Hello |
| PowerShell | [Convert]::ToByte() | Pairs, then bytes, then [Text.Encoding]::UTF8.GetString() | Hello |
Each language has its own guide on this site: C, Excel and Linux and Bash.
Hex to text conversion tips
Four practices prevent errors and speed up the process:
- Verify the encoding before converting. Check whether the source data uses ASCII, UTF-8, Latin-1 or another encoding. The wrong one produces garbled text.
- Remove delimiters first. Strip spaces, commas, colons, 0x prefixes and \x escapes from the hex string before decoding. The converter above does this for you.
- Check for odd digit counts. A valid hex byte string has an even number of digits. An odd count means a digit is missing, usually at the start or end of a cut-off dump.
- Validate the output. After decoding, scan the text for replacement characters (�) or unexpected symbols. They point to an encoding mismatch or damaged bytes.
Frequently asked questions
How do I convert hex to text?
How do I convert 41 hex to text?
How do I convert 30 hex to text?
What does the hexadecimal FF mean?
What is the ASCII equivalent of the 0D hex code?
What comes after the hexadecimal FF?
What is the difference between hex and binary?
How do I convert hex to decimal?
Can hex values contain spaces?
What does the 0x prefix mean?
How large can a hex number be?
Related tools
- Hex to decimal converter: convert hex to decimal with digit-by-digit steps.
- Decimal to hex converter: convert decimal to hex with the division method.
- Hex to binary converter: convert hex to binary and see each nibble.
- Hex to Base64 converter: encode hex bytes as Base64.
- Hex to decimal table: the full 0–FF reference chart.
- Bulk hex to decimal: convert a list of values at once.