Your journey through Compression
Lossy vs lossless, run-length encoding, and the six verbatim examiner traps that catch students year after year. Seven stages from theory to mastery. Click any stage card to dive in โ or continue where you left off.
Where you are in Topic 1.5
Start with Book Notes
Read the theory and terminology to get grounded.
Choose any stage
Green cards are stages you've already visited. Grey cards are new territory. Click any card to jump straight to that stage.
Mistakes
Notes
Stats
Bookmarks
Knowledge Vault
Add entry
Entries
Compression Lab โ lossy vs lossless
Why we compress data, the difference between lossy and lossless, and how run-length encoding shrinks a file.
What is Topic 1.5?
Data compression means reducing the size of a file. This makes it faster to transmit and takes up less storage space. Compression comes in two types: lossy (some data is permanently removed and the original cannot be recovered) and lossless (all data is preserved and the original can be reconstructed).
For lossless, Cambridge specifically require you to know run-length encoding (RLE) โ a technique that replaces runs of identical data with a single value and a count. This is the ONE compression method students need to describe by name and by example.
This is one of the most heavily marked topics on Paper 1. Every recent session has 5โ8 marks on compression. Most lost marks are for confusing "type" with "example", or writing generic definitions when the question asks about a specific context.
By the end of 1.5 you canโฆ
- Define file compression as the process of reducing file size
- State the two types: lossy and lossless
- Distinguish "type" (lossy/lossless) from "example" (MP3, JPEG, PNG, ZIP)
- Explain lossy: some data is permanently removed โ original cannot be recovered
- Explain lossless: all data is preserved โ original can be reconstructed
- Describe run-length encoding (RLE) as a lossless technique that replaces repeated patterns with a value and a count
- Apply RLE to a simple example (e.g. "AAAABBB" โ "4A3B")
- State the benefits: less storage space, faster transmission
- Justify which type to use in a given scenario, tied to the context of the question
Cambridge-approved terms
| Term | Definition |
|---|---|
| File compression | The process of reducing the size of a file (general definition โ applies to both lossy and lossless). |
| Lossy compression | A type of compression where some data is permanently removed. The original file cannot be recovered. |
| Lossless compression | A type of compression where all original data is preserved. The original file can be reconstructed. |
| Run-length encoding (RLE) | A lossless technique that replaces runs of identical data with a value and a count. |
| Type (of compression) | Lossy OR lossless โ the two categories. |
| Example (of compression) | MP3, JPEG, PNG, ZIP โ specific file formats or methods. NOT the same as "type". |
The tables you must know cold
Lossy vs Lossless
| Feature | Lossy | Lossless |
|---|---|---|
| Data removed? | Yes โ permanently | No โ all data kept |
| Original recoverable? | No | Yes |
| File size reduction | Very large (much smaller) | Moderate (smaller, but less than lossy) |
| Quality | Reduced โ may show pixelation, blurring, or lower audio fidelity | Identical to original |
| Use cases | Photos, music, video (small size matters more than perfection) | Text, code, executables, medical images (data integrity is critical) |
| Examples of formats | JPEG (images), MP3 (audio), MPEG (video) | PNG, GIF (images), FLAC (audio), ZIP, RLE (files) |
Rule of thumb: if losing any data would break the file (e.g. a program, a spreadsheet, a document), use lossless. If a small quality drop is acceptable and file size matters more (e.g. streaming music), use lossy.
Run-length encoding (RLE) โ the method
| Step | What to do |
|---|---|
| 1 | Scan the data for runs โ sequences of the same value repeated. |
| 2 | Replace each run with a pair: count (how many times) + value. |
| 3 | Result: shorter file, same information. Original can be reconstructed by expanding each pair. |
RLE works best on data with long runs of the same value โ e.g. simple images with large blocks of a single colour, or text with many repeated characters. It works poorly on data with lots of variety.
Benefits of compression
| Benefit | Why |
|---|---|
| Less storage space | Smaller file โ fits more files on the same disk. |
| Faster transmission | Smaller file โ less data to send โ arrives faster. |
| Lower bandwidth use | Less data over the network โ cheaper / more available. |
Watch each one done step by step
Worked example 1 ยท RLE on a text string
Apply RLE to the string AAAABBBCCDAA.
Worked example 2 ยท RLE on image pixel data
An image row contains 10 white pixels, 4 red, 6 white. Encode using RLE.
Worked example 3 ยท Justifying lossless in context
"A doctor sends an X-ray image by email. Explain why lossless compression is used."
Traps that cost marks every session
Trap ยท Giving an "example" when the question asks for a "type"
This is the #1 compression mistake year after year. Type means lossy or lossless. Example means MP3, JPEG, PNG, ZIP. Read the question โ if it says "type", write lossy or lossless. Never write "MP3" when asked for a type.
Cited: 2024 examiner report โ verbatim: "Many candidates were able to give two correct types of compression. Some candidates gave examples of file types or formats, for example JPEG, rather than types of compression."Trap ยท Defining ALL compression as "removing data"
"Removing data" only describes lossy. If the question asks what file compression is in general, the correct definition is "reducing the size of a file". Lossless compression does NOT remove data โ it reorganises it.
Cited: 2024 examiner report โ verbatim: "Some candidates focused on a particular kind of compression rather that compression in general. For example, stating that it is when data is permanently removed from the file. This would not be true in all examples of file compression."Trap ยท Saying "ZIP" or a file format when asked for a compression METHOD
ZIP is a file format, not a compression method. Cambridge want the METHOD by name โ for lossless, that's run-length encoding (RLE). Say "RLE" and then describe how it identifies and encodes repeated patterns.
Cited: 2025 examiner report โ verbatim: "Some candidates gave a file type or identified zip folders which are not a method of compression."Trap ยท Saying a compressed file is "easier" to send
Compressed = FASTER, not EASIER. The process is the same either way; for the user, an uncompressed file is if anything simpler (no unzipping). Use words like "faster to transmit", "less bandwidth", "less storage" โ never "easier".
Cited: 2022 examiner report โ verbatim: "A common misunderstanding is that a compressed file is 'easier' to send. Easier indicates that there are fewer steps for the user to follow. The process is the same whether the file is compressed, or not compressed."Trap ยท Describing what lossy IS instead of WHY it's not suitable
When Cambridge ask "why is lossy not suitable HERE?" they want a justification tied to the scenario, not a definition. Bad: "lossy removes data permanently". Good: "lossy would remove detail from the X-ray that the doctor needs to see clearly to make a diagnosis".
Cited: 2024 examiner report โ verbatim: "Many candidates just provided a description of what lossy or lossless compression is rather than providing information about why lossy is not suitable."Trap ยท Generic answer that ignores the context (e.g. describing text compression when the question is about an image)
If the question specifies an image, describe how RLE finds runs of pixels of the same colour. If it's a text file, describe how it finds repeated patterns of characters/words. Match your answer to the file type in the question.
Cited: 2025 examiner report โ verbatim: "Many candidates gave a very generic response about a generic file and did not relate their response to the context given in the question. For example, many candidates explained how lossless compression would reduce the size of a text file, by finding repeating words."Mark-scheme templates
These are the exact phrasings Cambridge accept. Learn them.
Check yourself โ tap to reveal (0/6)
Answer these in your head, then tap to see the model answer. Aim for 5 or 6 right before moving on.
AAAABBBCCDAA using RLE.If you can answer 5 of the 6 knowledge checks above, you're ready to move on. Tap ๐ Learn for the interactive theory, then ๐ฎ Activities for the Lossy-or-Lossless sorter and the RLE Challenge.
What is compression?
Definition
Data compression reduces the file size by reducing the number of bits needed to represent the data.
Why compress files?
| Reason | Detail |
|---|---|
| Less storage | Takes up less space on disk/server |
| Faster transmission | Less data to upload/download โ quicker |
| Less bandwidth | Uses less network capacity |
| Email limits | Email services restrict attachment file sizes |
| Less data usage | Important for mobile users with limited data |
Lossy vs Lossless
โก Lossy
Permanently removes data โ cannot be recovered.
Reduces quality (pixelation, blurring, lower audio quality).
Produces smaller files than lossless.
Used when some quality loss is acceptable.
Examples: JPEG, MP3
Bridge: Like a photocopy of a photocopy โ still recognisable, but detail is lost forever.
โ Lossless
Reduces file size without losing any data.
All original data can be recovered exactly.
Produces larger files than lossy (but smaller than original).
Used when exact data must be preserved.
Examples: PNG, ZIP, RLE
Bridge: Like a vacuum bag โ everything is still there, just squashed smaller.
Run-Length Encoding (RLE)
The main lossless compression method on the Cambridge syllabus.
How RLE works
1. Scan the data for repeating sequences (runs of the same value).
2. Replace each run with a (count, value) pair.
3. The compressed data uses far fewer bits.
Quick check
Compression makes files _____ to send.
Activity 1 โ Lossy or Lossless?
Which type of compression is best for this scenario?
Press New Question.
Activity 2 โ Spot the Mistake
Press New Question.
Activity 3 โ RLE Challenge
Encode this sequence using RLE (count,value) pairs.
Press New Question.
Adaptive practice
Press New Question.
Cambridge-style questions
Press New Question.
Review quiz
Press New.
Exam traps
Memory triggers
๐ง "Vacuum bag vs photocopy"
Lossless = vacuum bag (everything preserved). Lossy = photocopy (detail lost each time).
๐ง "Faster not easier"
Every time you write "easier to send" cross it out and write "faster to transmit."
๐ง "RLE = count + value"
Scan for runs of the same thing โ store (how many, what). That's it.