Big Endian — Most Significant Byte First
The number 0x12345678 needs four bytes. Memory hands out one byte per address, so the four bytes must go into four addresses, one after another. Which byte goes first? There is no law of nature here, only two conventions. The first one, big endian, is the one that matches how we write numbers.
The rule
Big endian: the big end, the most significant byte, goes first.
The most significant byte is the one worth the most: the leftmost pair of hex digits. In 0x12345678 it is 12; the least significant byte is 78.
A big-endian layout stores the most significant byte at the lowest address and works rightwards:
address: 100 101 102 103
byte: 12 34 56 78Read the addresses in order and you read the number exactly as written. That makes big-endian data easy to read in a hex dump.
Where you meet it:
- Network byte order. Internet protocols such as IP, TCP and UDP send multi-byte numbers (ports, lengths, addresses) big end first, so every machine agrees on their meaning.
- Many file formats, such as PNG image headers and Java's class files.
- Some older processors, and some that can switch between orders.
Endianness only affects values bigger than one byte. A single byte, or a string of single-byte characters like ASCII text, looks the same either way.
The shortcut
Write the number in hex, split it into byte pairs from the left, and lay the pairs out in that order from the lowest address up. No reversing needed.
Split into bytes
0xCAFE is two bytes: CA and FE.
The trap: splitting into single hex digits instead of pairs. Endianness moves whole bytes, never half-bytes.
Drills
Answer fast — trust the rule.
In big endian, which byte of 0xDEADBEEF is stored at the lowest address?
The 16-bit value 0x0A0B is stored big endian at addresses 300 and 301. What is at 301?
Which order do internet protocols like TCP use for multi-byte numbers?
Which of these does endianness never change?
Remember
- Big endian stores the most significant byte at the lowest address.
- Lay the byte pairs out in written order; it matches a hex dump.
- The trap: endianness moves whole bytes, and only matters for values wider than one byte.
