A continuation of the format guide: now delivery is the problem
| Layer | Question | Guide |
|---|---|---|
| Format and compression | AVIF, WebP, JPEG or PNG? | WebP vs AVIF vs JPEG vs PNG [5] |
| Delivery | Which candidate, when and at what priority? | This article |
| Measurement | Did the browser actually behave as expected? | Network, Performance, PageSpeed |
POLPROG already has a separate guide comparing WebP, AVIF, JPEG and PNG. That article answers which format to choose and how to match it to the type of image. [5]
This article starts one step later: assume the format is already selected, then analyze how quickly the browser can discover the image, which candidate it downloads, which priority it receives and when it can render it.
The distinction matters technically. A very small AVIF file can still produce poor LCP if JavaScript reveals it late, while a correctly configured srcset can reduce transfer regardless of the codec. [6][14]
How the browser discovers an image
| Embedding method | When it can be discovered | LCP risk |
|---|---|---|
| ` | During HTML parsing | Lowest |
background-image in external CSS | After CSS discovery, download and processing | Higher |
| Image inserted by JavaScript | After JS download and execution | Highest |
| Preload + later use | Preload can start the request earlier | Useful only when a real discovery delay exists |
For a critical image, the best case is direct discovery while the initial HTML is being parsed. web.dev identifies resource discoverability as a major component of LCP resource load delay. [6]
A background image in external CSS may only be discovered after the stylesheet has been fetched and processed. An image created by JavaScript can appear even later because the script must first be fetched, parsed and executed. [6]
For hero and other critical imagery, improve the discovery path before adding more resource hints.
How srcset and sizes lead to a candidate choice
| Viewport | Example slot | DPR | Approx. required pixels | Typical candidate from 480w / 960w / 1440w |
|---|---|---|---|---|
| 390 px | 390 px (100vw) | 1 | 390 px | 480w |
| 390 px | 390 px (100vw) | 2 | 780 px | 960w |
| 1440 px | 720 px (50vw) | 1 | 720 px | 960w |
| 1440 px | 720 px (50vw) | 2 | 1440 px | 1440w |
With width descriptors such as 480w, 960w and 1440w, the browser first estimates the rendered slot from sizes and then considers factors including device pixel density. [1][13]
The table below is a simplified model, not a guarantee that every browser will pick exactly the same resource. Final selection belongs to the user agent. [1]
If the layout renders an image at 50vw but sizes="100vw" is supplied, the browser may estimate a slot twice as wide and choose an unnecessarily large candidate.
srcset and sizes: stop sending desktop images to phones
Responsive image with srcset and sizes
<img
src="/images/product-960.jpg"
srcset="
/images/product-480.jpg 480w,
/images/product-960.jpg 960w,
/images/product-1440.jpg 1440w
"
sizes="(max-width: 700px) 100vw, 50vw"
width="1440"
height="960"
alt="Application dashboard showing a sales chart"
/>
srcset with width descriptors lists available candidates, while sizes describes the expected rendered slot width. The browser can then consider viewport, layout and pixel density when selecting a file. [1][13]
When srcset uses w descriptors, accurate sizes is essential. If the browser assumes a much larger slot than the real layout, it may download a larger resource than necessary.
<picture> for format fallback and art direction
AVIF -> WebP -> JPEG example
<picture>
<source
type="image/avif"
srcset="/images/hero-800.avif 800w, /images/hero-1600.avif 1600w"
sizes="100vw"
/>
<source
type="image/webp"
srcset="/images/hero-800.webp 800w, /images/hero-1600.webp 1600w"
sizes="100vw"
/>
<img
src="/images/hero-1600.jpg"
width="1600"
height="900"
alt="Team working on an application interface"
/>
</picture>
<picture> lets the browser evaluate <source> elements by type and media conditions, while the child <img> provides fallback content, dimensions, alt text and other image attributes. [3]
It works well for AVIF or WebP alternatives with a JPEG fallback, and for art direction where mobile needs a different crop or composition rather than merely a smaller copy of the desktop image.
The LCP image must be discovered early
web.dev recommends making the LCP resource discoverable from the initial HTML whenever possible. An image revealed only after JavaScript runs or after external CSS is processed creates extra request dependencies. [6]
If the LCP element is a normal image, put the <img> in the HTML. For an important CSS background, preload can be appropriate because the browser would otherwise discover the resource only after fetching and parsing CSS. [6][8]
Use fetchpriority="high" selectively
Hero image likely to become LCP
<img
src="/images/hero-1600.avif"
width="1600"
height="900"
fetchpriority="high"
loading="eager"
alt="Main view of an analytics application"
/>
fetchpriority provides a browser hint about relative fetch importance. MDN lists an LCP image as a typical case where high can help. [4]
Do not mark many images as high priority. Network prioritization is competitive, so boosting too many resources weakens the signal. Chrome guidance recommends reserving high priority for truly critical resources. [8]
Lazy loading is for offscreen images, not LCP
Below-the-fold gallery image
<img
src="/images/gallery-960.avif"
srcset="/images/gallery-480.avif 480w, /images/gallery-960.avif 960w"
sizes="(max-width: 700px) 100vw, 50vw"
width="960"
height="640"
loading="lazy"
decoding="async"
alt="Detailed view of an application interface"
/>
loading="lazy" defers an image until it approaches the viewport, reducing initial bytes and competition for network resources. [2]
Do not lazy-load an LCP or another important initially visible image. web.dev and Chrome warn that this introduces unnecessary resource-load delay and hurts LCP. [6][8]
width and height reduce CLS
With explicit width and height, the browser can derive an aspect ratio before the resource has loaded and reserve the expected space, reducing layout shifts. [2][14]
Those intrinsic dimensions do not prevent responsive CSS. The element can still use max-width: 100% and height: auto; the attributes mainly provide the browser with an early aspect ratio.
Preload only when early discovery is not enough
Responsive preload for a critical image
<link
rel="preload"
as="image"
imagesrcset="/images/hero-800.avif 800w, /images/hero-1600.avif 1600w"
imagesizes="100vw"
fetchpriority="high"
/>
Preload can start an important image earlier when it would otherwise be discovered through CSS or JavaScript. For responsive images, HTML defines imagesrcset and imagesizes so the preload can use the same candidate-selection logic as the later image. [11][12]
Avoid preloading everything. If an image is already visible to the preload scanner in early HTML, extra preload may add no value. Preloading multiple alternative formats can also waste bandwidth through duplicate downloads. [7][12]
decoding="async" is a hint, not an LCP fix
The decoding attribute lets developers express a preference for image decoding. async allows decoding to happen asynchronously relative to presenting other content, while auto leaves the decision to the browser. [2]
Do not use it as a substitute for proper discovery and priority. For LCP, resource discovery, transfer and priority usually matter more than the decoding hint itself.
CSS background images are weaker for discovery and image SEO
A background image referenced in external CSS is discovered later than an <img> in the initial HTML. If it becomes LCP, preload or a semantic markup change may be warranted. [6]
Google Search Central also states that Google Images discovers standard <img> resources, including those inside <picture>, but does not index CSS background images as images. [9]
Semantics and SEO: the technical difference between <img> and CSS backgrounds
| Use case | Better mechanism | Reason |
|---|---|---|
| Content hero | ` / | Early discovery, alt text, responsive images, LCP control |
| Product or article image | ` / | Semantics and indexability |
| Decorative texture | CSS background | Not document content |
| Background that becomes LCP | Consider ` | CSS can delay discovery |
This article does not repeat a complete image SEO guide, but one technical consequence matters: Google Search Central processes images in <img>, including inside <picture>, while CSS background images are not indexed as images in Google Images. [9]
When an image is page content rather than decoration, <img> also provides semantics, alt text, intrinsic dimensions and responsive-image controls. CSS backgrounds remain appropriate for decoration, but should not automatically replace content images.
Common mistakes
Frequent problems include one huge file for every viewport, lazy-loading the hero, missing sizes, missing dimensions, too many fetchpriority="high" hints, preloading every format and converting every image type to one codec. [1][6][7][8]
Another mistake is judging optimization only by kilobytes. An aggressively compressed image can look bad, and a very small file can still hurt LCP if it is discovered too late.
A practical image optimization workflow
Start by measuring the page and identifying which images load during startup and which element becomes LCP. Then create realistic size variants, test formats and quality, add dimensions, configure srcset and sizes, and apply lazy loading only to offscreen content.
Finally recheck Network, Performance and PageSpeed Insights. For SEO, verify that important images use standard HTML, descriptive alt text, stable URLs and nearby textual context. Google emphasizes both image quality and page performance. [8][9]
- Identify the LCP image and never lazy-load it.
- Generate several useful widths instead of one oversized master for every viewport.
- Use
srcsettogether with accuratesizesfor width-based variants. - Set
widthandheighton important<img>elements. - Choose formats after testing quality and size rather than following one universal rule.
- Reserve
fetchpriority="high"for the most important image. - Use preload only when it removes a real discovery delay.
- Measure on the real page and under slower network conditions.
