Bit, Byte, KB, MB, GB, TB, PB

Bit

A bit is a binary digit, the smallest unit of data stored on a computer.

Byte

A byte contains enough information to store a single ASCII character, like "A".

Kilobyte or KB

Megabyte or MB

Gigabyte or GB

Terabyte or TB

Decimal vs. Binary Storage Units

Decimal (SI system: International System of Units)

Here, kilo means 1,000, just like in kilometers (1 km = 1,000 meters).

Binary (IEC system: International Electrotechnical Commission)

Here, "kibi" comes from kilo + binary, meaning \(2^{10}\).

Why the difference matters

If you buy a 1 TB hard drive, the manufacturer means 1 terabyte = 1,000,000,000,000 bytes (\(10^{12}\)).

But your computer may report it as about 931 GiB, because it divides by \(1,024^3\) instead of \(1,000^3\).

So the difference is in the base used:

Quick Reference Table

Unit Decimal (SI) Binary (IEC) Approximate Size
Bit - - Single 0 or 1
Byte 8 bits 8 bits One character
Kilobyte/Kibibyte \( 10^3 \) (1,000) \( 2^{10} \) (1,024) Email without images
Megabyte/Mebibyte \( 10^6 \) (1 million) \( 2^{20} \) (1,048,576) High-quality photo
Gigabyte/Gibibyte \( 10^9 \) (1 billion) \( 2^{30} \) (1,073,741,824) Hard drive capacity
Terabyte/Tebibyte \( 10^{12} \) (1 trillion) \( 2^{40} \) (1,099,511,627,776) Large hard drive
Petabyte/Pebibyte \( 10^{15} \) (1 quadrillion) \( 2^{50} \) (1,125,899,906,842,624) Data center storage

Etymology of Storage Unit Prefixes

Kilo (\(10^3\))
From Greek "khilioi" meaning "thousand"
Used in metric system since the 1790s
Mega (\(10^6\))
From Greek "megas" meaning "great" or "large"
Also means "million" in Greek
Giga (\(10^9\))
From Greek "gigas" meaning "giant"
Pronounced "GIG-a" or "JIG-a"
Tera (\(10^{12}\))
From Greek "teras" meaning "monster" or "marvel"
Suggests something enormous
Peta (\(10^{15}\))
From Greek "penta" meaning "five"
Represents the 5th power of 1000 (1000⁵)
Exa (\(10^{18}\))
From Greek "hex" meaning "six"
Represents the 6th power of 1000 (\(1000^6\))
The "h" was dropped to avoid confusion with "hexa"

Reference

https://web.stanford.edu/class/cs101/bits-bytes.html

https://en.wikipedia.org/wiki/Kilobyte#:~:text=In%20the%20International%20System%20of,The%20unit%20symbol%20is%20kB.