fundamentals · 5 min read
Lossy vs lossless compression: what actually changes?
Lossy compression discards detail that is hard to notice, so files become much smaller. Lossless compression keeps every original bit and only removes redundancy, so the file can be restored exactly but stays larger.
The right choice depends on what the file is for. Photographs, streaming audio and delivery video almost always use lossy compression, while archives, logos, text, medical images and intermediate editing files need lossless or uncompressed data.
What lossless compression actually does
Lossless compression looks for repetition in the data and stores it more efficiently. A ZIP archive is the familiar example: the tool finds repeated byte patterns, writes shorter references to them, and the original comes back byte-for-byte when the archive is unpacked. PNG, GIF, lossless WebP, lossless AVIF, FLAC, Apple Lossless and the Flate streams inside a PDF all work on the same principle.
Because nothing is discarded, the savings depend entirely on the content. Flat color, repeated rows of pixels and silent audio compress extremely well. A noisy photograph or a hissing recording has little pattern to exploit, so its lossless file may barely shrink compared with the raw data. Lossless is the safe default for anything that will be edited again.
What lossy compression throws away
Lossy compression uses models of perception. JPEG divides an image into blocks, transforms them and rounds the high-frequency detail the eye is least likely to notice. MP3 and AAC remove quiet sounds that louder sounds would mask at the same moment. Video codecs predict each frame from earlier ones and spend more bits on whatever changes.
The quality slider controls how aggressively that rounding happens. A high setting keeps more detail and produces a larger file; a low setting saves space and starts to show blocking, ringing, smearing or a swishy sound. There is no lossless setting on a JPEG or MP3 encoder, only a point where the damage is hard to hear or see.
Audio and video usually expose a bitrate instead of a percentage. A higher bitrate gives the encoder more room to describe each second of sound or video, while a lower one forces it to simplify. Variable bitrate spends data where it is needed and saves it during quiet or static scenes, which is why two files with the same average bitrate can look different.
Generation loss: why re-saving hurts
Every lossy decode and re-encode is another round of discarding. Save a JPEG at quality 90, open it and save again at quality 90, and the second file is not the same quality as the first. The first round's artifacts are now part of the input, and the encoder adds its own on top. Repeat that a few times and the image visibly softens.
The same applies to audio and video. Editing and exporting a clip through several apps can degrade it even when each export looks acceptable on its own. The fix is to keep a master file and derive delivery copies from it, and to use lossless intermediates or stream copying rather than re-encoding at every step.
When lossless is worth the space
Use lossless when the file is a source or when the content is defined by sharp edges and text. Logos, icons, screenshots, charts and anything with transparency belong in PNG or lossless WebP. Audio that will be mixed or mastered belongs in WAV or FLAC, and video that will be edited belongs in an all-intra or high-bitrate format rather than a delivery codec.
- Archives and master copies that must survive future edits.
- Logos, screenshots, diagrams and text-heavy graphics.
- Audio sessions before mixing and mastering.
- Print files and documents where exact pixels matter.
- PDF text and vector content, which stays lossless even when embedded images are compressed.
How to read a quality slider
A quality slider is not a universal scale. A JPEG at 85, a WebP at 80 and an AVIF at 60 can look similar while producing very different file sizes, so compare the result at 100 percent zoom and inspect the smallest detail that matters, such as fine print or thin lines.
Two modest steps usually beat one extreme step: resize an image first, then compress it at a sensible quality, and keep the original for the next time it is needed. For PDFs, text and vector shapes are normally compressed losslessly while embedded photos are the part a compressor downsamples or re-encodes. That is why a text-heavy document barely changes while a scan of the same page count can shrink dramatically. Whatever you choose, keep a copy of the original: compression is easy to repeat later, but it is impossible to undo.