Endianness

In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory (or, sometimes, as sent on a serial connection). Each sub-component in the representation has a unique degree of significance, like the place value of digits in a decimal number. These sub-components are typically 16-, 32- or 64-bit words, 8-bit bytes, or even bits. Endianness is a difference in data representation at the hardware level and may or may not be transparent at higher levels, depending on factors such as the type of high level language used.

The most common cases refer to how bytes are ordered within a single 16-, 32-, or 64-bit word, and endianness is then the same as byte order. The usual contrast is whether the most significant or least significant byte is ordered first—i.e., at the lowest byte address—within the larger data item. A big-endian machine stores the most significant byte first, and a little-endian machine stores the least significant byte first. In these standard forms, the bytes remain ordered by significance. However, mixed forms are also possible where the ordering of bytes within a 16-bit word may differ from the ordering of 16-bit words within a 32-bit word, for instance. Although rare, such cases do exist and may sometimes be referred to as mixed-endian or middle-endian.

Endianness is important as a low-level attribute of a particular data format. For example, the order in which the two bytes of a UCS-2 character are stored in memory is of considerable importance in network programming where two computers with different byte orders may be communicating with each other. Failure to account for a varying endianness across architectures when writing code for mixed platforms leads to failures and bugs that can be difficult to detect.

Endian First byte
(lowest address)
Middle bytes Last byte
(highest address)
Decimal 1000 (hexadecimal 3E8) in two bytes Notes
big most significant ... least significant 03 E8 Similar to a number written on paper (in Hindu-Arabic numerals as used in most Western scripts)
little least significant ... most significant E8 03 Arithmetic calculation order (see carry propagation)

The term endian as derived from end may lead to confusion. Note that it denotes which end (i.e., outermost part) of the number comes first rather than which part comes at the end of the byte sequence (representing the number). See Etymology for an explanation why it refers to the end from which something starts, but not to something coming last.

Read more about Endianness:  Endianness and Hardware, Endianness and Operating Systems On Architectures, Etymology, History, Optimization, Diagram For Mapping Registers To Memory Locations, Examples of Storing The Value 0A0B0C0Dh in Memory, Endianness in Networking, Endianness in Files and Byte Swap, "Bit Endianness", Other Meanings

Other articles related to "endianness":

Endianness - Other Meanings
... Some authors extend the usage of the word "endianness", and of related terms, to entities such as street addresses, date formats and others ... Such usages—basically reducing endianness to a mere synonym of ordering of the parts—are non-standard usage (e.g ... "Endianness" is sometimes used to describe the order of the components of a domain name, e.g ...
Little-endian - Endianness and Hardware - Floating-point and Endianness
... IEEE 754 floating point standard does not specify endianness ... implementing IEEE 754), one may in practice safely assume that the endianness is the same for floating point numbers as for integers, making the conversion straightforward regardless of data type ...
Little-endian - "Bit Endianness"
... The terms bit endianness or bit-level endianness are seldom used when talking about the representation of a stored value, as they are only meaningful for the rare computer architectures where each ... is more descriptive than assigning an endianness to bit ordering ... Bit endianness is also used when referring to certain image formats, particularly bitonal images, which store a series of pixels as individual bits within a byte ...
Htonl - Other Meanings
... Some authors extend the usage of the word "endianness", and of related terms, to entities such as street addresses, date formats and others ... Such usages—basically reducing endianness to a mere synonym of ordering of the parts—are non-standard usage (e.g ... "Endianness" is sometimes used to describe the order of the components of a domain name, e.g ...
ZFS - Features - Adaptive Endianness
... When reading, if the stored endianness does not match the endianness of the system, the metadata is byte-swapped in memory ... and reading data remain responsible for doing so in a way independent of the underlying system's endianness ...