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
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
- Resize to the largest size the image will actually be displayed at.
- Pick the format for the content: JPG, WebP or AVIF for photos, PNG or lossless WebP for screenshots and graphics.
- Compress with a visually lossless target, or use Lossless Compressor if every pixel must stay identical.
- Compare against the original at 100 percent zoom before replacing anything.
Tools in this guide
- Smart OptimizerNewFinds the smallest file that still looks identical to your original, measured with SSIM instead of guessing a quality number.
- Lossless CompressorMake PNGs smaller without changing a single pixel using OxiPNG, and strip bloat from JPG and WebP.
- Compress ImageShrink JPG, PNG, WebP, AVIF and GIF files with MozJPEG, OxiPNG and modern codecs, with a live before/after preview.
- Compare ImagesSlider, side-by-side and difference views with SSIM and PSNR scores.
- Format Shoot-outNewEncodes your image as JPG, WebP and AVIF at the same visual quality and keeps the smallest one.
Related guides
- How to compress an image without uploading it
- How to compress PNG files (and when PNG is the wrong format)
- How to reduce JPG file size
- How to compress an image to an exact size in KB