# 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.

Canonical: https://scaplet.com/glossary/image-compression

Glossary Glossary · Performance

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 with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fimage-compression%20(%22Image%20compression%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fimage-compression%20(%22Image%20compression%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fimage-compression%20(%22Image%20compression%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fimage-compression%20(%22Image%20compression%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 4 parts, 2 minutes.

1. [Lossy vs lossless 01](#lossy-vs-lossless)
2. [Compress from the command line 02](#compress-from-the-command-line)
3. [Serve modern formats with a fallback 03](#serve-modern-formats-with-a-fallback)
4. [Do and do not for SEO and speed 04](#do-and-do-not-for-seo-and-speed)

_01_At a glance

## Lossy vs lossless

Images are the biggest assets on most pages. web.dev reports that images alone accounted for nearly half of a median page's roughly 2 MB transfer size as of June 2022, and that on more than 70% of webpages the largest element in the [initial viewport](/glossary/above-the-fold) involves an image. So image weight bears directly on LCP.

Format

### JPEG

Compression

Lossy

Use for

Photographs and continuous-tone images

Format

### PNG

Compression

Lossless

Use for

Screenshots, diagrams, logos, line art

Format

### [WebP](/glossary/webp)

Compression

Lossy and lossless

Use for

Photos and graphics; MDN says lossy WebP is 25-35% smaller than JPEG at similar quality, and lossless is 26% smaller than PNG

Format

### [AVIF](/glossary/avif)

Compression

Lossy and lossless

Use for

Photos; MDN says lossy AVIF is about 50% smaller than JPEG

Format

### SVG

Compression

Vector

Use for

Icons and vector graphics

Google Search supports BMP, GIF, JPEG, PNG, WebP, SVG and AVIF in image results.

_02_Check 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
```

_03_Explained

## 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.

_04_Checklist

## Do and do not for SEO and speed

First_2_
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.

Next_2_
Use real `<img>` elements. Google does not index CSS background images.

Keep descriptive filenames and [alt text](/glossary/alt-text). Compression does not replace them.

Then_1_
Avoid over-compressing. Google says high-quality photos appeal to users more than blurry, unclear images.

See [lazy loading](/glossary/lazy-loading) for what to defer and [page speed](/glossary/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.

_01_ Will 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.

_02_ Should 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.

_03_ What 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. 01 [Image performance (web.dev)](https://web.dev/learn/images/performance-issues) web.dev · checked 2026-10-24
2. 02 [Image file type and format guide (MDN)](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types) developer.mozilla.org · checked 2026-10-24
3. 03 [Image SEO best practices (Google Search Central)](https://developers.google.com/search/docs/appearance/google-images) developers.google.com · checked 2026-10-24
4. 04 [Browser-level image lazy-loading for the web](https://web.dev/articles/browser-level-image-lazy-loading) web.dev · checked 2026-10-24

## Keep learning

[All glossary](/glossary)

[Learn Lazy loading Performance](/glossary/lazy-loading) [Related Core Web Vitals Performance](/glossary/core-web-vitals) [Read next Page speed Performance](/glossary/page-speed) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[Hydration](/glossary/hydration) [Ideal customer profile (ICP)](/glossary/ideal-customer-profile) [Image SEO](/glossary/image-seo) [Image sitemap](/glossary/image-sitemap)

More in Performance
[Critical rendering path](/glossary/critical-rendering-path) [Cumulative Layout Shift (CLS)](/glossary/cumulative-layout-shift) [dns-prefetch](/glossary/dns-prefetch) [Edge caching](/glossary/edge-caching) [fetchpriority](/glossary/fetchpriority) [First Contentful Paint](/glossary/first-contentful-paint) [First Input Delay (FID)](/glossary/first-input-delay) [font-display](/glossary/font-display) [Gzip compression](/glossary/gzip-compression) [HTTP caching](/glossary/http-caching) [HTTP/2](/glossary/http-2) [HTTP/3](/glossary/http-3) [Image compression](/glossary/image-compression) [Interaction to Next Paint (INP)](/glossary/interaction-to-next-paint) [Largest Contentful Paint](/glossary/largest-contentful-paint) [Lazy loading](/glossary/lazy-loading) [Lighthouse](/glossary/lighthouse) [Page experience](/glossary/page-experience) [Page speed](/glossary/page-speed) [PageSpeed Insights](/glossary/pagespeed-insights) [preconnect](/glossary/preconnect) [preload](/glossary/preload) [Progressive web app](/glossary/progressive-web-app) [Real user monitoring (RUM)](/glossary/real-user-monitoring)

Terms on this page
[Above the fold](/glossary/above-the-fold) [WebP](/glossary/webp) [AVIF](/glossary/avif) [Alt text](/glossary/alt-text) [Lazy loading](/glossary/lazy-loading) [Page speed](/glossary/page-speed)

Free · 2 minutes

## Know the term. _Now check your site._

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

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
