Packing a lunchbox two very different ways
Pick a meal, run it through the compression machine both ways, and see exactly what "smaller" costs you — nothing, or a few ingredients you'll never get back.
Select a meal, then choose a compression method to see it move through the machine.
| Metric | Original | Lossless | Lossy |
|---|---|---|---|
| Size | — | — | — |
| Compression Ratio | — | — | — |
| Quality | Original | — | — |
| Recover Original? | — | — | — |
Hover or focus for details.
Hover or focus for details.
Hover either badge above to see how it works and where it's used.
Drag each file type into the compression method you think it uses in real life.
"Pack the meal more efficiently without removing any ingredients."
"Make the meal smaller by removing ingredients that are considered less important."
Why the lunchbox actually works as a model
Compression means representing the same information using fewer bits. Every file — a photo, a song, a spreadsheet — is just data sitting on disk, and compression algorithms find patterns and redundancy in that data so it can be stored or transmitted using less space. What differs between algorithms is what they're willing to sacrifice to get there.
Lossless compression never sacrifices anything. It works by re-organizing data more efficiently — spotting repeated patterns and representing them more compactly — the same way neatly folding a wrap and stacking ingredients in a lunchbox takes less room without leaving anything out. Real algorithms like Huffman coding and run-length encoding do exactly this: they give short codes to common patterns and long codes to rare ones, then reverse the process perfectly on the way back out. That's why it's the only acceptable choice for text files, program code, and spreadsheets — a single flipped bit in a spreadsheet formula or a line of code isn't "close enough."
Lossy compression takes a different bet: it permanently throws away the details a human is least likely to notice, in exchange for a much bigger size reduction. A JPEG image discards color detail your eye is less sensitive to; an MP3 discards frequencies your ear barely perceives — the digital equivalent of quietly removing the lettuce nobody was going to comment on. Once those details are gone, there's no reconstructing them — the "restored" burger is not the original burger, just a very convincing one.
Neither approach is strictly better — they're solving different problems. You'd never accept a lossy compression on a bank statement, and you'd rarely notice (or want the file size of) a lossless 4K video. Choosing between them is really choosing what's actually important to preserve in the data you're storing.