To convert storage units, divide to move to a bigger unit and multiply to move to a smaller one, using the factor of the convention the question states. In the binary convention the factor between neighbouring byte units is 1 024, and between bytes and bits it is 8.
This lesson finishes images, sound and storage. Without it, the size you calculated in image size or audio size stays as an unreadable number of bits.
What are the units and factors?
| Unit | Symbol | Binary convention | Decimal convention |
|---|---|---|---|
| Bit | b | smallest unit | smallest unit |
| Byte | B | 8 bits | 8 bits |
| Kibibyte / kilobyte | KiB / kB | 1 024 bytes | 1 000 bytes |
| Mebibyte / megabyte | MiB / MB | 1 024 KiB | 1 000 kB |
| Gibibyte / gigabyte | GiB / GB | 1 024 MiB | 1 000 MB |
| Tebibyte / terabyte | TiB / TB | 1 024 GiB | 1 000 GB |
Many Cambridge Computer Science materials use the binary names (kibibyte, mebibyte, gibibyte). Check the current syllabus for the exact convention in your exam year, and always follow any convention printed in the question.
How do you convert, step by step?
- Write the starting unit and the target unit.
- Decide the direction. Bigger target means divide. Smaller target means multiply.
- Apply one factor at a time (bits to bytes: ÷ 8; bytes to KiB: ÷ 1 024; KiB to MiB: ÷ 1 024).
- Sense-check: the number should be smaller after moving to a bigger unit.
Worked example
A video clip file is 5 242 880 bytes. Give its size in KiB and in MiB, using 1 KiB = 1 024 bytes and 1 MiB = 1 024 KiB.
Step 1, bytes to KiB: 5 242 880 ÷ 1 024 = 5 120 KiB.
Step 2, KiB to MiB: 5 120 ÷ 1 024 = 5 MiB.
Check: 5 MiB × 1 024 × 1 024 = 5 × 1 048 576 = 5 242 880 bytes. This matches the start.
Decimal comparison: if the question used decimal units, 5 242 880 bytes = 5 242.88 kB = 5.24288 MB. The different factor gives a different number, which is why the convention must be stated.
The mistake to watch for
A common slip is to use 1 000 when the question states 1 024, or to divide when you should multiply.
Mistaken answer: “3 MiB in KiB: 3 ÷ 1 024 = 0.0029 KiB.”
The student divided, but KiB is a smaller unit than MiB, so the number must grow, not shrink.
The correction: KiB is a smaller unit, so the number gets bigger. 3 MiB = 3 × 1 024 = 3 072 KiB. A sense check helps here: one MiB contains 1 024 KiB, so 3 MiB must contain more than 1 024 KiB.
Check yourself
Try these, then open each answer.
1. Convert 12 MiB to bytes (binary convention).
Show answer
12 × 1 024 = 12 288 KiB. 12 288 × 1 024 = 12 582 912 bytes.
2. Convert 6 144 KiB to MiB.
Show answer
6 144 ÷ 1 024 = 6 MiB.
3. A file is 65 536 bits. Give its size in bytes and in KiB.
Show answer
Bytes = 65 536 ÷ 8 = 8 192 bytes. KiB = 8 192 ÷ 1 024 = 8 KiB (8 192 bytes).
Where this leads next
You now have every step needed for a full size question. Combine them in the images, sound and storage practice set. The Python reasoning sandbox can check a conversion as code.
If you convert correctly in class but slip under timed conditions, a teacher can look at your working with you in online one-to-one Computer Science tuition.