Short answer
Lossless compression makes a file smaller without changing a single pixel. Lossy compression removes detail the eye is unlikely to notice and often makes files several times smaller, at the cost of a small, permanent loss of quality. Use lossy compression for photos on the web and in email, and lossless for graphics, screenshots, files you will keep editing and archives.
How lossless compression works
A lossless compressor looks for patterns and stores them more efficiently, much like a ZIP file. A row of 500 identical white pixels can be written as "500 white pixels" instead of 500 separate values. When the image is opened, the pixels are rebuilt exactly.
This works very well on graphics with flat colors, text and sharp edges, where neighboring pixels repeat. It works poorly on photos, whose natural noise means almost no two pixels are the same, which is why a photo saved as PNG is often several times larger than the same photo as JPG.
How lossy compression works
A lossy compressor decides which information matters least and throws it away before compressing the rest. JPEG, for example, splits the image into 8 × 8 pixel blocks, converts each block into frequencies, and stores fine detail and color with less precision than brightness, because the eye is less sensitive to them. The quality setting controls how much is discarded.
At high quality settings the difference is very hard to see, and files are still much smaller than lossless ones. At low settings artifacts appear: blocks in smooth areas, halos around sharp edges and colors bleeding into each other. The removed detail is gone for good, and saving a lossy file again at a lossy setting removes a little more each time.
Which formats use which
| Format | Lossless | Lossy |
|---|---|---|
| PNG | Yes, always | No (but colors can be reduced before saving) |
| JPG | No (in everyday use) | Yes, always |
| WebP | Yes, separate mode | Yes, the usual mode |
| AVIF | Yes, rarely used | Yes, the usual mode |
| GIF | Yes, up to 256 colors | No (but colors are reduced to fit 256) |
| HEIC | Possible, rarely used | Yes, the usual mode on phones |
The PNG and GIF rows show a subtle point. The compression itself is lossless, but squeezing an image into a palette of 256 colors or fewer already changes pixels. Our PNG compressor offers both: a lossless mode that only recompresses the data with oxipng, and a fewer colors mode that reduces the palette first for much smaller files.
Which one to choose
For photos on websites, in email and on social media, lossy compression is almost always right. JPG at quality 75 to 85 looks very close to the original in most photos, and WebP and AVIF are often smaller still. The JPG compressor and the WebP compressor let you set the quality and preview the size.
For logos, icons, screenshots and anything with text, use lossless compression or a reduced palette, so edges stay clean. For originals you will edit again, keep a lossless copy and export lossy versions from it as needed.
When a form or a platform sets a maximum file size, the choice is made for you: lossy compression plus, if needed, smaller dimensions. Compress image to size picks the highest quality that fits 100 KB, 50 KB or any other target, and the image compressor handles everyday compression of JPG, PNG, WebP and AVIF files.