Embedded Development Board Learning


 Little Endian And Big Endian

Date: agosto 25, 2025

Author: Guillermo Garcia

Categories: Embedded C programming Tags:

In this article, we will look at the difference between Little Endian and Big Endian and how this impacts embedded systems.

Endianness

The endianness refers to the byte order used by your computer or microcontroller or a machine to read or write a single “machine word” in memory (32-bit machine’s word size is 32-bit and 64-bit machine’s word size is 64-bit ). In other words, The endian will decide how to store multiple bytes in computer memory.

Little Endian

In Little-endian, LSB (Least significant byte) is stored first or to a lower memory address. Intel x86, Pentium are using this Little Endian.

Thus, the little-endian byte order means, when the computer writes a word (Multi Byte) into memory, it begins by writing the Lowest byte to the lowest memory address and continues until it has written the highest byte to the highest memory address. It does this by writing subsequent and ascending memory addresses, no matter the endianness.

Big Endian

In Big Endian, MSB (Most significant byte) is stored first or to a lower memory address. Big-endian is implemented in PowerPC and most networking devices.

The big-endian byte order means, when the computer writes a word (Multi Byte) into memory, it begins by writing the highest byte to the lowest memory address and continues until it has written the lowest byte to the highest memory address.

Example

Consider the number 0x11223344. This number is written with hexadecimal digits (prefix “0x”). Its decimal value is 287454020. It consists of 4 bytes: 0x110x220x33 and 0x44.

In this value LSB is 0x44 and MSB is 0x11.

Now assume that the computer wants to write this number into memory beginning at address 100. This 4-byte value. So it will use the memory address 100, 101, 102, 103.


Big Endian

If the computer uses the Big endian byte order, it begins with the MSB (byte 0x11) and writes it at address 100. Then it writes the next byte 0x22 at address 101, the byte 0x33 at address 102, and at last the MSB (byte 0x44) at the last address 103. This results in the following memory content:

Memory Address	100	101	102	103
Content	        0x11	0x22	0x33	0x44

Little Endian

If the computer uses the Little endian byte order, it begins with the LSB (byte 0x44) and writes it at address 100 and then it goes the word backward until it writes the MSB. So it writes the next byte 0x33 at address 101, then it writes 0x22 at address 102, and at last the MSB 0x11 at address 103. Note again that the computer uses sequential ascending addresses, no matter the endianness. This result is the following memory content:

Memory Address	100	101	102	103
Content	        0x44	0x33	0x22	0x11

Which is better Little Endian and Big Endian ?

  • For modern computers & embedded systems → Little Endian is the practical choice (compatibility with x86, most ARM, better toolchain support).
  • For networking or interoperability → Big Endian is still relevant (all network protocols use big-endian, so conversions are required).
  • Best practice: Be endian-agnostic in your code → use standard APIs (htonl, ntohl, etc. in C) when dealing with network or storage formats.
  • Little Endian → better for CPU efficiency and modern software.
  • Big Endian → better for readability and standard in networking.

CPU Endianness in Embedded Systems

  • Most ARM Cortex-M (STM32, Nordic, NXP, etc.)Little Endian only.
  • Some high-end ARM (Cortex-A, e.g. in smartphones, Raspberry Pi) → Bi-endian (can switch).
  • Older DSPs, PowerPC, MIPS → sometimes Big Endian.


Card image cap
Guillermo Garcia Thanks for reading! I am one of the editors of this site and I am committed to providing you with the best information possible by sharing my experience in embedded systems.


Comments... There are no comments.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Publicidad