Lossy vs Lossless Compression Explained
Published 3 min readBy SlimMyFile
Every compression method falls into one of two families. Lossless compression makes data smaller and gives back exactly the same data when you open it. Lossy compression makes data much smaller by permanently discarding some information. Knowing which one you are using, and when, is the key to compressing files without regret.
Lossless compression: same data, fewer bytes
Lossless methods find patterns and redundancy and describe them more efficiently. A simple example: instead of storing "white, white, white, white, white", store "5 × white". Real algorithms such as Deflate (used in ZIP, PNG and most PDF streams) are far more sophisticated, but the principle is the same: nothing is thrown away.
Common lossless formats and tools:
- ZIP archives
- PNG images
- Lossless WebP
- FLAC audio
- Most internal data inside PDF files
The limitation is that lossless compression can only remove redundancy. Data that is already compressed, or that is genuinely random-looking, such as a photo’s fine sensor noise, cannot be shrunk much further losslessly.
Lossy compression: discard what matters least
Lossy methods exploit the limits of human perception. JPEG and lossy WebP store fine detail and colour less precisely than brightness, because our eyes notice brightness changes far more. Audio formats like MP3 and AAC remove sounds that are masked by louder ones. The result can be many times smaller than the lossless equivalent.
Common lossy formats: JPEG, lossy WebP, MP3, AAC and most video formats.
The cost is permanent. Once detail is discarded, no tool can bring it back. Opening and re-saving a lossy file repeatedly also causes "generation loss": each pass removes a little more.
A format is not the same as a method
Some formats can hold both kinds of compression, and some tools apply lossy steps before saving to a lossless format. A few examples from SlimMyFile:
- PNG is a lossless format, but PNG colour reduction is lossy: colours are approximated first, then the result is saved losslessly.
- WebP has separate lossy and lossless modes.
- PDF is a container. SlimMyFile’s Low level is fully lossless; Balanced and High re-encode some images with lossy JPEG while leaving text and vectors untouched.
Side-by-side comparison
| Lossless | Lossy | |
|---|---|---|
| Restores the exact original | Yes | No |
| Typical size reduction | Modest, depends on redundancy | Large, adjustable with quality settings |
| Best for | Text, diagrams, screenshots, archives, files you will edit | Photos, audio, video, files for viewing |
| Risk | None to the content | Visible artefacts if pushed too far; generation loss |
How to choose
- Ask whether the file must stay exact. Legal scans, technical drawings, medical images and master copies should stay lossless, or keep a lossless original alongside a lossy copy.
- Ask how it will be viewed. Photos on a screen tolerate lossy compression very well.
- Start with moderate settings, compare the result with the original at full size, and only then go further.
- Keep originals. Compress copies for sharing, and compress from the original each time.
In SlimMyFile, the presets map to this directly: Best quality favours near-invisible changes, Balanced is a sensible middle ground, and Smallest file accepts more visible loss. For PNG, Lossless mode never changes a pixel. Try them in the image compressor or the PNG compressor.
Myths worth dropping
- "Lossless means the file gets dramatically smaller." Often it does not; the gain depends on how much redundancy exists.
- "Lossy always looks worse." At moderate settings, most people cannot tell a well-compressed photo from the original at normal viewing size.
- "Converting a JPEG to PNG makes it lossless again." The JPEG’s losses are already baked in; the PNG is just a larger copy of them.
- "ZIP-ing a JPEG or PDF will shrink it a lot." Both are already compressed internally; ZIP usually saves very little.
Frequently asked questions
Is "visually lossless" the same as lossless?
No. "Visually lossless" describes lossy compression whose changes are not noticeable under normal viewing. The data is still different from the original.
Which SlimMyFile options are lossless?
PNG output in Lossless mode without resizing, and the Low level of the PDF compressor. Resizing always changes pixels, and the other modes involve lossy re-encoding, which SlimMyFile only keeps when it actually reduces the size.
Try it with SlimMyFile
Compress Images
Batch-compress JPG, PNG and WebP with full control.
Open toolCompress PNG
Lossless optimisation or smart colour reduction.
Open toolCompress PDF
Shrink PDFs by optimising images and internal structure.
Open toolRelated guides
- Images
JPG vs PNG vs WebP: Which Image Format Should You Use?
A practical comparison of JPEG, PNG and WebP: compression type, transparency, compatibility and the best format for photos, screenshots and logos.
4 min readRead guide - Images
How to Compress JPG Images Without Noticeable Quality Loss
How JPEG quality settings work, which values to choose for web, email and print, and the mistakes that make photos look blocky.
4 min readRead guide - PDF
Why Some PDF Files Cannot Be Compressed Further
Already-optimised images, fonts, vector artwork and encryption: the real reasons a PDF refuses to shrink, and what you can still do.
3 min readRead guide