Hex to Text
Turn hex byte values back into readable characters.
Open almost any file in a hex editor and the first line looks like noise — 89 50 4E 47, say. It is not noise. Those four bytes are a signature, and once you know how to read hex as text, a file’s format announces itself before you have opened a single menu.
Two hex digits, one byte, one character
Text stored as hex is just a sequence of byte values written two digits at a time, each pair covering the full 00-FF range a byte can hold. Convert 41 and you get decimal 65, which is the letter A in ASCII. Convert 6C and you get 108, the letter l.
String enough of those pairs together and you get a word: 48 65 6C 6C 6F converts to H, e, l, l, o — ‘Hello’. The conversion is purely a lookup, byte value to character, repeated for every pair.
Reading a file by its first few bytes
Most file formats start with a fixed sequence called a magic number, chosen specifically so software (and people) can identify the format before parsing the rest of the file. A PNG image always opens with the hex bytes 89 50 4E 47. Converted to text, 50 4E 47 spells PNG.
A PDF document opens with 25 50 44 46, which converts to %PDF — the literal characters at the start of every PDF file, version number following right after. A ZIP archive opens 50 4B 03 04, and 50 4B converts to the letters PK, a nod to Phil Katz, who created the ZIP format.
Common file signatures in hex
| Format | First hex bytes | Reads as |
|---|---|---|
| PNG image | 89 50 4E 47 | •PNG |
| PDF document | 25 50 44 46 | |
| ZIP archive | 50 4B 03 04 | PK.. |
| GIF image | 47 49 46 38 | GIF8 |
| JPEG image | FF D8 FF | not printable text |
Why hex is the standard notation for a dump
- A byte ranges from 0 to 255, and two hex digits cover that entire range with no wasted space.
- Every byte lines up in exactly the same column width, which keeps a dump readable across thousands of lines.
- Hex maps cleanly onto binary in groups of four bits, so a byte is always exactly two digits — nothing awkward like octal’s three-digit, uneven range.
- Hex editors and debuggers standardised on it decades ago, so it is the format every tool in the chain already expects.
Hex to text questions
Why does converting hex to text sometimes produce garbled symbols?
Not every byte value corresponds to a printable character. Values outside the normal letters-and-punctuation range, or a byte sequence that belongs to a multi-byte encoding like UTF-8, will show as control codes or replacement symbols instead of readable text.
What is a magic number in a file?
A short, fixed sequence of bytes at the very start of a file that identifies its format. Operating systems and libraries check it instead of trusting the file extension, which is why renaming a .png to .txt does not actually change what it is.
Do all text files start with a recognisable signature?
No. Plain text files have no required header, so a hex to text converter applied to one just produces the readable content directly, without any format-identifying prefix.
Can hex to text handle spaces and punctuation?
Yes. Every printable ASCII character, including spaces, digits and punctuation, has its own byte value and converts the same way letters do.
Is this the same as decoding Base64?
No, they are different encodings entirely. Hex represents each byte as two characters from 0-9 and A-F; Base64 represents groups of three bytes as four characters from a 64-symbol alphabet, and produces shorter output for the same data.