Compress images for a website without losing quality: what actually moves a Lighthouse score
First-hand: On 26 November 2026 we ran Lighthouse 13.6 (mobile and desktop, light and dark) on two versions of our own demo page, one with the original 943 KB hero JPEG and one with the optimized set, and report both results; the byte counts are the files on that page.
Short answer: the image that decides your Lighthouse performance score is almost always one image, the large one at the top of the page, and the four things that fix it are: serve it at the size the screen needs (srcset and sizes), in a modern format (AVIF with a WebP and JPEG fallback), with width and height in the tag, and never lazy-loaded. Compressing every image on the site a little helps less than fixing that one image properly. "Without losing quality" is realistic: a photo encoded as AVIF at a fidelity above about 38 dB PSNR looks identical at normal sizes, and the examples below sit there.
What we measured today
Our demo page is a small business landing page with one hero photograph, a 1920 × 1280 shop front. We keep two copies and ran Lighthouse 13.6 on both on 26 November 2026, mobile and desktop, light and dark colour scheme.
Before: the photo as exported, a 964,775-byte JPEG (943 KB), in a plain <img src="…" alt="…"> with no width, height, srcset or priority hint. After: the same photo through our optimizer with responsive widths on, which produced AVIF, WebP and JPEG at 640, 1024, 1600 and 1920 pixels inside a <picture> with width, height, sizes="100vw" and fetchpriority="high". Nothing else on the page changed.
| Run | Before: performance | Before: LCP | Before: CLS | After: performance | After: LCP | After: CLS |
|---|---|---|---|---|---|---|
| Mobile, light | 66 | 5.6 s | 0.258 | 100 | 1.4 s | 0 |
| Mobile, dark | 80 | 5.6 s | 0 | 100 | 1.4 s | 0 |
| Desktop, light | 99 | 1.0 s | 0 | 100 | 0.4 s | 0 |
| Desktop, dark | 99 | 1.0 s | 0 | 100 | 0.4 s | 0 |
The bytes behind the mobile row: Lighthouse's phone profile picks the 640-pixel AVIF, 28,596 bytes, instead of the 943 KB original, 34 times fewer bytes over the throttled connection. The AVIF at full 1920 width is 277,438 bytes, a little under a third of the JPEG, for the desktops that need it. Desktop was already "fine" at 99 before; the mobile score is where unoptimized images show, because Lighthouse's mobile run simulates a slow 4G connection and a mid-range phone.
Why the LCP image is the whole game
Lighthouse's performance score is a weighted mix of metrics, and the heaviest one is Largest Contentful Paint (LCP): the time until the biggest element above the fold is on screen. On most pages that element is the hero image, so its bytes, format and discovery time set your LCP. A 943 KB JPEG on a simulated slow 4G connection takes seconds to arrive; the page cannot score well regardless of how small the icons are.
The same image also caused the other failing metric in the before run. Without width and height the browser does not know how tall the picture will be, lays the text out, then pushes everything down when the file lands: a Cumulative Layout Shift of 0.258, where Lighthouse wants 0.1 or less. Two attributes fix it and cost nothing.
Compress images for website speed: the order that works
- Find your largest image. Lighthouse's "Improve image delivery" audit lists them with the bytes they would
save. Our page check does the same from a URL and shows which candidate a phone would download.
- Resize before you compress. A 4000-pixel export shown in a 400-pixel column is wasted bytes no codec recovers.
Make the sizes the layout needs: 640 for phones, 1024 for tablets and small laptops, 1600 to 1920 for large or high-density screens.
- Encode in a modern format and keep a fallback. AVIF first, WebP second, JPEG (or PNG for transparency) last, in a
<picture>. The size comparison is in AVIF vs WebP.
- Write the tag properly.
widthandheightalways;srcsetwithwdescriptors and asizesattribute that
matches the layout; fetchpriority="high" on the one image at the top; loading="lazy" on the ones below.
- Then compress the rest. Icons and logos usually want to be SVG, not a compressed PNG; see
The common 2–5 MB hero mistake
Camera exports and design-tool exports are 3000 to 6000 pixels wide and 2 to 5 MB. Dropped straight into a template, they pass the visual check (the browser scales them down) and fail every performance check. The fix is not a stronger compressor; it is sizes. A 1920-pixel version of the same photo is already a tenth of the bytes before any format change, and the 640-pixel version a phone actually displays is a hundredth. If your site builder does not generate sizes for you, generate them once, upload the set, and use the <picture> block.
Compress images without losing quality: what the numbers mean
"Lossless" compression keeps every pixel; for photographs it saves little. "Lossy" compression removes detail the eye does not register, and the question is how much. Our tool reports PSNR and SSIM for every encode against the source so you can see the trade rather than guess: the hero above measures in the low 40s of decibels at its default quality, and every AVIF in today's runs sat between 37.7 and 44.6 dB. If a result ever looks soft, raise the quality for that one image; the default is tuned for the usual case where the photo is displayed at or below its pixel size.
Lazy loading, done right and wrong
loading="lazy" on images below the fold is a real win: the browser does not fetch them until they are near the viewport. The same attribute on the hero is one of the most common ways to make LCP worse, because the browser delays the one image it should fetch first. Lighthouse flags it as "LCP image was lazily loaded". Rule: the first image gets fetchpriority="high" and no loading attribute; everything below the fold gets loading="lazy". Our tool writes the tag either way when you mark an image as the hero.
Do I still need a CDN or a plugin
Not for this. The before and after pages are plain static files on the same hosting; the difference is the files and the tag. A CDN that re-encodes on request will produce similar savings per view, at a per-view price, and it still cannot add width and height to your HTML or choose SVG for a logo. For a site you deploy as files, do it once at build time and the result is just files in your bucket.
Who should pick what
- A landing page with one hero: run the hero through the browser tool with the hero option on, download
the set, paste the <picture> block. Nothing is uploaded, and it is free.
- A site with hundreds of images in a build step: the API with
?widths=autoreturns the same set plus the markup per
image; free for 250 operations a month with an account, then from $10 a month for 1,000 (checked 2026-11-26; plans).
- A site that is already behind an image CDN: keep it, but still fix the tags and the SVG logos; those are not the
CDN's job.