💻 Computer Science · Topic 15 of 97

Compression

Compression reduces file size so that files take less storage and transfer faster.

▶ Interact

Play with the controls to see the idea in action.

Loading animation…

📘 Learn

Compression reduces file size so that files take less storage and transfer faster.

  • Lossy compression removes some data
  • Lossless compression keeps all data
  • JPEG is lossy and PNG is lossless

🧠 Quick quiz

Three questions. Score 2 or more to complete the topic.

What is Compression?

Within Computer Science, which covers algorithms, programming, data, networks, hardware and safe, responsible use of technology, this topic explains Compression. Computing topics explain how software, hardware and data work, with diagrams and models that show each step in order.

Check that you can explain Compression in your own words and give one example from everyday life. If you can do that, you have understood the core idea.

Understanding Compression helps you design, test and explain programs, websites and systems, from small projects to exam questions.

Compression in detail

Compression reduces file size so that files take less storage space and are quicker to send. Lossy compression permanently removes some data that people are unlikely to notice, such as in JPEG images and MP3 audio, giving smaller files but a loss of quality that cannot be recovered.

Lossless compression reduces size without losing any data, so the original can be rebuilt exactly, as in ZIP and PNG files. Methods include run-length encoding, which replaces repeated data with a count (AAAAA becomes 5A), and dictionary-based methods. Lossless suits text and programs, while lossy suits media where small losses are acceptable.

How the interactive helps you understand Compression

Click a step, or use the Previous and Next buttons, to move through the sequence one stage at a time. Auto-play moves on for you.

Before you change anything, predict the result. Then change one value at a time and check whether your prediction was right. This is a quick way to build a correct mental model of Compression.

Real-life uses and examples

Common mistakes to avoid

Frequently asked questions about Compression

What is Compression?

Compression reduces file size so that files take less storage and transfer faster.

What are the most important points about Compression?

The main points are: Lossy compression removes some data; Lossless compression keeps all data; JPEG is lossy and PNG is lossless.

Why is Compression useful?

Understanding Compression helps you design, test and explain programs, websites and systems, from small projects to exam questions.

How can I practise Compression?

Open the interactive at the top of this page and change the controls one at a time. Predict the result before each change, then take the three-question quiz. A score of two or more marks the topic as complete on this device.

Which topics are related to Compression?

Related topics in Computer Science include Algorithms, Decomposition and Abstraction, Variables and Data Types.

← PreviousUnits of DataNext →Logic Gates

Keep exploring Computer Science