Skip to main content

Big Endian vs Little Endian

· 2 min read
Strider

What is Big Endian and Little Endian. Here in this post I explain what it is and where the two differ.

Endian is nothing else than to say "what is the beginning and where is the end".

Both are orders how the single bytes are arranged. Small sketch in addition:

convert.png

You have to think of Big Endian as writing a date day.month.year.

And with Little Endian when you write the time hours.minutes.seconds.

In Big Endian the MSB (Most Significant Byte) is at the end and the LSB (Least Significant Byte) is at the beginning.

LSBLSB+1MSB-1MSB
10203040

With Little Endian, it's the other way around.

MSBMSB-1LSB+1LSB
40302010

With both it is to be considered however that the individual bytes are not gedrecht. only the arrangement of the bytes. With both is with each byte, the

MSB (Most Significant Bit) at the beginning and at the end the LSB (Least Significant Bit).

Normally one can say that it does not matter which of the two endians a computer system uses. As long as it is consistent.

But what if we have 2 different computer systems. One with little-endian and one with big-endian. Both should communicate with each other.

Then we have a problem here because if the Big Endian system sends something to the Little Endian system it arrives upside down at the Little Endian system. Here we have to covert to Little-Endian so that the Little Endian system understands what the Big Endian system has sent. The same applies vice versa.

E.g. in the network technology it can happen that different endian systems are present.

Here is then worked in Big-Endian as one also beautifully says in the "Network-order" both systems have a standardization contain which exactly makes possible e.g. in C with the htons.

I hope I could bring a little light in the dark 🙂