
Jonathan Swift’s satirical novel Gulliver’s Travels describes a political rift in the kingdom of Lilliput. The two factions are based on which end of an egg to split open first: the big end or the little end. The argument escalates until the point where the Bid-Endians are declared rebels and by the dominating Little-Endians. These descriptions found their way into the computer realm to settle another silly argument.
In 1980, computer scientist Danny Cohen wrote a memorandum describing one of the vintage “holy war” arguments in computing: How to store a multibyte integer digitally. Should the byte order start at the top of memory or the bottom? The top is the little-endian, the bottom is the big-endian. The approach describes the “endianness” of a stored value.
Consider the value 0x1234. The value is represented by two bytes in storage. One byte stores the 0x12 have of the 16-bit value and the other stores 0x34. Together they build the full 16-bit value 0x1234. The order in which the bytes are stored in memory determines their endianness.
If the bytes are arranged in memory as 0x34 at the lowest address followed by 0x12 at next address, they are little-endian. So as single-byte values, a program reads 0x34 first and then 0x12. But as a 16-bit value, the computer understands its endianness and reads it as 0x1234.
If the bytes are arranged in memory as 0x12 at the lowest address followed by 0x34, they are big-endian. The ending value is “on top.”
Consider a larger value, say 32-bits. In the little-endian format, the value 0x11223344 is stored in memory as 0x44, 0x33, 0x22, 0x11. The value 0x44 occupies the lowest byte address in memory, with other values stored in subsequent bytes. This is the format used by the Intel and AMD processors used in PCs.
These details are worked out at the processor level. Your code need not concern itself with how the values are stored, big-endian or little-endian, as the translation is made for you. However, when you want to do bit twiddling on raw memory, knowing the order is important. If you’re curious, you can run the following program to confirm the system’s endianness:
2026_12_05-Lesson.c
#include <stdio.h>
int main()
{
union {
int a;
char alpha[4];
} example;
int x;
example.a = 0x41424344;
printf("The value %X is stored as ",example.a);
for( x=0; x<4; x++ )
putchar(example.alpha[x]);
putchar('\n');
return 0;
}
The union example stores both an integer and a 4-byte character array in the same memory. The value 0x41424344 is stored in int variable example.a. Then the contents of char array example.alpha[] are output, revealing how the bytes are stored in memory:
The value 41424344 is stored as DCBA
The first byte stored is 0x44, uppercase letter ‘D’. The remainder of the value is stored in little-endian order.
The order is further shown by debugging the program. Here is the output from the GNU debugger (gdb) when the memory at example.a is dumped:
(gdb) x/4xb &example.a
0x7fffffffdee8: 0x44 0x43 0x42 0x41
Again, you see the little-endian order.
Back when I code on 8-bit computers, the endianness was referred to as MSB/LSB, Most Significant Byte and Least Significant Byte. The byte order on those systems was most significant byte (MSB) then the least significant byte (LSB). These terms are still used today, though in the 8-bit world with a 16-bit address, there was only one MSB and LSB per value. Today, MSB and LSB refer to first and last bytes of any value stored in memory. For the value 0x41424344, the MSB is 0x41 as it’s stored in the highest memory address in little-endian format; the LSB is 0x44 as it’s stored in the lowest memory address.
I thought LSB was least significant bit so after very minimal and inadequate research it seems LSB is “least significant byte” and LSb is “least significant bit”.
Thank you for this historical overview! I knew that Jonathan Swiftʼs Gulliverʼs Travels was important to this discussion, but not who introduced these terms into computing.
In any case, the relationship between BE (“Big-endian”) and LE (“Little-endian”) has clearly shifted in favor of LE in the last few decades. While classic mainframes were almost exclusively BE, only IBM Z mainframes (referred to as s390 in the Linux world) and certain microcontrollers still use BE (of course there are also architectures that can be classified als Bi-endian). A good thing too in my opinion, even though the “network byte order”, for example, is of course BE… and always will be.
Although it is easier for humans to read BE values from memory, I think itʼs fair to say that LE comes with two distinct advantages:
1. The address of the LSB (least-significant byte) of a number remains the same regardless of its word length, i.e. when converting a 32-bit value to a 64-bit one, only the upper 32 bits of the register in question need to be set to zero, all the bytes of the lower 32 bits stay in place.
Then there is also the question of the bit order in a byte. Although the LSb (“least-significant bit”) always has the value 1 and the MSb (“most-significant bit”) always has the value 128 in an 8-bit byte, the question of which bit is bit 0 and which bit is 7 remains:
i. LSb 0 bit numbering: bit 0 denotes the LSb, bit 7 the MSb.
ii. MSb 0 bit numbering: bit 0 denotes the MSb, bit 7 the LSb.
There a similar development has taken place as well, however. Only IBM z17 and Power PC still use MSb 0 bit numbering it seems, all other architectures (including microcontrollers) prefer LSb 0 bit numbering instead.
2. Thatʼs because (Little Endian with) LSb 0 bit numbering has an advantage in that the specific byte and bit position of a (logical) bit n can be calculated quite nicely as follows:
Bit weight(n) / positional value = 2ⁿ
Byte offset(n) = n / 8
Bit position(n) = n % 8
… by comparison, with Big Endian (and MSb 0 bit numbering) these calculations are also dependent on the word length:
Bit weight(n) / positional value = 2ⁿ
Byte offset(n) =
sizeof(n)– 1 – (n / 8)Bit position(n) = 7 – (n % 8)
(With Big Endian, the disadvantage that the formula for the byte offset must take word length into account remains even when they—like Motorola 68000 or SPARC—come with LSb 0 bit numbering.)
The LSB/MSB thing was hammered into me when I first studied Assembly for the Z80. It eventually made sense as the value is read bottom-up. But it still takes some brain juice because of the way we read.
Interesting tidbit: Since I was young, I’ve always written values from 13 through 19 right-to-left. So I write 3 and then 1 for 13. That’s because in English we say “Thir-teen.” So the endian thing isn’t so weird if I think of it that way.
M: Great info! It didn’t occur to me that networking uses Big Endian, but that completely make sense. The other argument you present is also logical, especially when converting data types. Thank you!
Interesting point regarding the fact that with numbers under one hundred, the ones digit is pronounced before the tens digit. As English and German are both derived from Proto-West Germanic itʼs the same in my native language, German, as well, 13 = drei-zehn, 19 = neun-zehn.
For me it was also assembly language programming, where I learned to read LE/BE values without having to think about it too much. Sure, converting hexadecimal to decimal values usually requires a calculator, but reading Little endian values themselves comes quite naturally after a while.