Skip to main content
DevOps

MB vs MiB: Why Your 500 GB Drive Shows 466

The 4% error you write every day

Your file manager says the 4.7 GB DVD image is 4.38 GB. Your drive "loses" 55 GB out of 500. Your 100 Mbps line delivers 11.6 MB/s, not 12.5. None of these are bugs. They are two incompatible definitions of the same prefix fighting for your screen space, and mixing them quietly corrupts estimates, invoices and dashboards.

The IEC introduced binary prefixes in 1998 to fix this. Twenty-five years later, most code still gets it wrong, because the error is small (about 2.4% per step), cumulative and invisible until someone compares two tools that disagree.

Decimal: MB, the SI way

SI prefixes are decimal. Kilo is 1,000, mega is 1,000 squared, giga is 1,000 cubed. Storage and network vendors use these because they are physically honest and rounder for marketing.

  • 1 KB = 1,000 bytes
  • 1 MB = 1,000,000 bytes
  • 1 GB = 1,000,000,000 bytes
  • 1 TB = 1,000,000,000,000 bytes

Hard drive makers, flash vendors, optical media engineers and every telecom on earth live here. A 1 TB SSD holds exactly 1,000,000,000,000 bytes. Genuinely.

Binary: MiB, the IEC fix

Software grew up on powers of two: memory pages, allocation blocks, address buses. So code redefined kilo as 1,024, mega as 1,048,576, giga as 1,073,741,824. Same glyphs, different math. In 1998 the IEC introduced kibibyte, mebibyte and gibibyte (later standardized as IEC 80000-13) to stop the collision.

  • 1 KiB = 1,024 bytes (code: 2^10)
  • 1 MiB = 1,048,576 bytes (2^20)
  • 1 GiB = 1,073,741,824 bytes (2^30)
  • 1 TiB = 1,099,511,627,776 bytes (2^40)

Linux kernel docs, man pages, ls -lh, git and most container runtimes print MiB and GiB. macOS Finder prints MB but means MiB in older versions, which is why the same 8 GB file seems to change size across an OS boundary.

How big is the gap

It compounds. Each binary step is 2.4% larger than its decimal twin, and the gap grows with every exponent:

  • KiB vs KB: 2.4%
  • MiB vs MB: 4.9%
  • GiB vs GB: 7.4%
  • TiB vs TB: 10.0%
  • PiB vs PB: 12.6%

Worked example. A 1 TB drive (10 to the 12th bytes) formatted with ext4 reports in df as roughly 909 GiB. That is not 91 GB of theft. It is 10% unit conversion plus 1-2% filesystem overhead. Multiply back: 909 GiB is about 976 decimal GB of raw bytes. The bytes were always there.

Where the ambiguity actually costs money

1. Hosting bills per GB, marketing sells per GB — different GB. A cloud provider charging $0.023 per GB-month (decimal, like S3 standard) prices a bucket holding 1 TiB of data at 1,099.5 decimal GB, or $25.29 per month, not $23.55. Small drift, real money at petabyte scale: a 1 PiB archive bills as 1,125.9 PB, a 12.6% surprise on the invoice.

2. Network throughput has no trick at all. Bandwidth is decimal and bits: 1 Gbps = 1,000,000,000 bit/s, which is 125 decimal MB/s, or about 119 MiB/s. When iperf prints 119 MiB/s, the gigabit link is running at full wire speed, not 19% short. Copy utilities that print "MB/s" but compute with 1,048,576 make every benchmark unreproducible. Pin the unit in test harnesses, and convert with a dedicated calculator instead of hand-rolling the math in five places.

3. RAM is binary, storage is decimal, and sizing docs sit in between. RAM modules are natively powers of two, so "16 GB RAM" is really 16 GiB. Drive marketing is decimal. When a spreadsheet says "16 GB of RAM per worker and 1 GB of cache per shard," nobody on the team can later tell which convention was meant. Write the unit explicitly: 16 GiB RAM, 1 GB persistent cache. The ambiguity dies on contact with a suffix.

4. Backup transfer estimates. Copying 1 TiB over a 1 Gbps link at 65% effective utilization: 1,099,511,627,776 bytes divided by 81,250,000 effective B/s is about 3.8 hours. The common mistake: the planner divides 1,000 "GB" by 125 "MB/s" while the metric actually reports MiB/s. Both numbers look plausible, and the estimate drifts by up to 13%. At 40 TB that is a five-hour surprise. The transfer-time estimator handles the decimal/binary split for you.

5. Monitoring thresholds. An alert "page at 95% of 32 GB" fires at a different absolute usage depending on whether the metric was collected in MiB or MB. If the agent reports decimal MB but alert thresholds were set assuming binary, your trigger point is 4.9% off, and a slow leak gets noticed after the OOM kill instead of before it. Pick one convention for memory.used, document it next to the metric, translate at the edge only.

What each ecosystem actually uses

  • Windows Explorer: MB label, binary math. MiB wearing an MB badge — the historical accident everyone copies
  • macOS Finder since 10.6 (2009): decimal MB. This is why files suddenly "shrank" 4% after upgrading
  • Linux file managers: decimal by default; df -h is binary, df --si is decimal
  • Hard drives, SSDs, USB sticks, optical, tape: decimal
  • RAM modules: binary
  • Network speeds and telecom SLAs: decimal bits
  • Cloud storage billing (AWS, GCP, Azure): decimal GB
  • git, kernel docs, man pages, Docker layer sizes: KiB / MiB / GiB

The macOS switch in Snow Leopard was so visible it got a dedicated Ars Technica write-up, because every file on disk looked 4% smaller overnight. That is what a convention change does to end users.

Three rules to stop the bleed

1. Never mix conventions in one document, one dashboard or one sentence. A chart where the y-axis is GiB and the source column is MB looks like a data bug, because it is one.

2. Suffix your numbers. "500 GB (decimal, vendor spec)" or "466 GiB (binary, what df shows)" is the same physical drive. Suffixes turn ambiguity into arithmetic, and the arithmetic is cheap. When users paste "2,000 GB" into a sizing form, decide upfront which unit their input is, or put the unit in the placeholder.

3. In code, never say bare "MB". In comments, metric names and column headers write "MB (10^6 B)" or "MiB (2^20 B)". For mixed-unit work — a batch job converting sizes across a dataset — a batch unit converter beats mental powers of two.

Quick reference

  • GB to GiB: divide by 1.0737
  • GiB to GB: multiply by 1.0737
  • MB/s to MiB/s: multiply by 0.9537
  • MiB/s to MB/s: multiply by 1.0486
  • 1 Gbps to MB/s: divide by 8, exactly (both decimal bits and bytes)
  • 1 TiB to TB: multiply by 1.0995

The 1.0486 factor is the one worth memorizing: it is 1.024 squared, because the 1024/1000 wedge compounds twice per mega step.

Bottom line

Neither convention is wrong. Decimal units describe what the hardware holds and what the wire moves. Binary units describe how software partitions memory. Trouble starts when one borrows the other's vocabulary. Write the suffix you mean, and your disk reports, invoices, benchmarks and alerts will agree again.