Endianness
Endianness is the order in which the bytes of a multi-byte value are stored in memory.
Two conventions
A value wider than one byte must be split across memory addresses. Big-endian stores the most significant byte first, at the lowest address; little-endian stores the least significant byte first. Both are internally consistent.
An example
The 32-bit value 0x12345678 in big-endian is laid out as bytes 12 34 56 78, but in little-endian as 78 56 34 12. The number is identical; only its byte layout differs.
Who uses which
Most desktop and server processors, including x86 and most ARM configurations, are little-endian. Network protocols standardize on big-endian, called network byte order, so hosts convert on send and receive.
When it matters
Endianness only becomes visible when bytes cross a boundary: reading a binary file written on another machine, parsing a network packet, or casting a byte buffer to an integer. Within a single program's arithmetic it is invisible.
Handling it safely
Portable code serializes with explicit byte order rather than dumping raw memory. Conversion functions and format specifiers let you declare the intended order so the same file or packet reads correctly everywhere.
v = 0x12345678
print(v.to_bytes(4, 'big').hex()) # 12345678
print(v.to_bytes(4, 'little').hex()) # 78563412