big-endian and little-endian

What is big-endian and little-endian?

The term endianness describes the order in which computer memory stores a sequence of bytes. Endianness can be either big or small, and the adjectives refer to the value stored first.

Big-endian is an order in which the big end -- the most significant value in the sequence -- is first, at the lowest storage address. Little-endian is an order in which the little end, the least significant value in the sequence, is first.

The case for big-endian

A big-endian computer would store the two bytes required for the hexadecimal number 4F52 as 4F52 in storage. For example, if 4F is stored at storage address 1000, 52 will be at address 1001. A little-endian system would store them as 524F, with 52 at address 1000 and 4F at 1001.

For people who use languages that read left-to-right, big-endian seems like the natural way to think of storing a string of characters or numbers -- in the same order people expect to see it presented to them. In this way, many people consider big-endian as storing something in a forward fashion, just as they read.

The case for little-endian

An argument for little-endian order is that as the numeric value increases, additional digits might need to be added to the left. For example, a higher nonexponential number has more digits, so an addition of two numbers often requires moving all the digits of a big-endian ordered number in storage. This addition moves everything to the right.

In a number stored in little-endian fashion, the least significant bytes can stay where they are and new digits are added to the right at a higher address. This means some computer operations might be simpler and faster to perform.

Bit order

Within both big-endian and little-endian byte orders, the bits within each byte are big-endian. This means the bit stream represented by a given number of stored bytes doesn't attempt to be big- or little-endian. For example, whether hexadecimal 4F is put in storage first or last with other bytes in a given storage address range, the bit order within the byte will be 01001111.

It's possible to be big-endian or little-endian about the bit order. But central processing units (CPUs) and programs are almost always designed for a big-endian bit order. In data transmission, however, it's possible to have either bit order.

Experts observe that internet domain name addresses and email addresses are little-endian. For example, a big-endian version of our domain name address would be com.techtarget.www.

Uses of big-endian and little-endian

Both big-endian and little-endian are widely used in digital electronics. The CPU typically determines the endianness in use.

For example, IBM's 370 mainframes, most computers based on reduced instruction set computers (RISC) and Motorola microprocessors use the big-endian approach. TCP/IP also uses the big-endian approach. For this reason, big-endian is sometimes called network order.

On the other hand, Intel processors, DEC Alphas and at least some programs that run on them are little-endian.

Mixed forms of endianness are also possible. For example, Virtual Address eXtension floating point uses mixed-endian, also referred to as middle-endian. The order of bytes in a 16-bit word differs from the order of 16-bit words within a 32-bit word. Mixed-endian processors can operate in either little-endian or big-endian mode, and switch between the two.

Language compilers, such as Java or Fortran, have to know which way the object code they develop is going to be stored. Converters can change one kind of endian to the other when necessary.

History of endianness

In 1980, computer scientist Danny Cohen applied the terms big-endian and little-endian to digital electronics in his article "On Holy Wars and a Plea for Peace."

Big-endian and little-endian derive from Jonathan Swift's Gulliver's Travels, in which the Big Endians were a political faction that broke their eggs at the large end, or "the primitive way." They rebelled against the Lilliputian King, who required his subjects, the Little Endians, to break their eggs at the small end.

While many mainframe computers are big-endian, most modern computers are little-endian. Endianness is initially an arbitrary decision by the semiconductor vendor that can have a long-term effect on a line of products.

When vendors update their technology, they keep the existing endianness to help maintain backward compatibility. For example, the designers of the Motorola 68000 and the Intel 8086 -- the predecessor of the x86 family -- chose their endianness in the 1970s and continue to use their respective endianness today.

Editor's note: This article was reformatted to improve the reader experience.

This was last updated in December 2023

Continue Reading About big-endian and little-endian

Dig Deeper on Network infrastructure

Unified Communications
Mobile Computing
Data Center