Skip to content

endianness (byte order)

Endianness, also called byte order, is the order in which a computer stores or transmits the individual bytes of a multi-byte value, such as an integer.

The ordering is a property of the processor architecture, and two conventions dominate:

  • Big-endian: Stores the most significant byte at the lowest memory address, so the bytes read in the same order a person writes the number. It is also the standard order for network traffic.
  • Little-endian: Stores the least significant byte at the lowest address, reversing that layout. It runs on the x86 and x86-64 families and on most ARM and RISC-V processors.

For example, the four-byte signed integer 0x0A0B0C0D is stored as the sequence 0A 0B 0C 0D on a big-endian machine and reversed as 0D 0C 0B 0A on a little-endian one. A single byte has no byte order.

Type any multi-byte value below to watch the same bytes settle into memory addresses under each convention:

Interactive diagram — enable JavaScript to view.

Within one machine the ordering stays invisible, because every component agrees on it. Endianness surfaces only when raw bytes cross between systems, where a binary file or network packet written by one machine can be misread by another that assumes the opposite order.

To sidestep the ambiguity, internet protocols fix a single big-endian layout, called network byte order, and Unicode text can prepend a byte order mark to record the order of a UTF-16 or UTF-32 text encoding.

The names come from Jonathan Swift’s Gulliver’s Travels, which describes a dispute over which end of a boiled egg to crack. Danny Cohen borrowed the metaphor for his 1980 note On Holy Wars and a Plea for Peace to argue that neither ordering is better than the other. Python reports the running machine’s order through sys.byteorder and lets a program pick one explicitly when converting an int to or from a bytes object.

Bytes Objects: Handling Binary Data in Python

Tutorial

Bytes Objects: Handling Binary Data in Python

In this tutorial, you'll learn about Python's bytes objects, which help you process low-level binary data. You'll explore how to create and manipulate byte sequences in Python and how to convert between bytes and strings. Additionally, you'll practice this knowledge by coding a few fun examples.

intermediate python

For additional information on related topics, take a look at the following resources:


By Martin Breuss • Updated July 24, 2026