Lably
Skip to content

Endianness

Order of bytes in a computer word

  • 17 min read
  • 5 chapters

Related on Lably

Through Computing, Word (computer architecture) and Data communication

Computers store information in various-sized groups of binary bits. Each group is assigned a number, called its address, that the computer uses to access that data. On most modern computers, the smallest data group with an address is eight bits long, and is called a byte. Larger groups comprise two or more bytes; for example, a word often contains 32 bits or 64 bits.

There are two principal ways a computer could number the individual bytes in a larger group, starting at either end. A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian system, in contrast, stores the least-significant byte at the smallest address. Of the two, big-endian is thus closer to the way the digits of numbers are written left-to-right in English, with the most significant digit first, comparing digits to bytes and assuming addresses increase from left to right.

Both types of endianness are in widespread use in digital electronic engineering. The initial choice of endianness of a new design is often arbitrary, but later technology revisions and updates perpetuate the existing endianness to maintain backward compatibility. Big-endianness is the dominant ordering in networking protocols, such as in the Internet protocol suite, where it is referred to as network order, transmitting the most significant byte first. Conversely, little-endianness is the dominant ordering for processor architectures (x86, most ARM implementations, base RISC-V implementations) and their associated memory. File formats can use either ordering; some formats use a mixture of both or contain an indicator of which ordering is used throughout the file.

Bi-endianness is a feature supported by numerous computer architectures that feature switchable endianness in data fetches and stores or for instruction fetches. Other orderings are generically called middle-endian or mixed-endian.

Origin

Endianness is primarily expressed as big-endian (BE) or little-endian (LE), terms introduced by Danny Cohen in an Internet Experiment Note published in 1980. Cohen borrowed the terms from an absurd episode in the satirical novel Gulliver's Travels by Jonathan Swift. In the imaginary land of Lilliput, scholars are fiercely divided by a never-ending debate over how correctly to break the shell of a boiled egg. Those who insist on breaking the big end of the shell are Big-Endians, while their opponents who break the opposite end of the shell are Little-Endians.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication