Data Storage Converter

Convert between different data storage units such as bits, bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, exabytes, zettabytes, and yottabytes.

Data Storage Converter
ready
$ convert --from [unit] --to [unit] --value [number]
$
>
formulas.ts

// Common Data Storage Converter Formulas

1const1 byte = 8 bits
2const1 kilobyte = 1024 bytes
3const1 megabyte = 1024 kilobytes
4const1 gigabyte = 1024 megabytes
5const1 terabyte = 1024 gigabytes
references.json

// Common Data Storage Converter References

{
"Text File":"1-100 KB",
"Image File":"1-10 MB",
"Video File":"1-10 GB",
"Hard Drive":"500GB-2TB",
"Server Storage":"10-100 TB",
"Data Center":"Petabyte level"
}
guide.md

Binary vs decimal storage units

Data size labels confuse people because hard-drive makers often use decimal SI prefixes (1 GB = 10^9 bytes) while operating systems historically used binary prefixes (1 GiB = 2^30 bytes). This converter separates those conventions so a “GB” is not silently treated as a “GiB”.

method.ts

Rules applied

  1. Decimal units (kB, MB, GB, TB) use powers of 1000 when labeled as SI-style.
  2. Binary units (KiB, MiB, GiB, TiB) use powers of 1024.
  3. Convert through bytes as the common base.
sources.md

Sources

  • - IEC 80000-13: binary prefixes KiB, MiB, GiB.
  • - SI Brochure: decimal prefixes kilo, mega, giga for powers of 10.
examples.md

Worked examples

Why a “500 GB” drive looks smaller in the OS

  1. Drive marketing: 500 × 10^9 = 500,000,000,000 bytes.
  2. OS using GiB: 500,000,000,000 / 2^30 ≈ 465.66 GiB.

Result: 500 GB (decimal) ≈ 465.7 GiB (binary)

File size: 4 MiB to bytes

  1. 1 MiB = 2^20 = 1,048,576 bytes.
  2. 4 × 1,048,576 = 4,194,304 bytes.

Result: 4 MiB = 4,194,304 bytes

Ambiguous labels

  • Some UIs still write “KB” when they mean KiB (1024 bytes).
  • Network rates (Mbps) are usually decimal bits per second—not the same as storage MiB/s.
  • Bits vs bytes: 1 byte = 8 bits; download “Mbps” is not “MBps”.

Uses

  • - Explaining drive capacity discrepancies.
  • - Estimating whether a file fits on a USB stick.
  • - Comparing cloud storage plans advertised in GB/TB.
FAQ.md

Data storage FAQ

01 Q: Is 1 KB 1000 or 1024 bytes?

Strict SI: 1 kB = 1000 bytes. Strict binary: 1 KiB = 1024 bytes. Older software often mislabeled KiB as KB.

02 Q: How many bytes in a gibibyte?

1 GiB = 1,073,741,824 bytes (1024³).