MyLeoNes™

Data compression: making files smaller — Technology, 14–17 years

Compression stores information using fewer bits. Lossless compression keeps the original exactly; lossy compression removes details people may barely notice, trading some accuracy for a much smaller file.

Less space, same or approximate information

A file often contains patterns: a long run of the same colour or repeated words does not need to be written out every time. Compression records the pattern and how often it occurs. The file becomes smaller, then software reconstructs it when you open or play it.

Why compress data?

Large files take longer to store, download and send, and they use more mobile data. Compression addresses that practical problem by reducing the amount of information that must travel or fit on a disk. The choice depends on whether exact recovery matters more than saving space.

Worked example: repeated symbols

Suppose a simple image row is BBBBBBBBWWRR, with 8 blue, 2 white and 2 red pixels. Instead of storing all 12 symbols, lossless run-length coding stores 8B, 2W, 2R. The pattern is recovered exactly, using six symbols plus counts rather than twelve pixels.

Smaller does not mean free

A reasonable mistake is to assume that compressing a file always makes it smaller again and again. Once the obvious patterns are removed, the remaining data may look random, so there is little left to save; some compressed files even grow because of extra labels and instructions. Lossy compression can also remove detail permanently.

Where compression appears

Streaming services compress video and sound so they can reach you without sending every original bit. JPEG and WebP commonly shrink photographs, while PNG is useful when edges or exact colours must remain clear. ZIP files use lossless methods for documents and groups of files.

Keep exploring

Other languages

Loading MyLeoNes™…