📚Dev Reference

File Size Reference

Understanding Bytes, KB, MB, and GB.

Explanation

Digital storage units can be confusing due to Decimal (base 10) vs Binary (base 2) systems.

Examples

1 MB
Output
1,000 KB (Dec) or 1,024 KB (Bin)

Code Examples

Binary (IEC)
1 KB = 1,024 Bytes
1 MB = 1,024 KB
1 GB = 1,024 MB
1 TB = 1,024 GB

Try it Now

💡 Tips

  • Operating systems usually use binary (1024)
  • Drive manufacturers usually use decimal (1000)
  • Use MiB/GiB for binary units to be precise

⚠️ Common Pitfalls

  • Mixing up bits (lowercase b) and Bytes (uppercase B)