← Back to Blog
Optimization·5 min read

How to Compress Images for Web Without Losing Quality (2026 Guide)

A practical guide to compressing JPG, PNG, and WebP images for the web — what quality settings actually matter, when to convert formats, and how to hit specific size targets without visible quality loss.

Image compression is the single biggest lever you have for improving page load speed. On the average website, images account for roughly half of total page weight. Cut your image sizes by 60–80% and you'll see real improvements in Core Web Vitals, search rankings, mobile data usage, and bounce rates.

The good news: in 2026, you can usually achieve that 60–80% reduction with no visible quality loss. The bad news: most people compress images badly. They pick the wrong format, use default quality settings, or compress images that were already compressed.

This guide walks through what actually matters.

The two kinds of compression (and why it matters)

Compression algorithms come in two flavors:

Lossless — the file gets smaller, but every pixel is preserved exactly. Decompressing the file gives you the original image, byte for byte. PNG uses lossless compression. So does WebP in lossless mode.

Lossy — the algorithm throws away some image information that human eyes are unlikely to notice. The result is much smaller, but the original is gone. JPEG, WebP (in lossy mode), and AVIF are all lossy.

For photos, lossy compression is almost always the right call. Photos contain so much subtle detail that you can throw away 80% of it and still have something that looks identical to the eye. For text, logos, screenshots, and graphics with hard edges and flat colors, lossy compression introduces visible artifacts — banding around text, fuzzy edges, color shifts — and lossless is usually better.

What quality setting should you use?

For JPEG and lossy WebP, the quality slider runs from 0 to 100. Here's a practical reference:

  • 95–100: Visually indistinguishable from the original. File size barely improves over lower settings. Don't bother — you're paying for "perfect" you can't see.
  • 80–90: The sweet spot for most photos. Cuts file size by 50–70% versus the original with no visible difference at typical viewing sizes. This is your default.
  • 70–80: Aggressive but still usually fine. Some photos with smooth gradients (skies, skin) start showing subtle banding.
  • 60–70: Visible compression artifacts on close inspection. Use only when file size matters more than fidelity.
  • Under 60: Reserved for thumbnails, placeholders, and very small displays.

Notice that the relationship isn't linear. Going from 100 to 85 saves a lot. Going from 85 to 70 saves much less, with a real quality cost. Most professional image compressors default to 75–82 for this reason.

Pick the right format first

Compression quality is only half the story. The format you choose can save another 30% on top.

Use JPEG when: you have a photograph, you don't need transparency, and you need maximum browser compatibility (every browser made in the last 25 years supports JPEG).

Use PNG when: you have a logo, screenshot, illustration, or anything with sharp text or transparency. Avoid PNG for photos — it'll be 5–10x bigger than JPEG with no visible benefit.

Use WebP when: your audience uses a modern browser (basically everyone in 2026). WebP is roughly 25–35% smaller than JPEG at the same quality and supports transparency, animation, and lossless mode all in one format. In 2026, WebP should be your default web image format.

Use AVIF when: you want the absolute smallest files and can tolerate slightly slower decode and slightly less universal support. AVIF can be 20–30% smaller than WebP. The catch: encoding is slower, and some older browsers and apps don't render AVIF.

How to hit a specific file size target

Sometimes you have a hard target — "must be under 200KB" or "must be under 1MB for our CMS." A few strategies:

Iterative quality reduction: Start at quality 90. If the result is over your target, drop to 80. If still over, drop to 70. This is what most "compress to size" tools do automatically — and what our free image compressor does for you.

Resize before compressing: A 4000×3000 photo at quality 85 is much bigger than a 1920×1080 photo at the same quality. If your image will be displayed at 1200px wide, resize it to 1200px first. You'll get better quality at smaller sizes than aggressive compression of the original.

Convert format: Switching from PNG to WebP often cuts file size by 70–90% with no visible change. Switching from JPEG to WebP saves 25–35%. If you can't hit your target with quality reduction, try a format conversion instead.

Don't compress already-compressed images

Every time you compress a JPEG and re-save it, you lose information. Compressing the same JPEG five times will produce visible degradation even if every individual save uses high quality.

A few practical implications:

  • Always compress from the original, not from a previous compressed version.
  • If you're processing photos in stages, work in PNG or another lossless format until the final export.
  • Don't run a JPEG through multiple compression tools "to be safe" — once is enough.

What about Core Web Vitals?

Google's Core Web Vitals include Largest Contentful Paint (LCP) as a key ranking signal. Your hero image is often the LCP element on a page. Compressing it well — and serving the right size for the device — directly improves LCP and search rankings.

Three quick wins:

  1. Use srcset and sizes to serve appropriately sized images per device. A phone shouldn't load a desktop hero.
  2. Use loading="lazy" on images below the fold so they don't block initial render.
  3. Preload your LCP image with <link rel="preload" as="image"> for an extra ~100ms LCP improvement.

A 60-second image compression workflow

  1. Start with the highest-quality original you have.
  2. Resize to the dimensions you'll actually display. No bigger.
  3. Convert to WebP (or AVIF with JPEG/WebP fallbacks).
  4. Compress at quality 80–85.
  5. Compare against the original at full size. If you can't see a difference, you win.
  6. Repeat with quality 70–75 if you need smaller. Stop if you can see degradation.

You can run this entire workflow in your browser using our free image compressor, which uses the same mozjpeg-style techniques as professional tools — and never uploads your images to a server.

Common compression mistakes

  • Defaulting to PNG for photos: PNGs of photos are 5–10× bigger than necessary. Switch to JPEG or WebP.
  • Saving at quality 100: There's no visible benefit and a huge file-size cost.
  • Not resizing first: A 6000-pixel-wide image displayed at 800 pixels wastes everyone's bandwidth.
  • Compressing the same image twice: Quality compounds losses. Compress once, from the original.
  • Ignoring WebP: If you're still shipping JPEG-only in 2026, you're leaving 25–35% on the table.

Bottom line

Pick WebP. Pick quality 80–85. Resize before you compress. Don't recompress.

Do those four things and your images will be smaller, your pages will load faster, and your users (and Google) will notice.

Want to put this into practice? Try our free image compressor, resizer, and format converter — all running entirely in your browser, with no signups and no uploads.

More guides