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)BytesIEC (binary)Bytes
1 KB1 0001 KiB1 024
1 MB1 000 0001 MiB1 048 576
1 GB1 000 000 0001 GiB1 073 741 824
1 TB1 000 000 000 0001 TiB1 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

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

  1. Spell the unit you mean: 5 MiB or 5_000_000 bytes, not ambiguous “5 MB” in a security limit.
  2. If you parse human input like 10MB, document whether you treat it as 10×1000² or 10×1024².
  3. When comparing OS “free space” to a download size, convert both to the same base first.

Not the same as

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 .

Try it

Related guides

Newest guides