Skip to the tool
Binary Translator Free tools

Endianness: big endian vs little endian

When a number takes more than one byte, the bytes have to be stored in some order. Big endian puts the most significant byte first; little endian puts the least significant byte first. Try it with the bits below.

Updated · Written and checked by Murugan Vellaichamy

Waiting for input
Try:

The short answer

Take the 32-bit number 0x12345678. It is four bytes: 12, 34, 56 and 78, where 12 is the most significant. A big-endian system stores them in that order, 12 34 56 78. A little-endian system stores them the other way round, 78 56 34 12. The number is the same; only the byte order in memory or on the wire differs.

Byte orderAddress +0+1+2+3
Big endian12345678
Little endian78563412

Which systems are big-endian and which are little-endian?

SystemByte orderWhere it’s defined
Internet protocols (network byte order)Big endianRFC 791: the most significant octet of a multi-octet number is sent first
Intel 64 and IA-32 (x86) processorsLittle endianIntel’s developer manual: the bytes of a word are numbered from the least significant byte
WebAssembly memoryLittle endianW3C WebAssembly spec: all values are read and written in little-endian order
JavaScript DataViewBig endian unless you askECMA-262: littleEndian defaults to false

Why does byte order matter?

Byte order only matters when bytes move between systems or are read one at a time: network packets, binary file formats, memory dumps and data passed between programs written in different languages. Read little-endian bytes as if they were big endian and 0x12345678 turns into 0x78563412.

Single bytes are not affected, so plain ASCII and UTF-8 text reads the same everywhere. UTF-16 text is affected, because each character is at least two bytes, which is why it comes in UTF-16 LE and UTF-16 BE versions. The text to binary converter can show both.

Byte order is not bit order

Endianness is about the order of bytes. Inside a byte, the value is the same everywhere: 10101010 is 170. Diagrams differ in how they number the bits: RFC 791 numbers the leftmost, most significant bit as bit 0, while Intel’s manual numbers bits from right to left, starting at the least significant bit. That is a labelling choice and does not change the value.

How to swap byte order

Reverse the bytes. For a 16-bit value swap the two bytes (0x1234 becomes 0x3412); for 32 bits reverse all four. In the tool above, type a value, pick the width and press Swap bytes; the byte table shows both orders at once.

Sources and method

Byte order is shown both ways: big-endian puts the most significant byte first, little-endian the least significant first. All operations use exact whole-number arithmetic masked to the chosen width.

Questions

Is big endian or little endian better?

Neither is better in general. Big endian matches how people write numbers, which makes dumps easy to read; little endian puts the low byte at the lowest address. What matters is that both sides agree.

What is network byte order?

Big endian. Internet protocols send the most significant byte of a multi-byte number first.

Does endianness affect text?

Not ASCII or UTF-8, which are read one byte at a time. UTF-16 and UTF-32 text is affected, so they come in BE and LE forms.

More converters

Copied