Overview
In computing, endianness is the order in which bytes within a multi-byte data word (such as a 32-bit or 64-bit integer) are stored in computer memory or transmitted over a communication medium.
Danny Cohen introduced the terms in 1980, borrowing them from Jonathan Swift’s 1726 novel Gulliver’s Travels, in which two factions feud over whether to crack a boiled egg from the big end or the little end.
Stores the most significant byte (MSB) at the lowest memory address. Mirrors how numbers are written left-to-right in English.
- Standard for Internet protocols (Network Order)
- Used by IBM z/Architecture & legacy Motorola 68k
Stores the least significant byte (LSB) at the lowest memory address. Simplifies low-level arithmetic carry propagation.
- Dominant in modern CPUs (x86, x86-64, ARM, RISC-V)
- Used by FAT filesystems & SMB protocol
Interactive 32-Bit Memory Visualizer
Enter an 8-digit hexadecimal value to see how its four bytes map to ascending memory addresses:
| Ordering | Address +0 | Address +1 | Address +2 | Address +3 |
|---|---|---|---|---|
| Big-Endian | 0A | 0B | 0C | 0D |
| Little-Endian | 0D | 0C | 0B | 0A |
Key Concepts & Variants
- Bi-endianness: Architectures like ARM, Power ISA, MIPS, and RISC-V can switch endianness via hardware or software settings.
- Middle-endian (Mixed-endian): Legacy systems like the PDP-11 stored 32-bit values as two little-endian 16-bit words arranged in big-endian order (
0B 0A 0D 0C). - Byte Swapping: Software converts between formats using functions like POSIX
htonl()/ntohl()or C++23std::byteswap, often backed by native CPU instructions (BSWAPon x86,REVon ARM). - File Signatures: Formats like UTF-32 use a Byte Order Mark (
00 00 FE FFvs.FF FE 00 00) and TIFF headers start withMM(Motorola/BE) orII(Intel/LE) to signal byte order.
Summarized from Wikipedia: Endianness (CC BY-SA 4.0).