# Bits, bytes, and KiB vs KB

*Counting storage, and the 1024 versus 1000 gap*

A byte is 8 bits, and larger amounts of storage use prefixes that come in two flavors: binary prefixes (KiB, MiB, GiB) that multiply by 1024, and decimal SI prefixes (KB, MB, GB) that multiply by 1000, which is why a drive's advertised size looks smaller once formatted.

Group: Number & logic
URL: https://digiwleea.wleeaf.dev/learn/units-of-storage/

A single [bit](https://digiwleea.wleeaf.dev/learn/binary/) is one `0` or `1`. Bits are small, so we count storage in bigger lumps. The foundational one is the **byte**: eight bits, enough to hold one [ASCII](https://digiwleea.wleeaf.dev/learn/ascii/) character or a number from `0` to `255`. A byte is the smallest chunk most machines address individually, which is why memory sizes are quoted in bytes, not bits.

```
1 byte = 8 bits      1 nibble = 4 bits (one hex digit)
```

## Two families of prefix

Above the byte, prefixes scale things up, and here is the catch that trips everyone: there are **two** systems, one based on `1000` and one on `1024`. Computers naturally work in powers of two, and `2^10 = 1024` happens to sit near `1000`, so the same letter got used loosely for both. Standards later split them:

| name | symbol | multiplier | bytes |
| --- | --- | --- | --- |
| kilobyte | KB | 1000 | 1000 |
| kibibyte | KiB | 1024 | 1024 |
| megabyte | MB | 1000^2 | 1,000,000 |
| mebibyte | MiB | 1024^2 | 1,048,576 |
| gigabyte | GB | 1000^3 | 1,000,000,000 |
| gibibyte | GiB | 1024^3 | 1,073,741,824 |

_The decimal (SI) prefixes multiply by 1000; the binary (IEC) prefixes, spelled with an extra 'i', multiply by 1024. The gap grows with each step: 2.4% at kilo, but about 7.4% by giga._

## Why a 500 GB drive shows less

Drive makers advertise in **decimal** GB (`500 GB = 500,000,000,000` bytes) because the number looks bigger. Many operating systems report in **binary** GiB but label it "GB". So `500,000,000,000 / 1,073,741,824` is about `465`, and the drive shows as `465 GB`. No bytes went missing; the same count was divided by `1024^3` instead of `1000^3`. RAM, by contrast, is almost always sized in true binary units (a `16 GB` stick is `16 GiB`), because memory addressing is inherently a power of two.

> **WARN:** **Common mistakes.** Do not confuse a bit (`b`) with a byte (`B`): a `100 Mb/s` network link moves about `12.5 MB/s`, an eightfold difference. And do not assume KB always means 1024; strictly, `KB = 1000` and `KiB = 1024`, though older software and casual usage often say "KB" when they mean `KiB`.

**Q (Try it):** How many bits are in 2 KiB? And how many bytes in 2 KB?

**A:** `2 KiB = 2 x 1024 = 2048 bytes`, and each byte is 8 bits, so `2048 x 8 = 16,384 bits`. `2 KB = 2 x 1000 = 2000 bytes` (`16,000 bits`). The binary kibibyte is 48 bytes larger than the decimal kilobyte at this size.

### FAQ

**Q:** How many bits are in a byte?

**A:** Eight. A byte is 8 bits, enough to store one character or an integer from `0` to `255`. Half a byte (4 bits) is a nibble, which is exactly one [hexadecimal](https://digiwleea.wleeaf.dev/learn/hexadecimal/) digit.

**Q:** What is the difference between KB and KiB?

**A:** A kilobyte (KB) is `1000` bytes (decimal SI prefix); a kibibyte (KiB) is `1024` bytes (binary IEC prefix). The same distinction repeats at every scale: MB vs MiB, GB vs GiB. The binary units are always slightly larger, and the gap widens at higher scales.

**Q:** Why does a hard drive show less space than advertised?

**A:** Manufacturers count in decimal GB (`1000^3` bytes) while many operating systems display binary GiB (`1024^3` bytes) but call it "GB". Dividing the same byte count by the larger `1024^3` gives a smaller number, so a `500 GB` drive shows as about `465 GB`. No storage is lost; only the unit differs.

> **KEY:** Bytes are the currency the rest of the machine trades in: an [instruction](https://digiwleea.wleeaf.dev/learn/machine-code/) is a byte, a [register](https://digiwleea.wleeaf.dev/learn/register8/) holds a byte, and [RAM](https://digiwleea.wleeaf.dev/learn/ram/) is a bank of bytes the CPU addresses by number.
