Memory Sizes & Binary Prefixes
Memory Sizes & Binary Prefixes
This page explains how memory sizes are measured, why binary prefixes exist, and how to calculate with them.
Bytes and addressing
The basic unit of memory in computers is the byte (8 bits). Each byte has its own address, independent of the CPU word size. Larger values are built by grouping multiple bytes.
Decimal vs binary multiples
In everyday life, kilo means 1000, mega means 1 000 000, and so on. In computing, powers of 2 are more natural.
- 1000₁₀ = 3E8₁₆ = 1111101000₂, not a round binary number.
- 1024 = 2¹⁰ is a neat binary round number.
For this reason, memory sizes traditionally used powers of 2.
Binary prefixes
To distinguish decimal and binary multiples, binary prefixes were standardized.
Name | Prefix | Value
---- | ------ | -----
kibi | Ki | 2¹⁰ = 1 024
mebi | Mi | 2²⁰ = 1 048 576
gibi | Gi | 2³⁰ = 1 073 741 824
tebi | Ti | 2⁴⁰ = 1 099 511 627 776
pebi | Pi | 2⁵⁰ = 1 125 899 906 842 624
Real world example
Hard disk manufacturers advertise decimal units. Example: 8 TB = 8 000 000 000 000 bytes. In binary terms: 8 000 000 000 000 ÷ 2⁴⁰ = 7.27 TiB.
The operating system will therefore show about 7.27 TiB for an 8 TB drive. This discrepancy often confuses users.
Practical calculations
- 1 KiB = 1024 B
- 1 MiB = 1024 KiB = 1 048 576 B
- 1 GiB = 1024 MiB = 1 073 741 824 B
- 1 TiB = 1024 GiB = 1 099 511 627 776 B
Example: How many bytes are in 4 GiB? 4 × 1 073 741 824 = 4 294 967 296 bytes.
Why it matters
- Correct interpretation of memory sizes is crucial in systems programming.
- Binary multiples dominate in RAM and CPU cache sizes.
- Storage vendors often prefer decimal units for marketing reasons.
- Operating systems may display either convention, so knowing both is necessary.