In computing, endianness is the order in which bytes within a word data type are transmitted over a data communication medium or addressed in computer memory, counting only byte significance. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). 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.
Characteristics Computer memory consists of a sequence of storage cells (smallest addressable units); in machines that support byte addressing, those units are called bytes. Each byte is identified and accessed in hardware and software by its memory address. If the total number of bytes in memory is n, then addresses are enumerated from 0 to n − 1. Computer programs often use data structures or fields that may consist of more data than can be stored in one byte. In the context of this article, where its type cannot be arbitrarily complicated, a field consists of a consecutive sequence of bytes and represents a simple data value which, at least potentially, can be manipulated by one single hardware instruction. On most systems, the address of a multi-byte simple data value is the address of its first byte (the byte with the lowest address). There are exceptions to this rule – for example, the Add instruction of the IBM 1401 addresses variable-length fields at their low-order (highest-addressed) position with their lengths being defined by a word mark set at their high-order (lowest-addressed) position. When an operation such as addition is performed, the processor begins at the low-order positions at the high addresses of the two fields and works its way down to the high-order. Another important attribute of a byte being part of a field is its significance. These attributes of the parts of a field play an important role in the sequence the bytes are accessed by the computer hardware, more precisely: by the low-level algorithms contributing to the results of a computer instruction.
Numbers Positional number systems (mostly base 2, or less often base 10) are the predominant way of representing and particularly of manipulating integer data by computers. In pure form, this is valid for moderately sized non-negative integers, e.g., of C data type unsigned. In such a number system, the value of a digit that contributes to the whole number is determined not only by its value as a single digit, but also by the position it holds in the complete number, called its significance. These positions can be mapped to memory mainly in two ways:
Decreasing numeric significance with increasing memory addresses, known as big-endian and Increasing numeric significance with increasing memory addresses, known as little-endian. In big-endian and little-endian, the end is the extremity where the big or little significance is written in the location indexed by the lowest memory address.
Text When character (text) strings are to be compared with one another, e.g., in order to support some mechanism like sorting, this is very frequently done lexicographically, where a single positional element (character) also has a positional value. Lexicographical comparison means almost everywhere: first character ranks highest, as in the telephone book. Almost all machines that can do this using a single instruction are big-endian or at least mixed-endian. Integer numbers written as text are always represented most significant digit first in memory, which is similar to big-endian, independently of text direction.
Byte addressing
… excerpt ends here. Continue reading the full article.


