Skip to content

Lossy vs lossless compression: how to shrink images without visible loss

What each kind of compression throws away, which formats use which, and a practical routine for making images smaller without anyone noticing.

Compression · 2 min read · Updated

Ready to try it? Open Smart Optimizer. It runs in your browser, with no upload.Open tool

Lossless: nothing is thrown away

Lossless compression stores an image more efficiently without changing any pixel. Decode the file and you get back exactly the pixels that went in. PNG, lossless WebP and the lossless modes of AVIF and JPEG XL work this way. Removing metadata is lossless too, when it is done by cutting the metadata blocks out of the file instead of re-encoding the image.

The catch is that the savings are limited. A lossless photo is still large, because photographic detail looks almost random to a compressor.

Lossy: detail you are unlikely to notice is discarded

Lossy formats such as JPG, lossy WebP and AVIF throw away information the eye is least sensitive to: fine colour detail, tiny variations in texture and high-frequency noise. At sensible settings the result looks the same at normal viewing size and is many times smaller than a lossless copy.

The loss is permanent and it accumulates. Each time a lossy file is edited and saved again, a little more detail goes. Keep originals and export from them.

Which formats do what

  • JPG: always lossy.
  • PNG: always lossless. Reducing the palette before saving is a lossy step, even though the PNG file itself is lossless.
  • WebP, AVIF and JPEG XL: lossy or lossless, chosen when the file is saved.
  • GIF: lossless storage, but limited to 256 colours per frame, so turning a photo into a GIF loses colour.

Visually lossless: the practical middle ground

Most people asking for compression without quality loss want files that look the same, not files that are identical bit for bit. Smart Optimizer is built for that. It encodes your image at several quality levels and keeps the smallest one whose SSIM, a structural similarity score from 0 to 1, stays above the level you pick: Visually identical, Very close or Smaller still. If it cannot beat your original, the original is kept.

SSIM models what people tend to notice, but it is not a guarantee. Check faces, text and smooth gradients yourself. Compare Images shows a slider, side by side and difference views with SSIM and PSNR scores.

A routine that works

  1. Resize to the largest size the image will actually be displayed at.
  2. Pick the format for the content: JPG, WebP or AVIF for photos, PNG or lossless WebP for screenshots and graphics.
  3. Compress with a visually lossless target, or use Lossless Compressor if every pixel must stay identical.
  4. Compare against the original at 100 percent zoom before replacing anything.

Tools in this guide

All guides