Powers of two
Computers count in powers of two, people count in powers of ten, and estimates live in the gap between them. Knowing that 2¹⁰ is about a thousand and 2³² is about four billion lets you size key spaces, memory and storage in your head. It also helps you notice when a “1 TB” disk shows up as 931 “GB”.
The table and a converter
Section titled “The table and a converter”The converter takes an amount in any unit and shows the exact number of bytes, plus the same quantity in decimal (SI) and binary (IEC) units. It accepts decimal commas, digit grouping and suffixes such as 2.5k or 3M. The table lists every power from 2⁷ to 2⁵⁰; bold rows are the ones to memorise, and the checkbox hides the rest.
Byte converter
Enter a non-negative number, e.g. 1.5 or 2,5.
- Exact bytes
- —
- In decimal units (SI)
- —
- In binary units (IEC)
- —
| Power | Exact value | Approx. decimal | Binary (IEC) | Decimal (SI) ≈ |
|---|---|---|---|---|
| 27 | 128 | 128 | 128 B | |
| 28 | 256 | 256 | 256 B | |
| 29 | 512 | 512 | 512 B | |
| 210 | 1,024 | 1.02 thousand | 1 KiB | 1.02 KB |
| 211 | 2,048 | 2.05 thousand | 2 KiB | 2.05 KB |
| 212 | 4,096 | 4.1 thousand | 4 KiB | 4.1 KB |
| 213 | 8,192 | 8.19 thousand | 8 KiB | 8.19 KB |
| 214 | 16,384 | 16.4 thousand | 16 KiB | 16.4 KB |
| 215 | 32,768 | 32.8 thousand | 32 KiB | 32.8 KB |
| 216 | 65,536 | 65.5 thousand | 64 KiB | 65.5 KB |
| 217 | 131,072 | 131 thousand | 128 KiB | 131 KB |
| 218 | 262,144 | 262 thousand | 256 KiB | 262 KB |
| 219 | 524,288 | 524 thousand | 512 KiB | 524 KB |
| 220 | 1,048,576 | 1.05 million | 1 MiB | 1.05 MB |
| 221 | 2,097,152 | 2.1 million | 2 MiB | 2.1 MB |
| 222 | 4,194,304 | 4.19 million | 4 MiB | 4.19 MB |
| 223 | 8,388,608 | 8.39 million | 8 MiB | 8.39 MB |
| 224 | 16,777,216 | 16.8 million | 16 MiB | 16.8 MB |
| 225 | 33,554,432 | 33.6 million | 32 MiB | 33.6 MB |
| 226 | 67,108,864 | 67.1 million | 64 MiB | 67.1 MB |
| 227 | 134,217,728 | 134 million | 128 MiB | 134 MB |
| 228 | 268,435,456 | 268 million | 256 MiB | 268 MB |
| 229 | 536,870,912 | 537 million | 512 MiB | 537 MB |
| 230 | 1,073,741,824 | 1.07 billion | 1 GiB | 1.07 GB |
| 231 | 2,147,483,648 | 2.15 billion | 2 GiB | 2.15 GB |
| 232 | 4,294,967,296 | 4.29 billion | 4 GiB | 4.29 GB |
| 233 | 8,589,934,592 | 8.59 billion | 8 GiB | 8.59 GB |
| 234 | 17,179,869,184 | 17.2 billion | 16 GiB | 17.2 GB |
| 235 | 34,359,738,368 | 34.4 billion | 32 GiB | 34.4 GB |
| 236 | 68,719,476,736 | 68.7 billion | 64 GiB | 68.7 GB |
| 237 | 137,438,953,472 | 137 billion | 128 GiB | 137 GB |
| 238 | 274,877,906,944 | 275 billion | 256 GiB | 275 GB |
| 239 | 549,755,813,888 | 550 billion | 512 GiB | 550 GB |
| 240 | 1,099,511,627,776 | 1.1 trillion | 1 TiB | 1.1 TB |
| 241 | 2,199,023,255,552 | 2.2 trillion | 2 TiB | 2.2 TB |
| 242 | 4,398,046,511,104 | 4.4 trillion | 4 TiB | 4.4 TB |
| 243 | 8,796,093,022,208 | 8.8 trillion | 8 TiB | 8.8 TB |
| 244 | 17,592,186,044,416 | 17.6 trillion | 16 TiB | 17.6 TB |
| 245 | 35,184,372,088,832 | 35.2 trillion | 32 TiB | 35.2 TB |
| 246 | 70,368,744,177,664 | 70.4 trillion | 64 TiB | 70.4 TB |
| 247 | 140,737,488,355,328 | 141 trillion | 128 TiB | 141 TB |
| 248 | 281,474,976,710,656 | 281 trillion | 256 TiB | 281 TB |
| 249 | 562,949,953,421,312 | 563 trillion | 512 TiB | 563 TB |
| 250 | 1,125,899,906,842,624 | 1.13 quadrillion | 1 PiB | 1.13 PB |
KiB vs KB
Section titled “KiB vs KB”Two families of prefixes describe bytes, and they are often mixed up:
| Decimal (SI) | Value | Binary (IEC) | Value | Binary is larger by |
|---|---|---|---|---|
| kilobyte, KB | 10³ = 1,000 | kibibyte, KiB | 2¹⁰ = 1,024 | 2.4% |
| megabyte, MB | 10⁶ | mebibyte, MiB | 2²⁰ = 1,048,576 | 4.9% |
| gigabyte, GB | 10⁹ | gibibyte, GiB | 2³⁰ | 7.4% |
| terabyte, TB | 10¹² | tebibyte, TiB | 2⁴⁰ | 10% |
| petabyte, PB | 10¹⁵ | pebibyte, PiB | 2⁵⁰ | 12.6% |
The IEC introduced the binary names in 1999 to end the ambiguity, but both meanings of “GB” are still in use:
- Drive makers, network speeds and most cloud storage prices use decimal units. A “1 TB” drive holds 10¹² bytes, and 1 Gbit/s is 10⁹ bits per second.
- Memory is sized in binary units, even when the label says “GB”: a 16 GB DIMM holds 16 GiB.
- Operating systems differ. Windows reports binary sizes with decimal labels, which is why a 1 TB disk appears as “931 GB”. macOS uses decimal units. Linux tools vary:
ls -lhanddf -hprint powers of 1,024 with bare K, M, G suffixes, whiledf -Hprints powers of 1,000. - Cloud services choose either. Some bill block storage per GiB-month, others per GB-month; check the docs when a 7% difference matters.
Why it matters in a design
Section titled “Why it matters in a design”| Question | Powers of two at work |
|---|---|
| How many IDs fit in a 32-bit or 64-bit integer? | 2³² ≈ 4.3 × 10⁹ runs out at web scale; 2⁶⁴ ≈ 1.8 × 10¹⁹ does not. |
| How long must a short URL key be? | Base62 with 7 characters gives 62⁷ ≈ 3.5 × 10¹² keys (about 2⁴²): plenty for billions of links issued by a counter; with random keys retries grow as the space fills, so the URL shortener moves to 8 characters at tens of billions. |
| Will random IDs collide? | The birthday bound: collisions become likely after about 2^(n/2) random n-bit IDs, so about 4 billion for 64-bit IDs. A random UUID has 122 random bits. |
| How much memory does an index take? | 100 million entries × 64 bytes = 6.4 × 10⁹ bytes ≈ 6 GiB: one large server, not a cluster. |
| How many shards or partitions? | Powers of two split evenly: going from 2ᵏ to 2ᵏ⁺¹ shards splits each shard in two and moves about half of its keys. |
| How big is a page or block? | Memory pages are usually 4 KiB, database pages 8–16 KiB, SSD reads 4 KiB, object-storage multipart parts at least 5 MiB. |
When you estimate, keep units visible all the way through: “10⁸ objects × 1 KB = 10¹¹ bytes = 100 GB”. Writing the exponent makes slips of a factor of 1,000 obvious.
Further reading
Section titled “Further reading”- Power of two — properties and a longer table.
- Binary prefix — history of the KiB/MiB names and how operating systems display sizes.
- Napkin Math — techniques for keeping units and orders of magnitude straight.
Related topics
Section titled “Related topics”- Back-of-the-envelope estimation — where these numbers get used.
- Latency numbers every programmer should know — the time-based companion table.
- Design Pastebin or a URL shortener — sizing a key space in practice.
- Partitioning and sharding — splitting data into a power-of-two number of shards.
Based on The System Design Primer by Donne Martin (CC BY 4.0). Restructured, rewritten and updated; site content is licensed under CC BY 4.0.