Byte Size Units Explained: KB, MB, GB and Beyond
Byte Size Units Explained: KB, MB, GB and Beyond
Is a kilobyte 1,000 or 1,024 bytes? The answer has caused confusion for decades. This guide clarifies the units and their practical implications.
The Confusion
Computer memory is binary (powers of 2), but the metric system uses powers of 10. The industry used "kilobyte" for both 1,000 and 1,024 bytes for years.
SI (Decimal) Units
Powers of 10 — what storage manufacturers and networking use:
| Unit | Bytes | Power |
|------|-------|-------|
| KB (kilobyte) | 1,000 | 10^3 |
| MB (megabyte) | 1,000,000 | 10^6 |
| GB (gigabyte) | 1,000,000,000 | 10^9 |
| TB (terabyte) | 1,000,000,000,000 | 10^12 |
| PB (petabyte) | 10^15 | 10^15 |
Binary Units (IEC)
Powers of 2 — what RAM and operating systems (sometimes) use:
| Unit | Bytes | Power |
|------|-------|-------|
| KiB (kibibyte) | 1,024 | 2^10 |
| MiB (mebibyte) | 1,048,576 | 2^20 |
| GiB (gibibyte) | 1,073,741,824 | 2^30 |
| TiB (tebibyte) | 1,099,511,627,776 | 2^40 |
Why Your Drive Seems Smaller
A "1 TB" drive has 1,000,000,000,000 bytes (decimal). But your OS might display it in binary units: 1,000,000,000,000 / 1,073,741,824 = 931 GiB. You didn't lose 69 GB — it's a unit mismatch.
Who Uses What
| Context | Unit System |
|---------|-------------|
| Hard drive manufacturers | Decimal (SI) |
| macOS | Decimal (SI) |
| Windows | Binary (labeled as GB/TB) |
| Linux | Depends on tool |
| RAM | Binary |
| Network speeds | Decimal (and bits, not bytes) |
| Cloud storage pricing | Usually decimal |
Network: Bits vs Bytes
Network speeds use bits per second. A "100 Mbps" connection transfers 100 megabits = 12.5 megabytes per second. Divide by 8.
Programming
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return "0 Bytes";
const k = 1024; // Use 1000 for SI units
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + " " + sizes[i];
}
Try It
Use our Byte Converter tool to convert between bytes, KB, MB, GB, TB, and PB in both decimal and binary systems.
Conclusion
Use decimal (SI) units when communicating with non-technical users and for storage. Use binary units when precision matters for memory calculations. Always clarify which system you're using when the difference matters.