The Practical Guide to Image Compression
Lossy vs lossless, JPEG vs WebP vs AVIF — how to choose the right format and quality level for every image.
Image compression is one of the highest-impact optimizations you can make. A single unoptimized photo can weigh 5MB; the same photo, compressed well, can be 150KB and look identical to the eye.
Lossy vs Lossless
Compression comes in two flavors:
- Lossless — reduces file size without discarding any data. Decompress and you get back the exact original pixels. Best for screenshots, logos, and images with sharp edges or text.
- Lossy — permanently discards data the human eye is unlikely to miss. Achieves dramatically smaller files. Best for photographs and complex illustrations.
A good rule of thumb: photos get lossy formats, everything else gets PNG or lossless WebP.
Choosing a Format
| Format | Compression | Transparency | Animation | Best for | |--------|-------------|--------------|-----------|----------| | JPEG | Lossy | No | No | Photos, universal compatibility | | PNG | Lossless | Yes | No | Screenshots, logos, transparency | | WebP | Both | Yes | Yes | Modern web images | | AVIF | Lossy | Yes | Yes | Highest compression, modern browsers |
WebP typically produces files 25-35% smaller than JPEG at equivalent quality. AVIF goes further, often 50% smaller than JPEG, but encoding is slower and not every browser supports it yet.
Finding the Right Quality Level
The quality slider is where most people go wrong. You don't need quality 100:
- 80-90 — visually indistinguishable from the original for most photos
- 60-80 — great for web use; minor artifacts invisible at normal viewing sizes
- 40-60 — acceptable for thumbnails and previews
- Below 40 — visible artifacts start to appear; use with caution
Beyond roughly quality 90, file size grows sharply while perceived quality barely improves. The sweet spot for web images is usually 70-85.
Dimensions Matter More Than You Think
Never upload a 4000px-wide image to display in a 800px container. Downscaling first is free compression:
- A 4000x3000 photo might be 4MB
- The same photo resized to 1200x900 is a fraction of the size before any quality reduction
- Combine resizing with quality 80 and you often land under 200KB
Practical Workflow
- Resize to the largest size it will actually be displayed at
- Choose the format — WebP for the web, PNG for lossless needs, JPEG for compatibility
- Dial in quality — start at 80, step down until you notice artifacts, then step back up one notch
- Verify — view the result at actual display size, not zoomed in
Try It Yourself
You can do all of this in your browser with our free tools: compress images, convert formats, and resize — no uploads, no accounts, nothing leaves your device.