Skip to content
Compression basics

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

LosslessLossy
Restores the exact originalYesNo
Typical size reductionModest, depends on redundancyLarge, adjustable with quality settings
Best forText, diagrams, screenshots, archives, files you will editPhotos, audio, video, files for viewing
RiskNone to the contentVisible artefacts if pushed too far; generation loss

How to choose

  1. 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.
  2. Ask how it will be viewed. Photos on a screen tolerate lossy compression very well.
  3. Start with moderate settings, compare the result with the original at full size, and only then go further.
  4. 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.