Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
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.

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.

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.

Storing 0xCAFE at address 200, big endianStep 1 of 4
  1. 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.

quick drill

In big endian, which byte of 0xDEADBEEF is stored at the lowest address?

quick drill

The 16-bit value 0x0A0B is stored big endian at addresses 300 and 301. What is at 301?

quick drill

Which order do internet protocols like TCP use for multi-byte numbers?

quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainLaying out a number, big end first

Show how the 32-bit number 0x0A0B0C0D is stored at addresses 100 to 103 in big-endian order. Explain what 'most significant byte' means and why network protocols are said to use big-endian 'network byte order'.