# A quick note about little-endianness

23 May 2024

**Little-endian** means the least-significant byte is at the smallest address (on the left).

The least-significant byte is the byte that changes the value the least, and is in binary notation on the right:

```
(binary notation)
least-significant byte
│
┌──┴───┐
0b0100110110011101
```

The individual 8 bits that make up the byte are still in the same order. Endianness only is about the order of the *bytes*.

So, given the following 2 bytes:

```
(hexadecimal notation)
0xABCD
```

This would be stored in memory in little-endian as:

```
(little-endian)
Address: | 0x00 | 0x01
-------------------------
Value: | 0xCD | 0xAB
```

## Hexadecimal notation #

One byte can store `2^8 = 256`

numbers.

Hexadecimal (`0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F`

) can store `16`

numbers.

So two hexadecimal numbers (e.g. `AB`

) can store `16 * 16 = 256`

numbers, and thus one byte.

Because of this, hexadecimal notation is often used for bytes.

The prefix `0x`

indicates hexadecimal notation, e.g. `0xAB`

.