How to Read a Hex Dump (Offsets, Bytes and ASCII)
By SimpleTools24Published 4 min read
A hex dump shows a file's bytes in three columns. On the left is the offset, the position of the first byte on that line, counted from zero and written in hexadecimal. In the middle are the bytes, usually sixteen per line, each written as two hex digits from 00 to FF. On the right is the ASCII column, which shows each byte as a character if it's printable, or as a dot if it isn't. Once you know those three parts, any hex dump becomes readable.
In this guide
Anatomy of a Hex Dump Line
Here are the first two lines of a small PNG image, as shown by hexdump -C or a hex viewer:
00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR|
00000010 00 00 01 00 00 00 00 c8 08 06 00 00 00 5c 72 a8 |.............\r.|Reading the first line:
00000000is the offset: this line starts at byte 0.89 50 4e 47 0d 0a 1a 0aare the first eight bytes, PNG's signature.00 00 00 0dis a length (13), and49 48 44 52spellsIHDR, the name of PNG's header chunk.|.PNG........IHDR|shows the same sixteen bytes as characters.50 4E 47is "PNG"; the others aren't printable, so they appear as dots.
The second line starts at offset 00000010, which is hexadecimal for 16, because the first line held bytes 0 to 15.
Hexadecimal in Two Minutes
Hexadecimal (base 16) uses the digits 0–9 and A–F, where A=10 and F=15. Two hex digits describe exactly one byte, from 00 (0) to FF (255). That neat fit is why hex is used instead of decimal.
To convert a two-digit hex value to decimal, multiply the first digit by 16 and add the second:
4E= 4 × 16 + 14 = 78C8= 12 × 16 + 8 = 2000D= 0 × 16 + 13 = 13
Each hex digit also maps to four binary digits, so C8 is 1100 1000 = 11001000. If you need to see individual bits, for example in a flags byte, a viewer's binary mode does this for you.
| Hex | Decimal | Meaning in text files |
|---|---|---|
| 00 | 0 | Null byte; common padding in binary files |
| 09 | 9 | Tab |
| 0A | 10 | Line feed (new line on Unix, macOS) |
| 0D | 13 | Carriage return (Windows uses 0D 0A) |
| 20 | 32 | Space |
| 30–39 | 48–57 | Digits 0–9 |
| 41–5A | 65–90 | Capital letters A–Z |
| 61–7A | 97–122 | Lower-case letters a–z |
| FF | 255 | Often fill or "erased" flash memory |
Reading the Offset Column
Offsets are positions, counted from zero. Because they're in hex, 00000100 is byte 256, not byte 100. When a format specification says "the width is stored at byte 16", you look on the line starting 00000010, first column of bytes.
Most viewers let you type an offset to jump to it. A binary file viewer also shows the offset of whichever byte you select, in both hex and decimal, which saves the mental arithmetic.
Multi-Byte Numbers and Endianness
Single bytes only go up to 255, so larger numbers span several bytes. The order of those bytes is called endianness:
- Big-endian: most significant byte first. PNG uses this. In the dump above, the bytes
00 00 01 00at offset 16 are the image width: 256 pixels. - Little-endian: least significant byte first. x86 processors, Windows executables, ZIP files and BMP images use this. The same bytes
00 01 00 00would mean 256 in little-endian.
You can't tell which applies just by looking; the file format defines it. If a number looks absurdly large, try reading the bytes in the other order. The byte inspector in our viewer does this for you: select a byte and it shows the multi-byte values starting there, with a switch between little-endian and big-endian.
What the ASCII Column Is Good For
The ASCII column is your shortcut for spotting structure:
- Format names and markers, like
IHDR,PDF,JFIForftyp. - Embedded text: file names in archives, metadata in images, messages in executables.
- Text files in disguise: if the whole column reads like prose, it's a text file.
It only shows single-byte characters, though. UTF-16 text appears with a dot between letters (H.e.l.l.o.), and UTF-8 accented letters show as two dots. That's normal.
Practising on Your Own Files
The quickest way to get comfortable is to look at files you know:
- Open a small PNG, JPEG and PDF in a hex viewer and compare their first bytes with the signatures in file signatures and magic numbers.
- Open a short text file and find the
0A(or0D 0A) bytes at the end of each line. - Save the same text as UTF-8 and UTF-16 and compare the dumps.
You can do all of this in the online binary viewer, which reads files in your browser and lets you click a byte to see its value in hex, decimal and binary. If you don't have a viewer yet, how to view a binary file covers the built-in options on each operating system.
Frequently Asked Questions
Why do hex dumps show 16 bytes per line?
Sixteen is a convenient power of two, so offsets advance by 10 in hex per line. Some tools let you choose 8 or 32 instead.
What do the dots in the ASCII column mean?
They stand for bytes that aren't printable characters, such as control codes or values above 127.
Is a hex dump the same as the file?
It's a text representation of the file. Every byte is shown, so tools like xxd -r can even convert a dump back into the original file.
How do I find a specific value in a hex dump?
Search for the byte sequence in hex (for example 49 48 44 52) or for its text form if it's readable. Most viewers support both.
Summary
Offset on the left, bytes in the middle, characters on the right. With hex-to-decimal conversion and an awareness of byte order, you can read any hex dump and match it against a format's documentation.
Related tools
Related articles
- How to View a Binary FileSee inside .bin, .dat and unidentified files with hex viewers, built-in commands and a browser-based tool.
- File Signatures and Magic NumbersHow magic numbers identify files regardless of extension, with a reference list of common signatures.
- Binary vs Text FilesHow encodings, line endings and null bytes separate text from binary data, and why tools care.