Keyboard Shortcuts
- Ctrl+K
- Open search
- Esc
- Close search / dialog
- ↑
- Back to top
Bytes and Binary
Why This Matters
Every file on your computer — including executables, images, and documents — is made of bytes. Understanding bytes is the foundation for understanding any binary format, including ELF.
Without understanding bytes, you can't read hex dumps, debug parsers, or reason about file layouts.
A Simple Model
Think of a byte as a small container that holds a number between 0 and 255. That's it. A byte is just a number.
When you see 0x41 in a hex dump, that's the number 65 in decimal. It happens to be the ASCII code for the letter 'A'.
The Actual Detail
A byte is 8 bits. Each bit is either 0 or 1. So a byte can represent 2^8 = 256 different values (0-255).
We write bytes in hexadecimal (base-16) because it's compact: one byte = exactly two hex digits.
| Decimal | Hex | Binary | ASCII |
|---|---|---|---|
| 0 | 0x00 | 00000000 | NUL |
| 65 | 0x41 | 01000001 | A |
| 127 | 0x7f | 01111111 | DEL |
| 255 | 0xff | 11111111 | — |
A Real Example
The ELF magic number starts with these 4 bytes:
7f 45 4c 46
In decimal: 127, 69, 76, 70. In ASCII: . E L F. That's right — the first four bytes literally spell "ELF".
Try It
Click on each byte to see its decimal, hex, and ASCII values:
Check Your Understanding
Without looking back: what decimal value does the hex byte 0x41 represent?
Apply It
Here's a hex dump of 4 bytes. What ASCII text do they spell?
48 65 6c 6c
Connect
You now understand bytes — the building blocks of every binary format. Next, we'll see how bytes are organized into larger structures.
Every ELF header, every section, every symbol table entry — they're all just bytes. The format specification tells us how to interpret them.
Fill in the Blank
Complete the code: A byte has bits, and can represent values from 0 to .