Bitmap File Size Simulator
Calculate image file size from resolution and colour depth, with a live preview of how colour depth changes the image.
Image settings
Change the resolution and colour depth. The file size updates instantly.
24 bits → 2^24 = 16,777,216 colours
Preview with millions of colours (shown at a reduced resolution). Lower the depth to see banding.
Working
File size = width × height × colour depth (in bits). Divide by 8 for bytes.
- 1. Pixels = 640 × 480 = 307,200
- 2. Bits = 307,200 × 24 = 7,372,800 bits
- 3. Bytes = 7,372,800 ÷ 8 = 921,600 bytes
- 4. KiB = 921,600 ÷ 1024 = 900
- 5. MiB = ÷ 1024 again = 0.879
Same image, different colour depths
| Depth | Colours | File size |
|---|---|---|
| 1-bit | 2 | 37.5 KiB |
| 2-bit | 4 | 75 KiB |
| 4-bit | 16 | 150 KiB |
| 8-bit | 256 | 300 KiB |
| 16-bit | 65,536 | 600 KiB |
| 24-bit | 1.68e+7 | 900 KiB |
| 32-bit | 4.29e+9 | 1.17 MiB |
About This Simulation
This bitmap file size simulator calculates how much storage an image needs from its resolution (width × height in pixels) and its colour depth (bits per pixel). It shows every step of the working and a live preview of how fewer bits per pixel reduce the number of colours.
Features
- Width, height and any colour depth from 1 to 32 bits, with presets from icons to 4K
- Step-by-step working: pixels, bits, bytes, KiB/kB and MiB/MB
- Switch between 1024-based (KiB) and 1000-based (kB) units
- Live preview showing banding at low colour depths
- Table comparing the same image at every colour depth
Topics covered
- Bitmap Images
- Pixels and Resolution
- Colour Depth
- File Size Calculation
- Binary Prefixes (KiB, MiB)
Explanation
A bitmap image is a grid of pixels. Each pixel stores a colour as a binary number, and the number of bits used per pixel is the colour depth. With a colour depth of n bits, 2ⁿ different colours can be shown. The file size depends only on how many pixels there are and how many bits each one uses.
How it works
- Count the pixels: width × height. A 640 × 480 image has 307,200 pixels.
- Multiply by the colour depth to get the number of bits: 307,200 × 24 = 7,372,800 bits.
- Divide by 8 to get bytes: 7,372,800 ÷ 8 = 921,600 bytes.
- Divide by 1024 for kibibytes (KiB) and again for mebibytes (MiB), or by 1000 for kilobytes and megabytes if the question uses denary prefixes.
- To find the colour depth needed for c colours, use the smallest n where 2ⁿ ≥ c. For 100 colours, 2⁷ = 128, so 7 bits.
Why it matters
File size calculations appear in almost every Cambridge IGCSE and AS Level paper. Understanding the trade-off between image quality (resolution and colour depth) and file size also explains why images are compressed before being sent over the internet.
Frequently Asked Questions
What is the formula for bitmap file size?
File size in bits = width in pixels × height in pixels × colour depth in bits. Divide by 8 for bytes, then by 1024 for KiB.
What is the difference between KB and KiB?
A kilobyte (kB) is 1000 bytes and a kibibyte (KiB) is 1024 bytes. Cambridge syllabuses use KiB, MiB and GiB for the binary (1024) prefixes.
Why is a real image file bigger than my calculation?
Files also store a header with metadata such as the width, height, colour depth and sometimes a colour palette. Exam questions usually ignore this unless they mention it.
How does colour depth affect image quality?
More bits per pixel means more possible colours, so gradients look smoother and colours more accurate. Fewer bits cause visible banding but make the file smaller.
Related Simulations
Data Representation
Sound File Size Simulator
Calculate audio file size from sample rate, bit depth, channels and duration, and see sampling, quantisation and aliasing on a wave.
Data Representation
Compression Simulator
Compare lossless dictionary compression of text with lossy compression of an image, and see the size saved and the data lost.
Data Representation
Run-Length Encoding Simulator
Compress text or a black-and-white image with run-length encoding, step by step, and compare the sizes before and after.
Data Representation
Huffman Coding Simulator
Build a Huffman tree from character frequencies one merge at a time, read off the prefix codes and compare the bits with ASCII.

