.text:00445890; =============== S U B R O U T I N E ===============
.text:00445890
.text:00445890

Reading a hexdump

.text:00445890; author: Can Ozdemir date: 2026-10-13 size: 0xC80 tags: basics, hex, tutorial
.text:00445890
.text:00445890sub_445890procnear
.text:00445891

Every file is just a row of bytes. A hexdump prints them in a form a human can scan. Once you can read one fluently, file formats, network captures and memory dumps stop being opaque. This post walks through one 16-byte example line by line.

.text:00445982

Tip: every page on this site has a Hex View tab (press x) and a Strings tab (press s). Try them on this post as you read.

.text:00445A07

One line of a hexdump

.text:00445A1F

This is a 16-byte file, printed with hexdump -C sample.bin (on Linux, xxd sample.bin or od -A x -t x1z sample.bin show the same thing):

.text:00445AAC
00000000  48 69 21 0a 01 02 ff 00  34 12 00 00 ef be ad de  |Hi!.....4.......|
.text:00445AFA

It has three columns:

.text:00445B0F
  • Offset (00000000): where in the file this line starts, in hex. The next line would start at 00000010, which is 16.
  • Bytes: sixteen bytes, each as two hex digits. One hex digit is 4 bits, so two digits are exactly one byte (0 to 255, written 00 to ff). The extra gap after the eighth byte is only there to help your eyes.
  • ASCII: the same bytes shown as text. Printable characters appear as themselves, everything else as a dot.
.text:00445CD3

Text is just numbers

.text:00445CEA

The first three bytes are 48 69 21. In ASCII, 0x48 is H, 0x69 is i, and 0x21 is !. That's why the ASCII column starts with Hi!. The fourth byte, 0a, is a newline. It isn't printable, so it shows as a dot.

.text:00445DC8

A few values are worth memorising, because you'll see them everywhere:

.text:00445E0E
  • 20 space, 0a newline, 0d carriage return (Windows line endings are 0d 0a)
  • 30 to 39 are the digits 0 to 9
  • 41 to 5a are A to Z, and 61 to 7a are a to z; lower case is upper case plus 0x20
  • 00 is the NUL byte: C strings end with it, and long runs of it are usually padding
.text:00445F47

Numbers wider than one byte

.text:00445F65

Look at bytes 8 to 11: 34 12 00 00. If a program stored a 32-bit integer there, what is its value?

.text:00445FC9

On x86 and most ARM systems, multi-byte numbers are stored little-endian: the least significant byte comes first. To read the number, reverse the bytes: 00 00 12 34, which is 0x1234 = 4660.

.text:0044608E

The last four bytes, ef be ad de, work the same way. Reversed, they read de ad be ef: 0xDEADBEEF, a classic marker value that programmers use precisely because it's easy to spot in a dump.

.text:00446150

Big-endian is the other order: most significant byte first, the way we write numbers. Network protocols use it ("network byte order"), so the same value can appear in both orders within one capture.

.text:00446216

Exercise

.text:00446221

Go back to the line above and answer, without a calculator:

.text:0044625C
  1. Which byte is the NUL that ends the first "string"?
  2. If bytes 4 and 5 (01 02) were a 16-bit little-endian number, what would it be?
  3. Why does ff show as a dot?
.text:00446307

Answers: the 00 at offset 7; 0x0201 = 513; and 0xff is above 0x7e, outside printable ASCII.

.text:0044636A

Tools

.text:00446372
  • xxd file or hexdump -C file: dump a file
  • xxd -l 64 file: only the first 64 bytes
  • xxd -s 0x100 -l 32 file: 32 bytes starting at offset 0x100
  • xxd -r: turn an edited dump back into a binary, a cheap way to patch a byte
.text:0044645E

Next: the ELF header, byte by byte, where this skill pays off immediately.

.text:004464A8
.text:004464A8retn
.text:004464A8sub_445890endp
.text:004464A8; © 2026 Can Ozdemir. All rights reserved. terms
.text:004464A8
.text:004464A9; -------- cross references --------
Output
Loading ozdc.us… 34 functions, 3 data segments.
Type help in the command line below and press Enter.