KB vs KiB, MB vs MiB: why file sizes disagree
Your drive is labelled 1 TB, the OS shows ~931 GB, and a progress bar says 1000 MB. Nobody is lying — they are counting in different bases.
The two ladders
| SI (decimal) | Bytes | IEC (binary) | Bytes |
|---|---|---|---|
| 1 KB | 1 000 | 1 KiB | 1 024 |
| 1 MB | 1 000 000 | 1 MiB | 1 048 576 |
| 1 GB | 1 000 000 000 | 1 GiB | 1 073 741 824 |
| 1 TB | 1 000 000 000 000 | 1 TiB | 1 099 511 627 776 |
So a “1 TB” hard drive (SI) is about 0.91 TiB — which is why Windows often shows ~931 GB for a marketed 1 TB disk when it still labels binary sizes as “GB”.
Where each convention shows up
- Drive / USB stick packaging — almost always SI (1000).
- RAM modules — almost always binary (a “16 GB” stick is 16 × 1024³ bytes).
- macOS Finder (recent) — SI for disk capacity.
- Windows Explorer / many Linux
dfdefaults — historically binary under “KB/MB/GB” labels; some tools now say KiB/MiB. - Network speeds — usually decimal bits (100 Mbps = 100×106 bits/s), not binary bytes.
- Cloud object storage bills — check the vendor docs; many use SI GB/TB for pricing.
Quick conversions
# 5 MB (SI) → MiB
curl -s 'https://api.oddlathe.com/v1/units?value=5&from=MB&to=MiB'
# → result ≈ 4.768
# 1 GiB → GB
curl -s 'https://api.oddlathe.com/v1/units?value=1&from=GiB&to=GB'
# → result ≈ 1.074
Send a normal browser-like User-Agent if a script gets HTTP 403 from the CDN. Docs and try-it form: api.oddlathe.com/docs/units.
Writing limits that do not surprise users
- Spell the unit you mean:
5 MiBor5_000_000 bytes, not ambiguous “5 MB” in a security limit. - If you parse human input like
10MB, document whether you treat it as 10×1000² or 10×1024². - When comparing OS “free space” to a download size, convert both to the same base first.
Not the same as
- Bit vs byte — network “100 Mbps” is bits; downloads are usually bytes (÷8 for a rough MB/s).
- Base64 size inflation — encoded text is ~4/3 the byte length; that is encoding, not KB/KiB.
- Seconds vs milliseconds — another off-by-1000 trap, for time instead of storage.
Related
Unit converter · Celsius ↔ Fahrenheit ↔ Kelvin · Metric tonne vs ton · Unix seconds vs milliseconds · Number base converter · Anvil /v1/units
Questions
Is 1 KB 1000 or 1024 bytes?
In the SI standard used by drive makers, 1 KB = 1000 bytes. The binary unit for 1024 bytes is 1 KiB (kibibyte). Older software often said “KB” while meaning 1024.
Why does my 1 TB drive show ~931 GB?
The label uses SI terabytes (10^12 bytes). The OS is often displaying tebibyte-scale maths under a “GB” label (about 0.91 × 10^12 / 2^30).
What is the difference between MB and MiB?
MB = 1,000,000 bytes (SI). MiB = 1,048,576 bytes (IEC). About a 4.9% gap at the megabyte scale; larger at GB/TB.
Should my upload limit use MB or MiB?
Pick one, document it, and enforce bytes. “5 MB” without a base is how support tickets start.
Does Anvil /v1/units treat KB as 1000?
Yes. KB/MB/GB/TB are SI; KiB/MiB/GiB/TiB are binary. The JSON note field reminds you which ladder you used.
Are kibibytes required by law?
No — but IEC names remove ambiguity. Prefer KiB/MiB in APIs and error messages.
Published .