Big-Endian vs Little-Endian Bit Ordering Explained
This article explains the difference between big-endian and little-endian bit ordering within a single byte in binary computer systems. While endianness most commonly describes the sequence of multiple bytes in memory, bit-level endianness refers to the specific order in which individual bits within a single byte are stored, indexed, or transmitted sequentially across hardware interfaces and communication protocols.
The Structure of a Byte
A standard byte consists of 8 bits. Numerically, these bits carry different weights based on powers of two, ranging from \(2^0\) (value 1) to \(2^7\) (value 128):
- Most Significant Bit (MSB): The bit with the highest mathematical value (\(2^7\)).
- Least Significant Bit (LSB): The bit with the lowest mathematical value (\(2^0\)).
Bit-level endianness determines whether the MSB or the LSB is processed, numbered, or transmitted first.
Big-Endian Bit Ordering (MSB 0 / MSB First)
In big-endian bit ordering, the most significant bit is positioned or processed first.
- Transmission: When sending a byte across a serial interface, the MSB (\(2^7\)) is sent first, followed by descending significance down to the LSB (\(2^0\)).
- Indexing/Notation: In big-endian bit indexing, bit index 0 is assigned to the most significant bit.
- Example: For the binary value
11000001(decimal 193), a big-endian transmission stream sends1(MSB), then1,0,0,0,0,0, and finally1(LSB).
Protocols like Ethernet and I2C typically use big-endian bit ordering for data transmission.
Little-Endian Bit Ordering (LSB 0 / LSB First)
In little-endian bit ordering, the least significant bit is positioned or processed first.
- Transmission: When streaming a byte over a physical layer, the LSB (\(2^0\)) is sent first, followed by increasing significance up to the MSB (\(2^7\)).
- Indexing/Notation: In little-endian bit indexing, bit index 0 is assigned to the least significant bit, matching the mathematical power of two (\(2^0\)).
- Example: For the binary value
11000001(decimal 193), a little-endian transmission stream sends1(LSB), then0,0,0,0,0,1, and finally1(MSB).
Protocols like RS-232 (UART) and USB typically utilize little-endian bit ordering during transmission.
Key Differences Summary
| Feature | Big-Endian Bit Ordering | Little-Endian Bit Ordering |
|---|---|---|
| First Bit Transmitted | Most Significant Bit (MSB / \(2^7\)) | Least Significant Bit (LSB / \(2^0\)) |
| Bit 0 Assignment | MSB (High-order bit) | LSB (Low-order bit) |
| Common Use Cases | Ethernet, I2C, SPI (configurable) | UART/RS-232, USB, PCIe |
| Human Readability | Matches standard left-to-right writing | Inverted relative to standard notation |
Practical Implications
Within standard CPU registers and memory architecture, bits within a byte are accessed in parallel rather than sequentially, meaning bit endianness is mostly transparent to software execution. However, bit ordering is critical in hardware design, field-programmable gate arrays (FPGAs), bitmasking across different architectures, and serial communications, where mismatched bit-order assumptions will invert or corrupt the data being transferred.