Use Digital Storage Converter

Enter your data below to use the Digital Storage Converter

📌 Try these examples:
RESULT

Last updated

Digital Storage Units

Digital storage is measured in bytes and their multiples. There are two systems: decimal (SI) prefixes (kilo = 1000) used by storage manufacturers and network speeds, and binary (IEC) prefixes (kibi = 1024) used by operating systems for file sizes. This discrepancy is why a "1TB" hard drive shows as ~931 GiB in Windows.

Storage Unit Reference

Decimal (SI)ValueBinary (IEC)Value
Kilobyte (KB)1,000 BKibibyte (KiB)1,024 B
Megabyte (MB)1,000,000 BMebibyte (MiB)1,048,576 B
Gigabyte (GB)1,000,000,000 BGibibyte (GiB)1,073,741,824 B
Terabyte (TB)10¹² BTebibyte (TiB)2⁴⁰ B
Petabyte (PB)10¹⁵ BPebibyte (PiB)2⁵⁰ B

Conversion in JavaScript

JavaScript
const UNITS_DECIMAL = ['B','KB','MB','GB','TB','PB'];
const UNITS_BINARY  = ['B','KiB','MiB','GiB','TiB','PiB'];

function formatBytes(bytes, binary = false) {
  if (bytes === 0) return '0 B';
  const base = binary ? 1024 : 1000;
  const units = binary ? UNITS_BINARY : UNITS_DECIMAL;
  const i = Math.floor(Math.log(bytes) / Math.log(base));
  return (bytes / Math.pow(base, i)).toFixed(2) + ' ' + units[i];
}

console.log(formatBytes(1073741824));        // '1.07 GB'
console.log(formatBytes(1073741824, true));  // '1.00 GiB'
console.log(formatBytes(1500000000));        // '1.50 GB'

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.