Lossy vs Lossless Compression Explained
Lossless compression makes a file smaller without losing any data. When you open the file again, you get back exactly what you started with. Lossy compression makes a file much smaller by throwing away detail that people are unlikely to notice. That detail is gone for good.
In our test below, a photo saved as a lossless PNG was 4,776 KB. The same photo saved as a lossy JPG was 393 KB, about 12 times smaller, and looked almost the same at normal size.
Lossy vs lossless at a glance
| Lossless | Lossy | |
|---|---|---|
| Data lost | None | Some, and it cannot be recovered |
| File size | Larger | Much smaller |
| Quality setting | No, the result is always exact | Yes, you choose how much to keep |
| Saving again and again | No loss | A little more loss each time |
| Image formats | PNG, lossless WebP, GIF | JPG, lossy WebP |
| Other examples | ZIP files, FLAC audio | MP3 audio, most video |
| Best for | Logos, screenshots, text, files you will edit | Photos and video for sharing or the web |
How lossless compression works
Lossless compression looks for patterns and writes them in a shorter way. A simple example: instead of storing “white, white, white, white, white” for a row of pixels, it stores “5 × white”. When the file is opened, the pattern is expanded back to the original data, with nothing changed.
That is why a ZIP file gives back every document exactly as it was. It is also why lossless compression works best on files with lots of repetition, such as screenshots, logos and diagrams with large areas of flat colour.
How lossy compression works
Lossy compression goes further. It removes information that human eyes or ears are not good at noticing, such as tiny changes in colour between neighbouring pixels, or sounds hidden behind louder sounds.
Most lossy formats let you choose a quality level. A high setting keeps more detail and makes a bigger file. A low setting makes a smaller file, but the damage starts to show as blurry edges, blocky areas and halos around text.
Our test: the same photo, six ways
We took one detailed photo of a warehouse, 1,600 × 1,200 pixels, and saved it in six ways using the sharp image library on 8 November 2026. Uncompressed, the image is 5,625 KB.
To measure quality, we compared every pixel with the original and worked out a score called PSNR. Higher means closer to the original. Lossless files have no score because they are identical.
| Saved as | File size | Smaller than PNG by | Quality score (PSNR) |
|---|---|---|---|
| PNG (lossless) | 4,776 KB | None | Identical |
| WebP lossless | 2,658 KB | 44% | Identical |
| JPG at 90% quality | 658 KB | 86% | 35.3 dB |
| JPG at 75% quality | 393 KB | 92% | 32.1 dB |
| WebP at 75% quality | 303 KB | 94% | 33.2 dB |
| JPG at 50% quality | 262 KB | 95% | 29.9 dB |
What this shows:
- For photos, lossy wins by a mile. Even the best lossless format was almost 7 times bigger than a JPG at 75% quality.
- WebP beats JPG. At the same 75% setting, lossy WebP was 23% smaller than JPG and scored higher on quality.
- Lower quality settings give less and less back. Going from 90% to 75% saved 265 KB. Going down again from 75% to 50% saved only 131 KB more, while the quality kept falling.
The surprise: lossy can be worse for graphics
We ran the same test on a simple graphic: our own 1,200 × 630 pixel share image, with flat colours and text.
| Saved as | File size |
|---|---|
| WebP lossless | 10 KB |
| WebP at 75% quality | 11 KB |
| PNG (lossless) | 21 KB |
| JPG at 75% quality | 24 KB |
| JPG at 90% quality | 34 KB |
Here the lossless PNG was smaller than the lossy JPG, and it was a perfect copy. JPG is designed for photos, and it struggles with sharp edges and text. It makes the file bigger and adds fuzzy marks around letters at the same time.
So the rule is not “lossy is always smaller”. It is: use lossy for photos, and lossless for graphics, screenshots and text.
What happens when you save a lossy file again and again
Every time you open a JPG, edit it and save it as JPG again, it is compressed again, and a little more detail is lost. This is called generation loss.
We saved our test photo as a JPG at 75% quality, then opened and re-saved it 10 times:
| Times saved | Quality score (PSNR) |
|---|---|
| 1 | 32.1 dB |
| 2 | 31.7 dB |
| 5 | 31.2 dB |
| 10 | 31.0 dB |
The loss was small in our test because nothing else changed between saves. With real editing, such as cropping, resizing or changing the quality setting, the damage adds up faster. We did the same with PNG: after 10 saves, every pixel was still exactly the same as the original.
Tip: keep your original photo, or a lossless copy, while you edit. Only save as JPG or lossy WebP at the very end.
For a format-by-format guide, see JPG vs PNG: which should you use?
Which should you use?
- Photos for a website, email or social media: lossy. Use JPG or WebP at about 70 to 85% quality.
- Logos, icons, screenshots and anything with text: lossless. Use PNG or lossless WebP.
- Images that need a transparent background: PNG or WebP. JPG cannot store transparency.
- Files you will keep editing: lossless, then export a lossy copy when you are finished.
- Documents, spreadsheets and program files: always lossless, such as ZIP. Losing even one character would break them.
- Upload forms with a file size limit: lossy JPG, and reduce the pixel size first. See our guide on how to reduce image size without losing quality.
Quick answers
- Lossless: smaller file, no data lost, exact copy every time.
- Lossy: much smaller file, some detail lost forever.
- Lossless formats: PNG, lossless WebP, GIF, ZIP, FLAC.
- Lossy formats: JPG, lossy WebP, MP3, most video.
- Photos: lossy is usually best.
- Graphics and text: lossless is usually best, and often smaller too.
Want to try it on your own pictures? Our free image compressor lets you pick JPG, PNG or WebP, set the quality and see the new file size before you download. It runs in your browser, so your photos are not uploaded. To turn a WebP image into a lossless PNG, use the WebP to PNG converter.