Compression: making files smaller
Photos, songs and videos would fill your phone in days without compression. Compression shrinks files so they take less storage and travel faster across the internet.
Why compress?
Smaller files take up less storage space, upload and download faster, and use less of your mobile data.
Streaming video would be almost impossible without it.
Lossless and lossy
| Type | How it works | Used for | Examples |
|---|---|---|---|
| Lossless | no data is lost: the original can be rebuilt exactly | text, program code, spreadsheets, images that need exact detail | ZIP, PNG |
| Lossy | some data is removed for good, usually detail people are unlikely to notice | photos, music, video | JPEG, MP3 |
Run-length encoding (RLE)
A row of pixels: WWWWBBBWWW (W = white, B = black)
becomes 4W3B3W: 10 characters shrink to 6.
RLE works well when there are long runs, such as simple images with large areas of one colour. With no repeats it can make the data bigger: ABCD becomes 1A1B1C1D.
Compress BBBBBBWWBBBBBBBB with run-length encoding. How many characters are saved?
- Count the runs: 6 Bs, 2 Ws, 8 Bs.
- Write each as count then value: 6B2W8B.
- Original: 16 characters. Encoded: 6 characters.
Answer: 6B2W8B, saving 10 characters
Compression makes files smaller. Lossless compression (ZIP, PNG, RLE) keeps every bit so the original can be rebuilt; lossy compression (JPEG, MP3) removes detail for good to make files much smaller.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Internet
- A worldwide network of networks. It is the hardware: cables, routers and connected computers.
- Bit
- A binary digit: a single 0 or 1. The smallest unit of data.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
Compress BBBBWWWBBB with run-length encoding.
Show the answer
Answer: 4B3W3B
Count each run: 4B3W3B.
Decompress 3W2B3W to get the original pixels.
Show the answer
Answer: WWWBBWWW
3 Ws, 2 Bs, 3 Ws: WWWBBWWW.
Check you have got it
Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.