The word comes from Gulliver's Travels (which end of a boiled egg to crack). It's a convention, not a correctness question — both work fine, they just must agree.
The order in which the bytes of a multi-byte value are stored across consecutive memory addresses.
In big-endian, which byte is at the lowest address?
The most significant byte (MSB).
In little-endian, which byte is at the lowest address?
The least significant byte (LSB).
Store 0x12345678 little-endian starting at addr A.
A+0:78, A+1:56, A+2:34, A+3:12.
Store 0x12345678 big-endian starting at addr A.
A+0:12, A+1:34, A+2:56, A+3:78.
Does endianness reverse bits within a byte?
No — only the ordering of whole bytes; bits inside a byte are unchanged.
What is "network byte order"?
Big-endian, the standard used for transmitting multi-byte fields in TCP/IP.
Which endianness do x86 CPUs use?
Little-endian.
Formula for the k-th byte (k=0 is LSB) of value V.
b_k = floor(V / 256^k) mod 256.
Byte stored at offset i, big-endian, N-byte value?
mem[i] = b_{N-1-i}.
Quick runtime test: store int 1, read byte at lowest address; result 1 means?
Little-endian.
Is a char[] string affected by endianness?
No — array elements keep their order; only multi-byte scalars are split by endianness.
Recall Feynman: explain to a 12-year-old
Imagine a big number that's too long to fit in one mailbox, so you split it into chunks and put each chunk in a row of mailboxes. Big-endian puts the biggest chunk in the first mailbox (like writing a number normally, left to right). Little-endian puts the smallest chunk first. The number you get back is the same either way — you just have to know which house's rule you're using, otherwise you'd read the number scrambled. That's it: same number, different chunk-order in the mailboxes.
Endianness ka matlab bas itna hai: jab koi number ek byte se bada hota hai (jaise 4-byte ka integer), toh uske bytes ko memory ke consecutive addresses mein kis order mein rakha jaaye. Number wahi rehta hai, sirf storage order badalta hai — bilkul date likhne jaisa, koi DD/MM likhta hai koi MM/DD, din toh same hi hai.
Do conventions hain. Big-endian mein sabse bada (most significant) byte lowest address pe jaata hai — "big end first", jaise hum number left-to-right likhte hain. Little-endian mein sabse chhota (least significant) byte lowest address pe jaata hai. Yaad rakhne ka trick: "Big end → Beginning". Example: 0x12345678 ko address 100 se store karo — little-endian mein 100:78, 101:56, 102:34, 103:12, aur big-endian mein 100:12, 101:34, 102:56, 103:78.
Ye important kyun hai? Kyunki x86 aur zyadatar ARM chips little-endian hote hain, lekin internet/network par data big-endian ("network byte order") mein bheja jaata hai. Agar do machines alag convention use karti hain aur convert nahi karti, toh number ulta-pulta padha jaayega — 0x12345678 ban jaayega 0x78563412. Isliye programmers htonl/ntohl jaise functions use karte hain.
Ek common galti: log samajhte hain ki endianness bits ko reverse karti hai — nahi! Sirf poore bytes ka order badalta hai, ek byte ke andar ke bits kabhi nahi badalte. Aur single byte ya char[] string par endianness ka koi asar nahi — sirf multi-byte scalar (int, float) par lagti hai. Bas yahi core idea hai, ise clearly samajh lo toh sab clear.