Skip to the workspace
Pebellslearn by building
Binary, Hex and Endianness  ›  Lesson

Big Endian — Most Significant Byte First

Big Endian 12 minA big-endian machine or format stores a multi-byte number with its most significant byte at the lowest memory address, the same order we write digits.

computer science / Big Endian — Most Significant Byte First

Explore each scene at your own pace.

01 · The rule

The rule

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   78

Read 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.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.