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.