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.
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 order | Address +0 | +1 | +2 | +3 |
|---|---|---|---|---|
| Big endian | 12 | 34 | 56 | 78 |
| Little endian | 78 | 56 | 34 | 12 |
Which systems are big-endian and which are little-endian?
| System | Byte order | Where it’s defined |
|---|---|---|
| Internet protocols (network byte order) | Big endian | RFC 791: the most significant octet of a multi-octet number is sent first |
| Intel 64 and IA-32 (x86) processors | Little endian | Intel’s developer manual: the bytes of a word are numbered from the least significant byte |
| WebAssembly memory | Little endian | W3C WebAssembly spec: all values are read and written in little-endian order |
| JavaScript DataView | Big endian unless you ask | ECMA-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
- RFC 791 (STD 5), Internet Protocol, Appendix B, Data Transmission Order: the most significant octet of a multi-octet number is sent first. Checked 2026-11-25.
- Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1 (253665-084US, June 2024), section 1.3.1: the processors are little-endian. Checked 2026-11-25.
- W3C WebAssembly Core Specification, memory instructions: all values are read and written in little-endian byte order. Checked 2026-11-25.
- ECMA-262, ECMAScript Language Specification, section 25.3.4 (DataView): the littleEndian argument defaults to false, giving big-endian order. Checked 2026-11-25.
- WHATWG Encoding Standard (Living Standard, updated 20 November 2026), section 9 (single-byte encodings, used for Windows-1252) and section 14 (UTF-16LE and UTF-16BE decoders). Checked 2026-11-25.
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.