69 exam-style questions plus unlimited generated ones on this topic, at up to four difficulty levels, with full mark schemes. Notes and past-paper booklets are open to everyone. Practice needs a free account.
Or take a quick quiz: 11 questions on this subtopic in GCSE Computer Science (OCR), marked as you tap.
Why files are compressed, and the differences between lossy and lossless compression, including which type suits a given file or situation. Expect definitions, 'describe the differences' and 'which type should be used, and why?' questions.
Key facts
Compression: reducing the size of a file
Why: less storage, faster transfer, less bandwidth, less buffering
Lossy: permanently removes data; the original cannot be restored; much smaller files
Lossless: no data lost; the original can be reconstructed exactly; smaller reduction in size
Lossy for photos, music and video (JPEG, MP3, MP4)
Lossless for text, program code, executables and spreadsheets (ZIP, PNG)
Notes
Why compress files
Compression reduces the size of a file.
Smaller files take up less storage space, so more files fit on a device.
Smaller files are quicker to upload, download and send; they use less bandwidth and less of a mobile data allowance, and streamed video and music buffer less.
Email services and websites often limit the size of attachments and uploads, so compression can help a file fit.
Lossy compression
Lossy compression permanently removes some of the data, usually detail that people are least likely to notice (e.g. tiny differences in colour, or sounds that are hard to hear).
The original file cannot be recovered from the compressed file.
It usually reduces the file size much more than lossless compression.
It is used for photos (e.g. JPEG), music (e.g. MP3) and video (e.g. MP4), especially for streaming and web pages.
Too much lossy compression causes a noticeable drop in quality, e.g. blurry or blocky images.
Lossless compression
diagram
Lossless compression reduces the file size without losing any data: the original file can be reconstructed exactly.
It works by finding patterns and repetition and storing them more efficiently, e.g. recording a run of 50 identical pixels once, with a count, instead of 50 times.
Lossless: a run of repeated pixels is stored once with a count, and the original is rebuilt exactly
It usually reduces the file size less than lossy compression.
It is used where every bit matters: text documents, program code, executable files, spreadsheets, and images with sharp edges or text (e.g. PNG). ZIP files are lossless.
How to answer each type of question
Give reasons for compressing files
1 to 2 marksGrade 3
Start with 'it reduces the file size'.
Then give the benefit linked to the situation: storage, sending time, bandwidth or size limits.
Example. Give two reasons why a file might be compressed before it is sent by email. [2]
Show the model answerHide the model answer
It reduces the file size, so it is quicker to upload and download (1). It may then be under the maximum attachment size allowed by the email service (1). Also accept: it uses less storage space / less bandwidth.
Explain the differences between lossy and lossless
4 marksGrade 5
Describe lossy: some data permanently removed; the original cannot be restored.
Describe lossless: no data lost; the original can be reconstructed exactly.
Compare the size reduction: lossy usually gives smaller files.
Write about both types: describing only one limits your marks.
Example. Explain two differences between lossy and lossless compression. [4]
Show the model answerHide the model answer
Lossy compression permanently removes some of the data (1), whereas lossless compression keeps all of the data (1). A lossy file cannot be restored to the original, whereas the original can be reconstructed exactly from a lossless file (1). Lossy compression usually reduces the file size by more than lossless (1).
Choose lossy or lossless for a file and justify
2 marks per fileGrade 6
State the type for each file.
Justify it using the file: must it stay exactly the same, or is a small loss of quality acceptable?
Example. A student is sending two files to a friend: (a) a Python program they have written, and (b) a 10-minute video of a football match. For each file, state which type of compression should be used and justify your choice. [4]
Show the model answerHide the model answer
(a) Lossless (1). Any change to the code could stop the program working, so it must be restored exactly
(1).
(b) Lossy (1). The video file is very large and lossy compression makes it much smaller; the small loss of quality will hardly be noticed
(1).
Discuss compression choices in a scenario
4 to 6 marksGrade 8
Identify each use of the file and what matters most for it (quality, speed, storage).
Recommend a type for each use.
Justify each recommendation with an advantage and admit its drawback where relevant.
Example. A photographer takes high-quality photos that a client will print as large posters. She also puts smaller versions of the same photos on her website. Discuss the type of compression she should use for each purpose. [4]
Show the model answerHide the model answer
For the posters, lossless compression (1), because every detail is needed and any loss of detail would be visible when the photo is printed large (1). For the website, lossy compression (1), because the much smaller files load faster for visitors and use less bandwidth, and the small loss of detail is hard to see on a screen (1).
Don’t lose marks
Saying lossy compression 'deletes part of the picture'. It removes fine detail across the whole file, not a chunk of it.
Saying a lossy file can be decompressed back to the original.
Choosing lossy for text or program code: changing even one character could change the meaning or stop the program working.
Saying 'it saves space' for both types without explaining how they differ in the amount saved and the cost to quality.
Ask: 'Must the file come back exactly the same?' Yes (text, code, programs) → lossless. No, a little lost detail is fine (photos, songs, videos) → lossy.
A lossy file is like a summary of a book: shorter, but you can't get the exact original back from it.
Exam technique
For 'which type' questions, link the reason to the file: 'the code must stay exactly the same or it will not run'.
Use the key phrases 'permanently removes data' (lossy) and 'the original can be reconstructed exactly' (lossless).
In 'differences' questions, write about both types, ideally joined with 'whereas'.
What each grade needs
What you need to be able to do, from the first marks up to the top grade.
Grade 3
State why files are compressedTo make files smaller, so they take up less storage space and are quicker to send.
Grade 4
Define lossy and lossless compressionLossy permanently removes some data; lossless reduces the file size without losing any data.
Grade 5
Give suitable uses of each typeLossy: photos, music and video; lossless: text, program code and spreadsheets.
Grade 6
Choose a compression type for a filePick lossy where a small loss of quality is acceptable and lossless where the file must stay exactly the same.
Grade 7
Explain advantages and disadvantages of each typeLossy gives much smaller files but loses quality; lossless keeps every bit but saves less space.
Grade 8
Evaluate compression choices in a scenarioWeigh storage, download time, bandwidth and the quality the user needs.
Quick recall
Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.
A student is sent a compressed file by email. State what the student must do to the file before they can use it.
Decompress (extract or unzip) the file.
Give one disadvantage of using lossy compression.
Some data is lost for good, so the original cannot be recovered.
Give one disadvantage of using lossless compression instead of lossy compression.
The file is not made as small as it would be with lossy compression.
State one thing that lossy compression may remove from a sound file.
Sounds that humans cannot hear.
State one way that lossy compression can make an image file smaller.
It reduces the number of colours (or the number of pixels).
Sample questions
Written for this site in the style of OCR exam questions. They are not taken from real past papers.
Question 1Easy3 marks
(a) State one reason why files are compressed.
[1]
(b) Which type of compression permanently removes some of the data? Tick (✓) one box.
[1]
Lossless
Both lossy and lossless
Neither
Lossy
(c) Give one example of a file format that uses lossy compression.
[1]
Show the answer and mark scheme
(a)
to reduce the file size, so it takes up less storage space / is quicker to send or download
(b)Answer: Lossy
(c)
JPEG / MP3 / MP4 / AAC
Question 2Medium4 marks
Describe the differences between lossy and lossless compression.
[4]
Show the answer and mark scheme
lossy compression permanently removes some of the data
the original file cannot be restored exactly from a lossy file
lossless compression does not lose any data
the original file can be reconstructed exactly from a lossless file
lossy compression usually reduces the file size by more than lossless
lossy compression removes detail that people are least likely to notice
Question 3Hard4 marks
A company’s website uses lossless compression for its logo but lossy compression for the photographs on its product pages.
Explain why the company uses different types of compression for these images.
[4]
Show the answer and mark scheme
the logo has sharp edges / text / a few flat colours
lossy compression could blur the edges / create visible marks (artefacts) / change the exact brand colours
lossless keeps the logo exactly as designed, and its file is small anyway
photographs have large file sizes with many colours
lossy compression reduces them much more, so the pages load faster
the small loss of detail in a photograph is hard to notice