Decimal vs binary — which one should I use?
The IEC standard says decimal units (KB, MB, GB) should mean 1000-based, and binary units (KiB, MiB, GiB) should mean 1024-based. In practice, the labels are used interchangeably and the right choice depends on the system you’re talking to:
- Storage devices & macOS: decimal (1 GB = 1,000,000,000 bytes).
- Windows Explorer: binary (1 GB = 1,073,741,824 bytes), labeled inconsistently as “GB”.
- RAM and CPU caches: always binary.
- Most cloud storage APIs (S3, R2, GCS): decimal.
- Most email providers: decimal — see email attachment size limits.
Conversion formulas
// Decimal (SI)
1 KB = 1,000 bytes
1 MB = 1,000,000 bytes (1e6)
1 GB = 1,000,000,000 bytes (1e9)
1 TB = 1,000,000,000,000 bytes (1e12)
// Binary (IEC)
1 KiB = 1,024 bytes (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)
// JS one-liner (decimal)
const mbToKb = (mb) => mb * 1000;
const kbToBytes = (kb) => kb * 1000;
// JS one-liner (binary)
const mibToKib = (mib) => mib * 1024;
const kibToBytes = (kib) => kib << 10;Test with real files at the size you need
Once you know the size you need, skip the math and grab a real sample file. Every file we host is sized to match its filename:
- 1MB sample files — every format.
- 10MB sample files — every format.
- 100MB sample files — every format.
- Large test files — up to 10GB for stress testing.