Skip to content
Tactiverge

Computer architecture

Endianness

Also called: little-endian · big-endian · byte order · network byte order

Definition

Endianness is the order in which the bytes of a multi-byte value are stored in memory or sent over a link: little-endian puts the least significant byte first, big-endian the most significant.

Picture it

0x12345678 stored little-endian appears in memory as 78 56 34 12. It only matters when bytes cross a boundary: reading a sensor over I2C, parsing a binary file or sending data between machines. Get it wrong and 1 becomes 16777216.

The maths

little-endian bytes of 0xAABBCCDD: DD CC BB AA
big-endian: AA BB CC DD
SI units used in this entry
QuantityUnitSymbol
informationbyte (8 bits)B

Worked example

A sensor sends the 16-bit reading 0x01F4 as two bytes, high byte first: 0x01 then 0xF4. What is the value? What would a little-endian reader wrongly get?

  1. Big-endian: 0x01F4 = 500
  2. Little-endian read: 0xF401 = 62465

Answer500 correctly; 62465 if the byte order is swapped.

✓ The 2 numbers in this answer are recomputed from scratch by an automated test.

Common misconceptions

  • Misconception: Endianness affects byte order, not the order of bits inside a byte.
  • Misconception: Text strings are not affected; they are already sequences of single bytes.