Units & Conversion
Every file you save is a pattern of bits. A bit is a single binary digit, either 0 or 1, and it is the smallest unit of storage. Bits are bundled into larger units so sizes are quicker to write and read.
| Unit | Worth |
|---|---|
| bit | one binary digit |
| nibble | 4 bits, half a byte |
| byte | 8 bits, roughly one character of text |
| kibibyte (KiB) | 1024 bytes |
| mebibyte (MiB) | 1024 KiB |
| gibibyte (GiB) | 1024 MiB |
| tebibyte (TiB) | 1024 GiB |
Each unit in the table is bigger than the one before: a bit to a nibble is 4 times, a nibble to a byte is 2 times, and every step after the byte is 1024 times the one before, where 1024 is 2 to the power of 10. Counted in bytes, that gives 1 KiB = 2^10, 1 MiB = 2^20, 1 GiB = 2^30 and 1 TiB = 2^40 bytes.
Moving from a larger unit down to a smaller one, multiply by 1024 once for each step. Moving from a smaller unit up to a larger one, divide by 1024 once for each step. Bits and bytes work differently: multiply by 8 to turn bytes into bits, and divide by 8 to turn bits into bytes, because a byte is 8 bits.
For example, a 3 GiB game holds 3 × 1024 = 3072 MiB, which is 3072 × 1024 = 3 145 728 KiB. Going the other way, 20 480 bits is 20 480 ÷ 8 = 2560 bytes, which is 2560 ÷ 1024 = 2.5 KiB.
storage_gib = 5
print("Bytes: " + str(storage_gib * 1024 ** 3))
print("Mebibytes: " + str(storage_gib * 1024))Output:
Bytes: 5368709120
Mebibytes: 5120Binary prefixes — kibi-, mebi-, gibi-, tebi- — step up in 1024s. Decimal prefixes — kilo-, mega-, giga-, tera- — step up in 1000s, so 1 kilobyte is 1000 bytes and a 2 TB drive is 2 000 000 000 000 bytes. A 2 TiB drive holds noticeably more, so use whichever prefix the question gives.
Data capacity is the total storage a set of files and any extra data needs, written in a suitable unit. Convert it by multiplying or dividing by the power of 1024 that matches the units, or by 1000 for decimal prefixes.
Edexcel GCSE Computer Science · Units & Conversion
Edexcel GCSE Computer Science · Network Speed