Data storage units and file size calculations

Computer Science · Foundations

Question 1 of 10

0

    A document is 5800 kB. Use 1 kB = 1000 bytes, 1 MB = 1000 kB, 1 GB = 1000 MB and 8 bits = 1 byte. How many bytes is this?

    bytes

    Decimals (0.75 or 0,75), fractions (3/4) and mixed numbers (1 1/2) are accepted. Do not use thousands separators.

    How to type your answer
    • Fractions: 3/4. Mixed numbers: 1 1/2.
    • Decimals with a point or a comma: 0.75 or 0,75.
    • Negative numbers start with a minus: -3/4.
    • Percentages need the % sign: 75%.

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Data storage units and file size calculations explained

    A bit is the smallest unit of storage and holds a single 0 or 1. A byte is 8 bits. Larger units are built from bytes using powers of 1000 in the decimal system used for file sizes:

    • 1 kB (kilobyte) = 1000 bytes
    • 1 MB (megabyte) = 1000 kB = 1,000,000 bytes
    • 1 GB (gigabyte) = 1000 MB = 1,000,000,000 bytes

    Some operating systems report sizes using powers of 1024. Those units are written KiB, MiB and GiB to show the difference.

    The size of an uncompressed image is found from its resolution and colour depth:

    file size (bits)=width×height×bits per pixel\text{file size (bits)} = \text{width} \times \text{height} \times \text{bits per pixel}

    Divide the result by 8 to get bytes, and then by 1000 or 1,000,000 to get kB or MB. Check the units in the question carefully, because a small mistake in units gives a wrong answer by a factor of 8 or 1000.

    Worked example

    Find the size in MB of an uncompressed 1920 × 1080 image with 24 bits per pixel.

    1. Total bits: 1920×1080×24=49 766 4001920 \times 1080 \times 24 = 49\,766\,400 bits.
    2. Bytes: 49 766 400÷8=6 220 80049\,766\,400 \div 8 = 6\,220\,800 bytes.
    3. MB: 6 220 800÷1 000 000=6.22086\,220\,800 \div 1\,000\,000 = 6.2208 MB, so about 6.22 MB.

    Check: 24 bits is 3 bytes per pixel, and 1920×1080×3=6 220 8001920 \times 1080 \times 3 = 6\,220\,800 bytes.

    What you will practise

    New numbers every time you practise. Levels: Easy, Medium, Hard. Each answer is followed by a worked explanation.

    Example questions

    • Easy

      A song file is 42 MB. Use 1 kB = 1000 bytes, 1 MB = 1000 kB, 1 GB = 1000 MB and 8 bits = 1 byte. How many kB is this?

    • Medium

      A sound recording lasts 30 seconds with a sample rate of 16000 Hz, a bit depth of 8 bits and two channels (stereo). Use 1 kB = 1000 bytes, 1 MB = 1000 kB, 1 GB = 1000 MB and 8 bits = 1 byte. Calculate the file size in kB. Give your answer to 2 decimal places if it is not a whole number.

    • Hard

      An image is 800 × 1000 pixels with a colour depth of 32 bits. It is compressed so that the file is 2 times smaller than the uncompressed size. Use 1 kB = 1000 bytes, 1 MB = 1000 kB, 1 GB = 1000 MB and 8 bits = 1 byte. What is the compressed file size in MB? Give your answer to 2 decimal places if it is not a whole number.