100 KB
25 KB

How Compression Works

Why are some files tiny and others huge? Discover how computers shrink data without losing what matters.

1

Run-Length Encoding

The simplest compression: count repeated values instead of listing each one.

100
Original Values
20
Compressed Entries
Fun Fact
Run-length encoding was used to compress fax transmissions in the 1960s. A page with lots of white space compressed extremely well!
2

Dictionary Compression

Replace repeated words and patterns with short codes. The more repetition, the better!

Original Text
Compressed (Dictionary)
Code Word Saved
0
Original Bytes
0
Compressed Bytes
0%
Reduction
Did You Know?
ZIP files use a similar technique called LZ77. It was invented in 1977 and is still used today in PNG images, PDF files, and most archives!
3

Lossy vs Lossless

Some compression is reversible. Some isn't. Know the difference!

💾 Lossless

Perfect reconstruction. Decompress and get back exactly what you started with. Every bit is preserved.

ZIP PNG FLAC GIF RAR
Original → Compress → Decompress
"Hello World!" → [compressed] → "Hello World!"
🎨 Lossy

Smaller files by throwing away "unimportant" data. You can't get back the original, but often you can't tell the difference.

JPEG MP3 MP4 AAC WebP
Original → Compress → Decompress
"Hello World!" → [compressed] → "Helo Wrld!"
MP3 Secret
MP3 removes frequencies your ears can barely hear. A 128kbps MP3 is about 11x smaller than the original CD audio, yet most people can't tell the difference!
4

Image Compression

See how JPEG quality affects file size and visual detail.

Preview at current quality
JPEG Quality 80%
24 KB
Estimated Size
76%
Size Reduction
JPEG Trick
JPEG works by converting images to frequency data (like sound!) and removing high-frequency details. That's why heavily compressed JPEGs look "blocky" - the fine details are gone.
5

Audio Compression

Hear the difference between bitrates. Higher = better quality but bigger files.

32 kbps
Very Low
~240 KB/min
128 kbps
Standard
~960 KB/min
256 kbps
High Quality
~1.9 MB/min
320 kbps
Best MP3
~2.4 MB/min
🔊 Click a card to hear the difference. Lower bitrates remove more audio data, resulting in "muddy" or "underwater" sound.
Spotify Streams
Spotify's "Very High" quality is 320kbps. Their "Normal" quality is 96kbps - using 3x less data but still decent for casual listening!

You're a Compression Expert!

Now you understand how computers make files smaller - from simple pattern detection to complex lossy algorithms.

0
Patterns Compressed
0
Quality Levels Tested
0
Time Exploring

Patterns Compress

Repeated data can be replaced with shorter codes. More patterns = better compression.

Lossless is Reversible

ZIP, PNG, and FLAC preserve every bit. Perfect for text, code, and archiving.

Lossy Saves Space

JPEG, MP3, and MP4 throw away "unimportant" data for much smaller files.

Quality vs Size

There's always a tradeoff. Choose based on how the file will be used.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction