Free auditStart free
GlossaryGlossary · Performance

Image compression

Lossy vs lossless image compression, which format to pick (JPEG, PNG, WebP, AVIF), and a working picture-element and command-line workflow for faster pages.

2 min
read
4
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

Image compression reduces image file size so pages load faster. Lossy compression (JPEG, lossy WebP and AVIF) discards data for smaller files. Lossless compression (such as PNG) reproduces the original exactly. MDN says WebP and AVIF generally compress better than PNG, JPEG and GIF, and suggests a PNG or JPEG fallback for browsers that lack support. Compress to help LCP, but not so far that images look blurry.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02Check it

Compress from the command line

The quality numbers are starting points, not rules. Export at a few levels, view them at the size users see, and keep the smallest one that still looks right. Image content decides how far you can go.

Common tools (install separately)
# Re-encode a JPEG at quality 80 and strip metadata
magick original.jpg -quality 80 -strip optimized.jpg

# Convert to WebP
cwebp -q 80 original.jpg -o optimized.webp

# Convert to AVIF
avifenc -q 60 original.jpg optimized.avif
03Explained

Serve modern formats with a fallback

Picture element with fallbacks
<picture>
  <source srcset="photo.avif" type="image/avif">
  <source srcset="photo.webp" type="image/webp">
  <img src="photo.jpg" width="1200" height="800" alt="Storefront at night">
</picture>

The browser uses the first source it supports. Google's image guidance also recommends srcset or <picture> for serving different versions to different devices, with a fallback src, because some browsers and crawlers do not understand these attributes.

04Checklist

Do and do not for SEO and speed

First2
Compress the LCP image first, but do not lazy load it. web.dev recommends fetchpriority="high" for it.
Add width and height to every <img>. web.dev calls images a common cause of high CLS.
Next2
Use real <img> elements. Google does not index CSS background images.
Keep descriptive filenames and alt text. Compression does not replace them.
Then1
Avoid over-compressing. Google says high-quality photos appeal to users more than blurry, unclear images.

See lazy loading for what to defer and page speed for how this fits the wider picture.

Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Will compressing images hurt my SEO?

Google's image guidance says high-quality photos appeal to users more than blurry, unclear ones, and also that images are often the largest contributor to page size. It points to PageSpeed Insights for analyzing site speed.

02Should I convert everything to WebP or AVIF?

MDN says WebP and AVIF generally compress better than PNG, JPEG and GIF, and to use a picture element with a PNG or JPEG fallback if you need to support browsers that lack them. For screenshots, diagrams, logos and line art, MDN says to prefer lossless encoding because blurring around text and sharp edges is very visible.

03What JPEG quality should I use?

None of the sources cited here give a number. Treat 80 as a starting point and compare the result with the original at display size.

Sources · 4

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • web.dev
  • mozilla.org
  • google.com
  1. 01Image performance (web.dev)web.dev · checked 2026-10-24
  2. 02Image file type and format guide (MDN)developer.mozilla.org · checked 2026-10-24
  3. 03Image SEO best practices (Google Search Central)developers.google.com · checked 2026-10-24
  4. 04Browser-level image lazy-loading for the webweb.dev · checked 2026-10-24
Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly