Lossless Compression

Why Compress?

Digital files can be huge. A single photo might be 5 MB. A song might be 30 MB. A movie might be 4 GB. Sending or storing all that data takes time and space.

is the process of reducing the number of bits needed to represent data. The goal: use fewer bits while keeping the information intact.

1000
Original (bits)
400
Compressed (bits)

There are two types of compression:

Original data can be perfectly restored. Nothing is lost. Used for text files, code, and data that must be exact.

Lossy

Some data is permanently removed. Smaller files but not identical. Used for photos, music, and video. (Next lesson!)

This walkthrough focuses on lossless compression. Let's explore how to shrink data without losing a single bit of meaning.