Image Optimization for the Web
A complete image workflow, ordered by what saves the most: resizing, format, quality, then delivery. We measured which srcset file Chromium picks at three pixel densities and how far below the screen it starts fetching lazy-loaded images (2,500 px in our test).
How Much of a Page Is Images
HTTP Archive's 2024 Web Almanac put median image bytes at 1,054 KB on desktop homepages and 900 KB on mobile ones, more than any other resource type on homepages, and at 442 KB and 348 KB on inner pages. That makes images the first place to look on most sites, but not because of any single ranking rule: Google's page experience documentation says there is no single page experience signal, and fast pages matter first to the people waiting for them.
Fix Them in This Order
Each step below was measured in one of our guides; the links go to the full tests.
- Serve the size you display. A 4,000 × 3,000 photo shown at 800 × 600 uses 4% of its pixels. Resizing a 5,363-pixel-wide camera photo to 1,600 px cut it from 2,466 KB to 281 KB at the same quality (resize and quality tests).
- Pick the format by content. For photos, WebP and AVIF files were 31% and 42% smaller than JPEG at the same SSIM in our tests; in a five-browser study, Dornauer and Felderer (2023, via alphaXiv) measured pages loading 1.21 times faster with WebP and 1.15 times faster with AVIF than with JPEG at equal SSIM. Logos, icons and screenshots belong in SVG or PNG (format guide).
- Set quality, then look. JPEG quality 85 to 95 added 87% to the file for a small gain in SSIM; 75 to 85 is the usual range for photos, checked on the image itself.
- Deliver it well. Offer several widths with
srcset, reserve space withwidthandheight, lazy-load what is below the first screen and prioritize the hero. The next two sections measure how Chrome treats the first and third of these.
What the Browser Picks From srcset
With srcset and sizes, the browser chooses the file; the HTML only offers candidates. We gave Chromium 141 five widths (400, 800, 1,200, 1,600 and 2,400 px) for a full-width image and recorded the file it loaded:
| Viewport | Pixel density | Pixels needed | File loaded |
|---|---|---|---|
| 390 px | 1× | 390 | 400w |
| 390 px | 2× | 780 | 800w |
| 390 px | 3× | 1,170 | 1,200w |
| 1,440 px | 1× | 1,440 | 1,600w |
| 1,440 px | 2× | 2,880 | 2,400w (the largest offered) |
In every case it took the smallest candidate at least as wide as the slot times the pixel density, and the largest candidate when none was wide enough. Two practical consequences: a set like 400, 800, 1,200, 1,600 and 2,400 covers phones at 1× to 3× and most desktops; and sizes has to describe the real slot. If an image fills half the screen on desktop but sizes says 100vw, the browser downloads a file twice as wide as needed; sizes="(min-width: 1024px) 50vw, 100vw" fixes that.
Lazy Loading: How Far Ahead Chrome Fetches
We placed loading="lazy" images at set distances below the first screen and recorded which ones Chromium requested while the page loaded. At both 390 × 844 and 1,440 × 900, every image up to 2,500 px below the viewport was fetched straight away; those at 3,000 and 4,000 px waited for scrolling. That matches the thresholds Chrome's team documented on web.dev in 2020: 1,250 px on fast (4G) connections and 2,500 px on 3G or slower; our test machine reported no connection type, which landed on the 2,500 px value.
So on a short or medium page, lazy loading changes little: most images are close enough to load with the page anyway. It pays off on long pages with many images, such as galleries and feeds. What it must never touch is the main image at the top of the page, which is usually the Largest Contentful Paint element; lazy-loading it delays the very paint the metric measures. Browser support is broad: MDN's compatibility data lists loading in Chrome 77, Firefox 75 and Safari 15.4.
Images and Core Web Vitals
- Largest Contentful Paint: load the hero eagerly, add
fetchpriority="high"(Chrome and Edge 101, Safari 17.2, Firefox 132), and preload it if it is a CSS background the browser only discovers late. - Cumulative Layout Shift:
widthandheightattributes let the browser reserve the box before the file arrives; in our aspect-ratio tests that held 225 px in place where the same image without them took 0 px and then pushed the page down. - Decoding:
decoding="async"is a hint that lets the browser show other content before an image is decoded; it does not make the file smaller or faster to fetch.
A Repeatable Pipeline
A setup that holds up for most sites: export each image at 400, 800, 1,200, 1,600 and 2,400 px wide (skipping sizes larger than the original), encode photos as AVIF and WebP with a JPEG fallback in a <picture> element, keep graphics as SVG or PNG, write width, height and a real sizes on every image, and lazy-load everything except the first screen.
Our browser tools cover the manual version: the Bulk Image Resizer makes the widths with a Lanczos filter and never enlarges a smaller image, the Image Compressor converts to WebP without handing back a larger file, and the Image Converter checks every output's file signature before you download it.
- [1]HTTP Archive, Web Almanac 2024: Page Weight (image bytes by page type) ↗
- [2]web.dev, Browser-level image lazy loading for the web (distance-from-viewport thresholds) ↗
- [3]WHATWG HTML Standard, Selecting an image source (srcset and sizes) ↗
- [4]MDN browser-compat-data, img loading attribute, checked Oct 14, 2026 ↗
- [5]MDN browser-compat-data, img fetchpriority, checked Oct 14, 2026 ↗
- [6]Google Search Central, Understanding page experience in Google Search results ↗
- [7]Dornauer B, Felderer M (2023), Web Image Formats: Real-World-Usage and Performance across Popular Web Browsers, arXiv:2310.00788 (via alphaXiv) ↗
