KB vs KiB: Why Your Disk Shows Less Space
The complete explanation of SI vs IEC data units, the 'missing' disk space problem, and how different systems report file sizes.
The Missing Disk Space Problem
You buy a 1 TB hard drive, plug it in, and your operating system reports 931 GB of available space. Where did the other 69 GB go? Is the manufacturer cheating? Not exactly. The gap is caused by two legitimate but incompatible definitions of what "kilo," "mega," "giga," and "tera" mean when applied to bytes. Understanding this distinction is essential for any developer who works with storage, networking, or data engineering.
Two Systems, One Set of Prefixes
The problem dates back to the earliest days of computing. In the metric system (SI), "kilo" means exactly 1,000. But memory chips are addressed using binary, and the nearest power of 2 to 1,000 is 1,024 (210). Early computer scientists co-opted the metric prefixes to mean powers of 1,024, creating a persistent ambiguity.
To resolve this, the International Electrotechnical Commission (IEC) introduced new prefixes in 1998 specifically for binary multiples: kibi (KiB), mebi (MiB), gibi (GiB), and tebi (TiB). The idea was simple: SI prefixes (KB, MB, GB) would strictly mean powers of 1,000, and IEC prefixes (KiB, MiB, GiB) would mean powers of 1,024.
SI vs IEC Comparison
| SI (Decimal) | Value | IEC (Binary) | Value |
|---|---|---|---|
| 1 KB | 1,000 B | 1 KiB | 1,024 B |
| 1 MB | 1,000,000 B | 1 MiB | 1,048,576 B |
| 1 GB | 1,000,000,000 B | 1 GiB | 1,073,741,824 B |
| 1 TB | 10^12 B | 1 TiB | 2^40 B |
| 1 PB | 10^15 B | 1 PiB | 2^50 B |
The difference is 2.4% at the kilo level but compounds to 9.95% at the tera level.
Why the Difference Matters
At the kilobyte level, the 2.4% difference between 1,000 and 1,024 is negligible. But the gap compounds with each tier because each tier multiplies by a different factor (1,000 vs 1,024). By the terabyte tier:
- 1 TB (SI) = 1,000,000,000,000 bytes
- 1 TiB (IEC) = 1,099,511,627,776 bytes
- Difference: 9.95%
This means a 1 TB drive (1,000,000,000,000 bytes) contains only 0.909 TiB, which most operating systems round to 931 GiB. The "missing" 69 GB was never there; it is a consequence of two different definitions of the same prefix.
Who Uses Which System?
SI (Powers of 1,000)
- Hard drive and SSD manufacturers: All storage vendors advertise capacity in SI units. A "500 GB" drive contains exactly 500,000,000,000 bytes.
- Network speeds: ISPs advertise in bits per second using SI prefixes. "100 Mbps" means 100,000,000 bits per second, not 100 × 220.
- macOS (since Snow Leopard): Apple switched to SI units in 2009. A file of 1,000,000 bytes displays as "1 MB."
- iOS, Android: Both mobile operating systems use SI units.
- Scientific computing: SI units align with the metric system used in physics and engineering.
IEC / Binary (Powers of 1,024)
- Windows: Still labels sizes as "KB," "MB," "GB" but actually calculates using powers of 1,024. This is technically incorrect per the IEC standard, but Microsoft has maintained this convention for backwards compatibility.
- Linux: Varies by tool.
ls -lhuses binary (1 KiB = 1,024 bytes) with SI labels.ls --siuses true SI.df -huses binary,df -Huses SI. - RAM: Memory modules are genuinely binary. A "16 GB" DIMM contains 16 × 230 = 17,179,869,184 bytes. RAM is one of the few contexts where the binary interpretation is physically correct.
- Cloud storage pricing: AWS, GCP, and Azure define GiB as 230 bytes for billing purposes but sometimes use GB in marketing materials.
The Practical Impact for Developers
Storage Provisioning
When you provision a 100 GB EBS volume on AWS, you get 100 GiB (107,374,182,400 bytes), not 100 GB (100,000,000,000 bytes). But when a user uploads a file and you check file.size in JavaScript, you get the exact byte count. Displaying that as "1.5 GB" or "1.5 GiB" depends on your audience: end users expect SI (like their phone shows), while sysadmins expect binary (like their server reports). Use our Byte Calculator to see conversions in both systems simultaneously.
Configuration Files
Many configuration settings accept size values, and the interpretation varies wildly. Nginx uses lowercase m for megabytes (106) and uppercase M for mebibytes (220). Kubernetes uses M for SI megabytes and Mi for mebibytes. PostgreSQL uses powers of 1,024 for all memory-related settings. Java's -Xmx flag interprets m/M as binary mebibytes. Always check the documentation for the specific tool.
Logging and Monitoring
When your monitoring dashboard shows "disk usage: 45.2 GB," which definition is it using? Prometheus and Grafana default to SI (base 10) for display but collect raw bytes. Datadog uses binary. The difference at the gigabyte level is roughly 7%, which can easily trigger or mask alerts set near capacity boundaries.
How to Convert Between SI and IEC
The key insight is that both systems ultimately measure the same thing: raw bytes. To convert, go through bytes as the common unit:
- Convert the source to raw bytes (multiply by the appropriate power of 1,000 or 1,024)
- Convert raw bytes to the target unit (divide by the appropriate power)
For example, to convert 500 GB (SI) to GiB (IEC):
500 GB = 500 × 10^9 = 500,000,000,000 bytes
500,000,000,000 / 2^30 = 500,000,000,000 / 1,073,741,824
≈ 465.66 GiBThis is exactly what your operating system does when it reports a 500 GB drive as having 465 GB (using binary definitions with SI labels). The SI vs IEC tab in our calculator shows this comparison for any value instantly.
Best Practices
- Always specify the unit system in technical documentation. Write "500 GiB" or "500 GB (SI)," not just "500 GB."
- Store raw bytes internally and format for display at the presentation layer.
- Use IEC units (KiB, MiB, GiB) when precision matters, especially in infrastructure, capacity planning, and SLAs.
- Use SI units (KB, MB, GB) for user-facing displays where familiarity is more important than precision.
- Test with values near tier boundaries (e.g., 999 MB vs 1 GB) to catch off-by-one display bugs.
Try It Yourself
Enter any file size into our Byte Calculator and see both SI and IEC conversions side by side. The SI vs IEC tab highlights the exact percentage difference for any value, and the Transfer tab shows how long a file of that size would take to download at various speeds.
Further Reading
- IEC 80000-13 — Binary Prefixes
The IEC standard that defines KiB, MiB, GiB and the rationale behind them.
- Why does my hard drive report less capacity?
Detailed explanation of the SI vs binary capacity reporting discrepancy.
- NIST Reference on SI Prefixes
The official NIST definition of SI metric prefixes (kilo, mega, giga, etc.).
- Units of Information — Wikipedia
Complete reference covering bits, bytes, nibbles, and all SI/IEC prefix variants.
- JEDEC Memory Standards
Why RAM manufacturers use binary KB/MB/GB while storage uses decimal, and the JEDEC standard behind it.