Decimal vs Binary Bytes
Table of Contents
Decimal & Binary Tables
| Value | Symbol | Name |
|---|---|---|
| 1000 | kB | kilobyte |
| 1000^2 | MB | megabyte |
| 1000^3 | GB | gigabyte |
| 1000^4 | TB | terabyte |
| 1000^5 | PB | petabyte |
| 1000^6 | EB | exabyte |
| 1000^7 | ZB | zettabyte |
| 1000^8 | YB | yottabyte |
| Value | IEC1 Symbol | Name |
|---|---|---|
| 1024 | KiB | kibibyte |
| 1024^2 | MiB | mebibyte |
| 1024^3 | GiB | gibibyte |
| 1024^4 | TiB | tebibyte |
| 1024^5 | PiB | pebibyte |
| 1024^6 | EiB | exbibyte |
| 1024^7 | ZiB | zebibyte |
| 1024^8 | YiB | yobibyte |
Note: Contemporary computer memory has a binary architecture making a definition of memory units based on powers of 2 most practical. The use of the metric prefix kilo for binary multiples arose as a convenience, because 1,024(=2^10) is approximately 1,000 (=10^3) 2.
Deviation2

n=6; (1024**n - 1000**n)/1024**n # exabyte demo
# 0.13263826201159645
In Python
import sys
some_object = ["record1", "record2", "record1000"]
sys.getsizeof(some_object) # returns size in bytes
# create a dictionary with the units, KiB, MiB, and so on
sizes = {
"KiB": round(sys.getsizeof(some_object) / 1024, 2),
"MiB": round(sys.getsizeof(some_object) / 1024 ** 2, 2),
}
print(f"Sizes across units: \n{sizes}")
Size across units:
{'KiB': 0.12, 'MiB': 0.0}