Study Guide

Measuring Storage and File Sizes

How storage is measured from bits to exbibytes using 1024, how kibi differs from kilo, and how to calculate the size of an image file and a sound file and give the answer in the unit asked for.

Lesson 1.9 Data Representation

For: Cambridge IGCSE Computer Science learners, or anyone who has met images and sound stored as binary

Stage: Think

Why one unit is not enough

A fictional phone shows a message: “Storage almost full”. A text message takes a few hundred bits, a photo takes millions, and a film takes billions. All of them are measured in bits and bytes, but it would be awkward to write the size of a film as a number of bits.

Think it through

Lengths are measured in millimetres, metres and kilometres. Why do you think data is measured in several units too, and how many of one unit do you expect to make the next?

Show what happens

Different sizes need different units, just as a kilometre is better for a road than a millimetre. Each unit is made of a number of the one below it. For lengths it is 10, 100 or 1000. For data, as the rest of this lesson shows, it is 1024.

The smallest unit is the bit, a single 0 or 1. A group of 4 bits is a nibble and a group of 8 bits is a byte. So there are 8 bits in a byte, and 2 nibbles in a byte.

Stage: Discover

Why 1024?

Think it through

Computers work in powers of 2: 2, 4, 8, 16, 32 and so on. Keep doubling from 2 until you reach a number just above 1000. Which power of 2 is it, and what number is it?

Show what happens

2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. It is 2¹⁰ = 1024, the power of 2 closest to 1000. A unit of 1024 bytes fits the way a computer counts, with a neat power of 2, while 1000 does not.

Each unit of storage is 1024 of the one below it. The names join the start of a metric prefix to “bi” for “binary”: kilo and binary make kibi, mega and binary make mebi, and so on. This gives:

Going up one unit, divide by 1024. Going down one unit, multiply by 1024.

  1. Decide the direction. KiB is one unit below MiB, so the number gets bigger: multiply by 1024.
  2. Convert to KiB. 3 × 1024 = 3072 KiB.
  3. Go down once more, to bytes. Bytes are one unit below KiB, so multiply by 1024 again: 3072 × 1024 = 3 145 728 bytes.
  4. Check the other way. 3 145 728 ÷ 1024 = 3072, and 3072 ÷ 1024 = 3. The answer returns to 3 MiB.
