Byte Converter

Convert between bytes, kilobytes, megabytes, gigabytes, and more.

Common File Sizes Reference

Text file~10 KB
MP3 song~5 MB
HD video (1hr)~4 GB
Blu-ray movie~50 GB
iPhone photo~3 MB
4K video (1hr)~20 GB
Windows install~20 GB
Steam game~50-100 GB

Decimal vs Binary Units

Storage manufacturers use decimal units (1 KB = 1000 bytes) while operating systems often display binary units (1 KiB = 1024 bytes). This is why a "500 GB" drive shows as ~465 GiB in your OS.

Decimal (SI)
  • 1 KB = 1,000 bytes
  • 1 MB = 1,000,000 bytes
  • 1 GB = 1,000,000,000 bytes
Binary (IEC)
  • 1 KiB = 1,024 bytes
  • 1 MiB = 1,048,576 bytes
  • 1 GiB = 1,073,741,824 bytes

Code Examples

function formatBytes(bytes, decimals = 2) {
  if (bytes === 0) return '0 Bytes';
  const k = 1024;
  const sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB'];
  const i = Math.floor(Math.log(bytes) / Math.log(k));
  return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
}

Frequently Asked Questions

What's the difference between KB and KiB?

KB (kilobyte) = 1000 bytes (decimal, SI standard). KiB (kibibyte) = 1024 bytes (binary). Storage manufacturers use decimal; operating systems often use binary, causing confusion about drive sizes.

Why do my storage devices show less space than advertised?

Manufacturers use decimal units (1 GB = 1,000,000,000 bytes) while operating systems display binary units (1 GiB = 1,073,741,824 bytes). A 500 GB drive shows as ~465 GiB.

Related Tools