Skip to content

KB vs KiB: 1000 or 1024 Bytes?

A kilobyte (KB) is 1000 bytes. A kibibyte (KiB) is 1024 bytes. The two-and-a-half percent difference between them compounds at every level - by the terabyte it is nearly 10% - and it is why every hard drive seems smaller than the box claims. Here is where the split came from and how to keep the units straight.

Want the answer instantly? Use the free Byte Converter - it shows this working step by step for any number.

Where the confusion came from

Early computing borrowed the metric prefix 'kilo' for 1024 bytes because 2¹⁰ = 1024 is conveniently close to 1000. That shortcut worked until storage got large enough for the gap to matter commercially. In 1998 the IEC standardized separate binary prefixes - kibi (Ki), mebi (Mi), gibi (Gi) - reserving kilo/mega/giga for their metric meanings of 1000, 1000², 1000³.

Adoption split down the middle: storage manufacturers and networking use decimal units (a 500 GB drive is 500,000,000,000 bytes), while operating systems and RAM use binary math - Windows famously reports sizes in binary units while labeling them 'GB'.

Why your 500 GB drive shows 465 GB

The drive really does contain 500 billion bytes. But 500,000,000,000 ÷ 1,073,741,824 (one GiB) ≈ 465.7 - so an OS that counts in binary units displays 465 'GB'. Nothing is missing; the two sides are just counting with different-sized units.

Which unit should you use?

A practical rule of thumb for developers:

  • Disk sizes, file transfer rates, network bandwidth → decimal (KB, MB, GB)
  • RAM, page sizes, buffer sizes, anything addressed in powers of two → binary (KiB, MiB, GiB)
  • User-facing displays → pick one, and if it is binary math, label it KiB/MiB/GiB honestly
  • APIs and configs → document which one you mean; 'maxSize: 10MB' is ambiguous

Doing it in code

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

Is 1 KB 1000 or 1024 bytes?

Officially 1000 bytes - the SI prefix kilo always means 1000. The 1024-byte unit is properly called a kibibyte (KiB). In casual usage KB still often means 1024 bytes, which is exactly why the explicit KiB notation exists.

How many bytes is 1 GB vs 1 GiB?

1 GB = 1,000,000,000 bytes (10⁹). 1 GiB = 1,073,741,824 bytes (2³⁰). A GiB is about 7.4% larger than a GB, and the gap widens with each prefix: a TiB is nearly 10% larger than a TB.

Why does Windows show my drive smaller than advertised?

Windows divides the drive's byte count by powers of 1024 but labels the result with decimal unit names (GB/TB). The manufacturer counted in powers of 1000. Both are internally consistent - they just use different units with the same label.

Related Guides