Converting between units
Starting sizeConvert toAnswer
3 MiBKiB3072
16 bitsbytes
8192 bytesKiB
5 GiBMiB
4096 MiBGiB
2 TiBGiB
1 EiBTiB

    Show the completed table
    Starting sizeConvert toAnswer
    3 MiBKiB3072
    16 bitsbytes2
    8192 bytesKiB8
    5 GiBMiB5120
    4096 MiBGiB4
    2 TiBGiB2048
    1 EiBTiB1 048 576

    Check your understanding

    How many MiB are there in 6 GiB?
    Show the answer

    Answer: B. 6144 MiB, because 6 × 1024 = 6144.

    1 GiB is 1024 MiB, so 6 GiB is 6 × 1024 = 6144 MiB. There are more of the smaller unit.

    Stage: Predict

    Kibi and kilo

    A fictional shop sells a hard drive as “1 TB”. The computer that it is plugged into reports its size as about 931 GiB, and the buyer worries that something is missing.

    Think it through

    Has the shop cheated? Think about what the prefix “tera” means in the shop’s label, and what “tebi” means to the computer.

    Show what happens

    No, two different units are being compared. The shop uses the decimal prefix tera, so 1 TB = 1 000 000 000 000 bytes. The computer reports in binary units, where 1 GiB = 1 073 741 824 bytes. Dividing, 1 000 000 000 000 ÷ 1 073 741 824 is about 931 GiB. All the bytes are there.

    Do not confuse: Decimal prefixes and binary prefixes

    Based on 1000Kilo, mega, giga, tera
    The decimal (metric) prefixes. 1 kilobyte (kB) = 1000 bytes, 1 megabyte (MB) = 1000 kB, and so on.1 TB = 1 000 000 000 000 bytes.
    Based on 1024Kibi, mebi, gibi, tebi
    The binary prefixes. 1 KiB = 1024 bytes, 1 MiB = 1024 KiB, and so on.1 TiB = 1 099 511 627 776 bytes.

    The gap grows with each prefix: a kibibyte is about 2.4% bigger than a kilobyte, a mebibyte about 4.9% bigger than a megabyte, a gibibyte about 7.4% bigger than a gigabyte and a tebibyte about 10% bigger than a terabyte.

    Everyday labels often use kilobyte, megabyte and gigabyte loosely, and some software uses them for 1024. That is why the names KiB, MiB and GiB were agreed: they always mean 1024. In IGCSE Computer Science calculations, use 1024 and never 1000, and give the answer in the unit the question asks for. At A level you are also expected to explain the difference between kibi and kilo, and between mebi and mega, gibi and giga, and tebi and tera.

    Check your understanding

    A drive is sold as 500 GB, where GB uses the decimal prefix (1 GB = 1 000 000 000 bytes). A computer reports its size in GiB (1 GiB = 1 073 741 824 bytes). What will the computer show?
    Show the answer

    Answer: C. Less than 500 GiB, because a GiB is bigger than a GB.

    A GiB (1 073 741 824 bytes) is bigger than a GB (1 000 000 000 bytes), so the same drive is a smaller number of GiB: about 465.7. No bytes are missing.

    Stage: Predict

    The size of an image file

    Think it through

    An image is 8 pixels wide and 6 pixels tall, with a colour depth of 2 bits. How many bits does it take, and how many bytes?

    Show what happens

    8 × 6 = 48 pixels, and each takes 2 bits: 48 × 2 = 96 bits. 96 ÷ 8 = 12 bytes.

    The same working finds the size of any image:

    file size in bits = width × height × colour depth.

    Divide by 8 to get bytes, and by 1024 for each larger unit that you need. Do the working in order, and always say which unit the answer is in.

    1. Find the number of pixels. 1024 × 768 = 786 432 pixels.
    2. Multiply by the colour depth. 786 432 × 24 = 18 874 368 bits.
    3. Change bits into bytes. 18 874 368 ÷ 8 = 2 359 296 bytes. (There are 8 bits in a byte.)
    4. Change bytes into KiB. 2 359 296 ÷ 1024 = 2304 KiB.
    5. Change KiB into MiB. 2304 ÷ 1024 = 2.25 MiB, which is the unit that the question asked for.

    A shorter way: 24 bits is 3 bytes, so each pixel takes 3 bytes, and 786 432 × 3 = 2 359 296 bytes. Working in bytes from the start avoids a large multiplication.

    Numbers that are powers of 2 divide cleanly, so no calculator is needed. Work in bytes first, using the bytes for each pixel (colour depth ÷ 8).

    Image file sizes
    Width × heightColour depthSize in bytesSize in KiB
    32 × 328 bits10241
    64 × 648 bits
    1024 × 51216 bits
    512 × 51224 bits

      Show the completed table
      Width × heightColour depthSize in bytesSize in KiB
      32 × 328 bits10241
      64 × 648 bits40964
      1024 × 51216 bits1 048 5761024
      512 × 51224 bits786 432768

      Apply it

      Tom calculates the size of a 64 × 64 image with a colour depth of 8 bits. He writes: “64 × 64 × 8 = 32 768, so the size is 32 768 KiB.” What is wrong?
      Show the answer

      Answer: A. 32 768 is a number of bits. It must be divided by 8 for bytes, then by 1024 for KiB.

      The product is in bits. 32 768 ÷ 8 = 4096 bytes, and 4096 ÷ 1024 = 4 KiB. Tom has the right number, in the wrong unit.

      Stage: Predict

      The size of a sound file

      Think it through

      A fictional recorder takes 1000 samples every second, and each sample is 8 bits. How many bits does it store in 1 second, and in 10 seconds? Which rule do you think follows for any recording?

      Show what happens

      In 1 second: 1000 × 8 = 8000 bits. In 10 seconds: 8000 × 10 = 80 000 bits. The rule: file size in bits = sample rate × sample resolution × length in seconds.

      As with an image, divide by 8 for bytes and by 1024 for each larger unit.

      1. Find the number of samples. 16 000 samples each second × 64 seconds = 1 024 000 samples.
      2. Multiply by the sample resolution. 1 024 000 × 16 = 16 384 000 bits.
      3. Change bits into bytes. 16 384 000 ÷ 8 = 2 048 000 bytes.
      4. Change bytes into KiB. 2 048 000 ÷ 1024 = 2000 KiB, as asked.

      Why this unit? The question asked for KiB. In MiB the answer would be 2000 ÷ 1024 = just under 2 MiB, because 2 MiB is 2048 KiB. The size is the same, written in a different unit.

      The sample rates here are lower than real ones, so that every answer divides cleanly. The length must be in seconds.

      Sound file sizes
      Sample rateSample resolutionLengthSize in bytesSize in KiB
      2048 Hz16 bits32 seconds131 072128
      8000 Hz8 bits128 seconds
      4096 Hz8 bits64 seconds
      1024 Hz16 bits16 seconds

        Show the completed table
        Sample rateSample resolutionLengthSize in bytesSize in KiB
        2048 Hz16 bits32 seconds131 072128
        8000 Hz8 bits128 seconds1 024 0001000
        4096 Hz8 bits64 seconds262 144256
        1024 Hz16 bits16 seconds32 76832

        Apply it

        A fictional voice recorder uses a sample rate of 4096 Hz and a sample resolution of 16 bits. It records for 2 minutes. What is the file size, in KiB?
        Show the answer

        Answer: C. 960 KiB, which is 983 040 bytes ÷ 1024.

        The length has to be in seconds: 2 × 60 = 120. Bits: 4096 × 16 × 120 = 7 864 320. Bytes: ÷ 8 = 983 040. KiB: ÷ 1024 = 960.

        Go deeper Beyond the specification: stereo and real files

        The sound formula describes one channel. A stereo recording has two channels, one for each speaker, so its size is twice as much: sample rate × sample resolution × seconds × 2. The specification gives only the three numbers you have used.

        A real image or sound file is a little bigger than the calculation says, because it also stores a header with details such as the width, height and colour depth. The calculation gives the size of the data itself, which is almost all of the file.

        Stage: Apply

        Use a size to decide

        Apply it

        A fictional memory card holds 90 MiB. Each photo is 1024 × 768 pixels with a colour depth of 24 bits, which the worked example earlier found to be 2.25 MiB. How many photos fit on the card?
        Show the answer

        Answer: C. 40 photos, because 40 × 2.25 = 90 MiB.

        The card’s size is divided by the size of one photo: 90 ÷ 2.25 = 40. Check by multiplying back: 40 × 2.25 = 90 MiB.

        Apply it

        A fictional music app stores every clip in exactly 1 MiB. How many clips fit on a card of 2 GiB?
        Show the answer

        Answer: B. 2048 clips, because 2 × 1024 MiB = 2048 MiB.

        2 GiB = 2 × 1024 = 2048 MiB, and 2048 ÷ 1 = 2048 clips. Always change both sizes into the same unit before comparing or dividing.

        Stage: Consolidate

        Bring it together

        Think it through

        Without looking back, explain to a friend how to find the size of an image of 512 × 512 pixels with a colour depth of 24 bits, and give the answer in KiB.

        Show a model answer

        Pixels: 512 × 512 = 262 144. Bits: 262 144 × 24, or in bytes, 262 144 × 3 = 786 432 bytes (24 bits is 3 bytes). KiB: 786 432 ÷ 1024 = 768 KiB. The unit is KiB because the question asked for it.

        Check your understanding

        Which calculation gives the size of a sound file in bits?
        Show the answer

        Answer: A. sample rate × sample resolution × length in seconds

        Sample rate × sample resolution × length in seconds gives the size in bits. Divide by 8 to find bytes.

        • A bit is one 0 or 1. A nibble is 4 bits and a byte is 8 bits.
        • Storage units go up in steps of 1024: byte, KiB, MiB, GiB, TiB, PiB, EiB. Divide by 1024 to go up a unit, and multiply by 1024 to go down.
        • Kilo, mega, giga and tera are decimal prefixes (1000). Kibi, mebi, gibi and tebi are binary prefixes (1024). In calculations here, use 1024 and not 1000.
        • Image size in bits = width × height × colour depth. Sound size in bits = sample rate × sample resolution × seconds. Divide by 8 for bytes, then by 1024 for each larger unit.
        • Give the answer in the unit the question asks for, and change both sizes into the same unit before comparing them.

        Sources and scope

        • What this lesson is. The ninth lesson of the Data Representation module, written for this site. It teaches points 1 and 2 of Cambridge IGCSE Computer Science 1.3 (measuring data storage and calculating file sizes) against the 2026 to 2028 syllabus (version 6), and the binary prefixes of 9618 point 1.1. Its curriculum links are provisional: no link has been verified by the site owner. They show where the lesson may help with a course and imply no review or endorsement by any examination board.
        • Original material. The phone, the shop’s drive, the recorders, the memory card, the music app and Tom’s working are fictional examples written for this lesson. Image and sound sizes are chosen so that every calculation divides cleanly without a calculator; real recordings use higher sample rates, such as 44 100 Hz.
        • Simplified on purpose. The calculations give the size of the data alone, not of the file with its header. Stereo sound is only in the optional extension. Compression, which changes the size of a file, is in the next lesson.