Memory sizes come in powers of 2, but the everyday prefixes kilo, mega and giga mean powers of 10. The binary prefixes remove the ambiguity:
- Ki (kibi) = 2¹⁰ = 1,024
- Mi (mebi) = 2²⁰ = 1,048,576
- Gi (gibi) = 2³⁰ = 1,073,741,824
So 1 KiB is exactly 1024 bytes, 1 MiB is 2²⁰ bytes, and 1 GiB is 2³⁰ bytes.
Why it matters: "64 KB" can mean 64,000 bytes or 65,536 bytes, depending on who wrote it. A disk maker usually means the first, a memory chip the second. KiB always means the second.
On this site, the K, M and G inside memory notation (1K × 8, 64K words) are powers of 2, and byte capacities are given in KiB, MiB and GiB.
Working with them is easy in powers of 2. Write the number as 2ᵃ × prefix and add exponents: 16 KiB = 2⁴ × 2¹⁰ = 2¹⁴ bytes, 512 MiB = 2⁹ × 2²⁰ = 2²⁹ bytes. In a byte-addressable memory, that exponent is the number of address bits.