Skip to main content
Guide · Image

Compress Images Without Losing Quality

Updated:

Modern Image Compression Cuts File Size by 25–35%

You can reduce image file sizes significantly without visible quality loss by using next-generation formats and smart compression settings. WebP, AVIF, and optimized JPEG (mozjpeg) are the three formats that matter for web performance.

Why Standard JPEG Isn't Enough

Traditional JPEG compression works, but it's inefficient by modern standards. WebP compresses 25–35% smaller than JPEG at the same quality level, and AVIF goes even further. For a product photo or hero image, this difference translates directly to faster page loads and better Core Web Vitals scores.

The Three-Format Workflow

1. WebP: The Safe Modern Choice

WebP is supported in all modern browsers and is the most reliable next-gen format.

  • Quality setting: Use 75–80 for product photos, 70–75 for hero images
  • File size: Typically 25–30% smaller than JPEG
  • Best for: E-commerce, marketing sites, portfolios

2. AVIF: Maximum Compression

AVIF is newer and compresses even smaller than WebP, but encoding is slower and browser support is still rolling out.

  • Quality setting: Use 55–65 (AVIF quality scores differ from JPEG)
  • File size: Often 30–40% smaller than JPEG
  • Best for: Sites targeting modern browsers; use as a fallback option
  • Trade-off: Longer encoding time; not all browsers support it yet

3. Optimized JPEG (mozjpeg): The Fallback

Mozjpeg is a patched version of libjpeg that compresses JPEG files 5–10% better than standard JPEG without quality loss.

  • Quality setting: Use 80–85
  • File size: Slightly smaller than standard JPEG
  • Best for: Older browser support; always keep as a fallback

Step-by-Step Compression Workflow

Step 1: Resize Before Compression

Compression works best on properly sized images. Don't compress a 4000×3000 px photo if your website displays it at 800×600 px.

  • Use an image editor or online tool to resize to the largest size you'll display on your site
  • Add 20% extra for high-DPI (Retina) displays
  • For a 600 px wide hero image, resize to 720 px

Step 2: Choose Your Compression Tool

You'll need a tool that supports multiple formats. Look for one that lets you:

  • Upload JPEG, PNG, or WebP
  • Output WebP, AVIF, and optimized JPEG in one batch
  • Adjust quality settings per format
  • Preview the output before download

Step 3: Test Quality Settings

Start with these baselines, then adjust:

  • WebP: 75 quality
  • AVIF: 60 quality
  • mozjpeg: 82 quality

Download each version and compare side-by-side at 100% zoom. If you see artifacts (blocky areas, color banding), increase quality by 5 points and retry.

Step 4: Implement Responsive Images

Use HTML's <picture> element to serve the best format to each browser:

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Product photo">
</picture>

Browsers load the first format they support and fall back to JPEG if needed.

Step 5: Measure the Results

After uploading compressed images, check your page speed:

  • Use Google PageSpeed Insights or WebPageTest
  • Compare before and after file sizes
  • Monitor Core Web Vitals (LCP, CLS, FID)

A 30% reduction in image bytes typically improves LCP by 0.5–1 second on slower connections.

Common Mistakes to Avoid

Compressing Already-Compressed Images

Don't re-compress a WebP or AVIF file. Each compression cycle degrades quality. Always start with the original file.

Using the Same Quality for All Images

Hero images can tolerate lower quality (70–75) because viewers see them briefly. Product photos need higher quality (80–85) for detail. Adjust per image type.

Forgetting the JPEG Fallback

AVIF and WebP aren't supported everywhere yet. Always include a JPEG fallback, or older browsers will see broken images.

Skipping the Resize Step

Compressing a 4000 px image that displays at 600 px wastes bandwidth. Resize first, then compress.

Ignoring Mobile

Mobile users see the biggest speed gains. Test your compressed images on 4G and 3G connections, not just desktop Wi-Fi.

When Quality Loss Becomes Visible

You'll start seeing artifacts (blocky compression, color shifts) when you push quality too low:

  • WebP below 65: Noticeable on product photos
  • AVIF below 50: Visible banding on gradients
  • JPEG below 75: Clear blockiness on detailed images

If your images are text-heavy (infographics, screenshots), increase quality by 10 points across all formats.

File Size Expectations

For a typical 1200×800 px product photo:

  • Original JPEG (quality 85): ~150 KB
  • WebP (quality 75): ~95 KB (37% smaller)
  • AVIF (quality 60): ~70 KB (53% smaller)
  • mozjpeg (quality 82): ~140 KB (7% smaller)

Actual savings depend on the image content. Photos with solid colors compress better than detailed textures.

Try the compression tool to see how much you can reduce your image file sizes. Upload a product photo or hero image, compare the quality settings, and download the optimized versions. Most sites see 25–35% file size reduction with no visible quality loss—and that means faster page loads, better SEO rankings, and happier visitors.

Tools mentioned in this guide

FAQs

What's the difference between WebP and AVIF?
WebP compresses 25–30% better than JPEG and works in all modern browsers. AVIF compresses 30–40% better than JPEG but is newer and not yet supported in all browsers. Use WebP as your primary format and AVIF as an additional option for visitors on modern browsers.
Will my images look blurry after compression?
No, if you use the right quality settings. WebP at quality 75 and AVIF at quality 60 are visually identical to the original for most photos. Only extreme compression (quality below 50) produces visible blurriness.
Do I need to compress PNG files?
Yes, but differently. PNGs are lossless, so compression removes file bloat without quality loss. Convert PNGs to WebP or AVIF for the biggest savings—often 50–70% smaller. Keep the original PNG only if you need transparency that JPEG can't handle.
How do I serve different image formats to different browsers?
Use the HTML `<picture>` element with multiple `<source>` tags. List formats in order of preference (AVIF first, then WebP, then JPEG). Browsers automatically load the first format they support.
Can I compress images in bulk?
Yes. Most compression tools accept batch uploads. You can compress 10–50 images at once and download them all in a single zip file. This saves time compared to compressing one image at a time.
What quality setting should I use for different image types?
Use 80–85 for product photos and detailed images, 70–75 for hero images and backgrounds, and 65–70 for thumbnails. Start with these settings, preview the output, and adjust up or down based on what you see.

More guides on Image