Image Compression Explained: Lossy vs Lossless
How image compression works and how to choose the right settings
What Is Image Compression?
Image compression reduces the file size of an image by encoding its data more efficiently. This is critical for the web — images account for roughly 50% of a typical webpage's total size, and smaller images mean faster page loads.
Lossy Compression
Lossy compression permanently removes some image data to achieve dramatically smaller files. The human eye is poor at detecting certain kinds of detail, so lossy algorithms strategically discard information you're unlikely to notice.
Formats: JPEG, AVIF (lossy mode), WebP (lossy mode)
Best for: Photographs, complex images with many colors and gradients. Lossy compression at quality 75-85 typically reduces files by 60-80% with minimal visible quality loss.
Lossless Compression
Lossless compression reduces file size without losing any data — the original image can be perfectly reconstructed from the compressed file. It works by finding and eliminating redundancy in the data.
Formats: PNG, AVIF (lossless mode), WebP (lossless mode), GIF
Best for: Screenshots, text-heavy images, technical diagrams, and any image where pixel-perfect accuracy matters. Typical reduction is 10-50%.
How Modern Formats Compare
| Format | Lossy | Lossless | Relative Size |
|---|---|---|---|
| AVIF | Yes | Yes | Smallest |
| WebP | Yes | Yes | Small |
| JPEG | Yes | No | Medium |
| PNG | No | Yes | Large |
Quality Settings Explained
Most image compression tools let you set a quality level from 1 to 100. This controls the aggressiveness of lossy compression:
- 90-100: Near-lossless. Very large files. Rarely needed for web.
- 75-85: High quality. Good balance for most web images.
- 50-70: Medium quality. Significant size savings with some visible softening.
- Below 50: Low quality. Noticeable artifacts. Only for thumbnails or previews.
Tips for Optimal Compression
- Always compress from the highest-quality source (original photo, not a previously compressed version).
- Use AVIF or WebP instead of JPEG for 20-50% additional savings at the same quality.
- Resize images to their display size before compressing — don't serve a 4000px image in a 800px container.
- Use lossless formats (PNG) for screenshots, text, and images that will be edited further.
Try our free compressors: Compress AVIF, Compress JPG, or Compress PNG — all processing happens in your browser.
Frequently Asked Questions
Lossy compression permanently removes some image data to achieve smaller files. Lossless compression reduces file size without any data loss — the original image can be perfectly reconstructed.
No. Image compression reduces file size, not resolution (pixel dimensions). Your image will have the same width and height after compression. Quality may decrease with lossy compression, but dimensions stay the same.
For JPEG, 70-85 is ideal for most web images. For AVIF, 40-65 offers excellent quality at very small sizes. For WebP, 75-85 works well. The right setting depends on your content and tolerance for quality loss.
Technically yes, but each round of lossy compression degrades quality further. It's best to compress once from the highest-quality source. Lossless formats (PNG) can be re-compressed without quality loss.
