GCSE · Computer Science · AQA · Spec 8525
Bitmap file size calculation
Zoom into a digital image and it breaks into tiny squares, each stored as a short binary code. Know the code's length and you can size the whole image.
Computer Science · Bitmap images
Paint it however you like. Watch the file size.
Four colours, four 2-bit codes: 00 is white, 01 is yellow, 10 is black and 11 is red. The grid is 8 pixels wide and 8 pixels high, so that's 64 pixels, and every one of them stores a 2-bit code. That code length, the number of bits per pixel, is called the colour depth. 64 × 2 = 128 bits, and 128 ÷ 8 = 16 bytes. Go on, repaint the whole face. The number won't budge.
Computer Science · Colour depth
Why each extra bit doubles the colours
Every bit is a two-way choice: 0 or 1. Walk down the tree, build a 3-bit colour code, then count how many different codes there are. More than you'd guess?
1st bit → 2nd bit → 3rd bit
Each bit you add is a new choice: 0 or 1.
2 × 2 × 2 = 8 different 3-bit codes, and the tree ends 8 times.
Keep going and the pattern never breaks: 4 bits give 16 colours and 8 bits give 256. Each new bit splits every existing code in two, so n bits give 2ⁿ different colours.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Count the pixels, multiply by the bits each one uses, then divide by 8 for bytes.
What you need to know
- A bitmap image is a grid of tiny squares called pixels (short for picture elements).
- Each pixel's colour is stored as a binary code.
- Image size is width in pixels × height in pixels, so 100 × 50 pixels is 5000 pixels.
Have a goA tiny emoji is 12 pixels wide and 12 pixels high. How many pixels is that?
144 pixels.
12 × 12 = 144. Adding gives 24, which only counts along two edges, not the squares inside the grid.
- Colour depth is the number of bits used to store the colour of each pixel.
- With a colour depth of n bits you get 2ⁿ different colours: 1 bit gives 2, 8 bits give 256.
Have a goYour mate is certain 4 bits give 8 colours, "because each bit adds two". How many colours do 4 bits really give?
16 colours.
2⁴ = 2 × 2 × 2 × 2 = 16. Each bit doubles the number of codes; adding 2 per bit undercounts badly.
- File size in bits = width × height × colour depth.
- Want bytes? Divide the bits by 8, because 1 byte = 8 bits.
Have a goAn image comes out at 640 bits. Before you calculate: will the answer in bytes be a bigger or a smaller number? Then find it.
Smaller: 640 ÷ 8 = 80 bytes.
A byte holds 8 bits, so there are always fewer bytes than bits. Multiplying by 8 would go the wrong way.
- More pixels or a bigger colour depth means a bigger file. Cut either and the file shrinks.
The big picture
A bitmap image is a grid of pixels, and each pixel's colour is stored as a binary code. Every code in the image is the same length, and that length is the colour depth. File size in bits = width × height × colour depth; divide by 8 to get bytes. A colour depth of n bits gives 2ⁿ colours. More pixels or more bits per pixel means a bigger file, and fewer means a smaller one.
Key points
Worked example
Problem
An image is 40 pixels wide and 25 pixels high, and it can show 16 different colours. Calculate its file size in bytes.
⚠ Watch out
Putting the number of colours into the formula instead of the colour depth. It feels natural, because the question often gives you the colours. But for a 256-colour image you multiply by 8 (the bits per pixel), not by 256.
Memory hook
Count them, cost them, byte them: count the pixels (width × height), cost them (× bits per pixel), then byte them (÷ 8).
Check yourself
A 10 × 10 image can show 8 colours. What is its file size in bits? (Answer: 8 = 2³, so 3 bits per pixel; 100 × 3 = 300 bits.)
Flashcards
(12)What is a pixel?
How is the colour of each pixel stored?
How do you work out the image size of a bitmap, in pixels?
What is colour depth?
How many colours can a colour depth of n bits represent?
How many colours does a colour depth of 8 bits give?
What colour depth do you need for 32 colours?
What is the formula for the file size of a bitmap image in bits?
How do you turn a file size in bits into bytes?
An image's width and height are both doubled. What happens to its file size?
An image's colour depth is doubled but its size in pixels stays the same. What happens to its file size?
Does repainting pixels in different colours change a bitmap's file size?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.