In short
On most pages, the largest element visible at load time is an image: header visual, product photo, article illustration. This is what determines the LCP (Largest Contentful Paint). This check consists of making sure the browser discovers it as soon as it reads the HTML, downloads it with priority and waits for nothing before displaying it: an <img> tag in the initial HTML, without loading="lazy", with fetchpriority="high", in a suitable format and size.
Why it matters
The display time of the LCP image breaks down into four phases:
| Phase | What happens | What lengthens it |
|---|---|---|
| Time to first byte (TTFB) | the server produces the HTML | hosting, database, redirects |
| Load delay | the browser has not yet started the image request | lazy loading, image in CSS or injected by JavaScript, low priority |
| Load duration | the image is in transit | weight, format, connection to another domain |
| Render delay | the image is there but not displayed | blocking CSS or scripts, fade-in animation |
This guide mainly covers the second phase, the one most often wasted:
loading="lazy"on the main image: the browser waits until it has computed the layout to know whether the image is on screen, and so until it has downloaded and applied the CSS. The request starts late.- Background image in CSS, or inserted by a carousel script: it does not exist in the HTML. The browser can only request it after loading the CSS or running the script.
- Default priority: images start with low priority and are only promoted once the layout is known. The
fetchpriority="high"attribute removes this wait.
What it improves
- LCP This is the most direct action on this metric when the main element is an image. See target LCP ≤ 2.5 s at the 75th percentile (opens in a new tab).
- Perceived speed The main visual appears early, even if the rest of the page keeps loading.
- Image indexing An
<img>tag withsrcin the HTML is the format Google recommends for discovering images. A useful side effect, not a ranking factor. - Rankings Indirect effect, through Core Web Vitals.
How to check
Identify the LCP element. In the console, on the loaded page:
new PerformanceObserver((list) => {
const entry = list.getEntries().at(-1);
console.log('LCP:', Math.round(entry.startTime), 'ms', entry.element, entry.url);
}).observe({ type: 'largest-contentful-paint', buffered: true });
PageSpeed Insights also identifies the LCP element and details its four phases. See analyze PageSpeed Insights and Lighthouse (opens in a new tab). Test on both mobile and desktop: the element is not always the same.
Check its tag in the initial HTML (not in the DOM after the scripts have run):
curl -s https://example.com/ | grep -o -i -E '<img[^>]*>' | head -n 5
Compliant result: the LCP image appears in this output, with a real src (not a data-src or a placeholder image), without loading="lazy", with fetchpriority="high".
Check the waterfall. In the Network tab, “Priority” column, the image should have high priority from the start and its request should begin right after the HTML request, without waiting for a script.
How to implement
Before you start
Target tag, for a full-width header image:
<img src="/images/hero-1200.webp"
srcset="/images/hero-600.webp 600w, /images/hero-1200.webp 1200w, /images/hero-2000.webp 2000w"
sizes="100vw"
width="1200" height="600"
alt="Workshop seen from the entrance"
fetchpriority="high">
Rules that apply everywhere:
- An
<img>(or<picture>) tag in the server-rendered HTML. If the design requires a CSS background, preload the image (opens in a new tab) withfetchpriority="high". - No lazy loading, native or script-based, on this image.
fetchpriority="high"on a single image per page. Put everywhere, the attribute no longer prioritizes anything.- A lightweight image: WebP or AVIF format (opens in a new tab),
srcsetandsizesvariants (opens in a new tab), compression (opens in a new tab). - The same domain as the page, or a domain already preconnected, to avoid an extra connection negotiation.
- In a carousel, the first slide follows these rules; the following ones use
loading="lazy". - For a header video, what counts is the image in the
posterattribute: treat it as the LCP image.
WordPress
Versions WordPress 6.3 and later (up to 7.1).
Since version 6.3, WordPress itself adds fetchpriority="high" to the first large image in the content and removes loading="lazy" from it. Check that this detection gets it right on your templates: a logo, a banner or a page builder can mislead it.
To force the behavior in a theme template:
the_post_thumbnail('large', [
'loading' => 'eager',
'fetchpriority' => 'high',
]);
To change the number of content images that WordPress excludes from lazy loading:
add_filter('wp_omit_loading_attr_threshold', function (): int {
return 1;
});
With an optimization plugin, script-based lazy loading is added on top of WordPress's and often applies to the main image:
- WP Rocket: recent versions automatically detect and exclude above-the-fold images. For a manual exclusion, add the
data-no-lazy="1"attribute to the tag or enter the file in the exclusions of theMediatab. - LiteSpeed Cache:
Page Optimization > Media Settings, lazy load exclusion field. - Perfmatters: options to exclude the first images and to preload critical images, in the lazy loading settings.
- Elementor, Divi and other builders: a section with a background image produces a CSS background. For the main visual, prefer an image widget, or disable background lazy loading for that section.
Purge the cache after each setting change, then check the HTML again with curl.
Shopify
Versions Online Store 2.0 themes, all Shopify plans, November 2026.
The image_tag filter adds loading="lazy" to images in sections located further down the page. For the main image, set the attributes yourself:
{{ section.settings.image
| image_url: width: 2000
| image_tag:
widths: '600, 1200, 2000',
sizes: '100vw',
loading: 'eager',
fetchpriority: 'high' }}
For a section reused in several places, decide based on its position:
{%- if section.index == 1 -%}
{%- assign image_loading = 'eager' -%}
{%- assign image_priority = 'high' -%}
{%- else -%}
{%- assign image_loading = 'lazy' -%}
{%- assign image_priority = 'auto' -%}
{%- endif -%}
{{ section.settings.image | image_url: width: 2000 | image_tag: loading: image_loading, fetchpriority: image_priority }}
On the product page, apply the same logic to the first image of the gallery (forloop.first). Check the HTML output: the image_tag documentation does not cover fetchpriority, which is passed through as a free HTML attribute.
PrestaShop
Versions PrestaShop 8 and 9, Classic theme.
The Classic theme puts loading="lazy" on all its images, including those visible at load time. In a child theme:
- Product page:
templates/catalog/_partials/product-cover-thumbnails.tpl. Removeloading="lazy"from the cover image (js-qv-product-coverclass) and addfetchpriority="high". - Product lists:
templates/catalog/_partials/miniatures/product.tpl. Only keep lazy loading from the second row onwards, based on the position passed to the template. - Home slider: override
modules/ps_imageslider/views/templates/hook/slider.tplin your theme. For the first slide ({if $smarty.foreach.homeslider.first}), replaceloading="lazy"withfetchpriority="high".
The Hummingbird theme, shipped with PrestaShop 9, has its own templates: apply the same logic to the cover image and the first slide.
Clear the cache in Advanced Parameters > Performance.
Magento
Versions Magento Open Source and Adobe Commerce 2.4.4 to 2.4.9, Luma and Blank themes.
Two cases to check in the initial HTML:
- Product page: the gallery is built in JavaScript. The template inserts a placeholder image (
gallery-placeholder__image) in the HTML so that the main image is discovered early. OverrideMagento_Catalog/templates/product/view/gallery.phtmlin your theme to addfetchpriority="high"to it. - Category pages and Page Builder blocks: thumbnails can carry
loading="lazy"even on the first row, and Page Builder banners use CSS backgrounds. Fix the thumbnail template in the theme, and preload the main banner.
The Hyvä theme exposes these settings more directly; refer to its documentation.
Drupal
Versions Drupal 10 and 11.
Drupal adds loading="lazy" to images whose dimensions are known. For the main image field, open Structure > Content types > your type > Manage display, click the field's gear icon and set the image loading attribute to “Eager”. To add the priority, in montheme.theme:
function montheme_preprocess_image(array &$variables): void
{
if (($variables['attributes']['loading'] ?? null) !== 'eager') {
return;
}
$variables['attributes']['fetchpriority'] = 'high';
}
This code assumes that only one image per page is set to “Eager”.
Wix
Versions Wix Editor and Wix Studio, all plans, November 2026.
Image loading is handled by the platform, with no per-image setting. Your levers are editorial: a still image rather than a slideshow or a video at the top of the page, and no entrance animation on the first screen. The same applies to Squarespace.
Webflow
Versions Webflow Designer, all plans, November 2026.
Select the main image, open its settings and change the loading option from “Lazy” (the default) to “Eager”. Use an Image element rather than a section background image.
Laravel
Versions Laravel 10 to 13.
The Blade template writes the target tag as is. In a list, only the first image gets priority and lazy loading only starts after the first row:
@foreach($products as $product)
<img src="{{ $product->image_url }}"
width="400" height="400"
alt="{{ $product->name }}"
@if($loop->first) fetchpriority="high" @elseif($loop->index >= 4) loading="lazy" @endif>
@endforeach
Symfony
Versions Symfony 6.4 to 8.1, Twig 3.
Same logic in Twig:
{% for product in products %}
<img src="{{ product.imageUrl }}"
width="400" height="400"
alt="{{ product.name }}"
{% if loop.first %}fetchpriority="high"{% elseif loop.index0 >= 4 %}loading="lazy"{% endif %}>
{% endfor %}
Next.js
Versions Next.js 15 and 16 (App Router and Pages Router).
The next/image component lazy-loads images by default. For the LCP image:
import Image from 'next/image';
import hero from './hero.jpg';
export default function Hero() {
return (
<Image
src={hero}
alt="Workshop seen from the entrance"
sizes="100vw"
loading="eager"
fetchPriority="high"
/>
);
}
Since Next.js 16, the priority prop is deprecated: use loading="eager" with fetchPriority="high", or preload if you also want a preload tag in the <head>. On earlier versions, priority does both.
Nuxt
Versions Nuxt 3 and 4, Nuxt Image module 1.x and 2.x.
With the Nuxt Image module:
<NuxtImg
src="/images/hero.jpg"
width="1200"
height="600"
sizes="100vw"
format="webp"
alt="Workshop seen from the entrance"
loading="eager"
fetchpriority="high"
preload
/>
Check that the image is rendered on the server: a component wrapped in <ClientOnly> does not appear in the initial HTML.
Astro
Versions Astro 5.10 and later (up to 7); manual attributes before 5.10.
The Image component outputs loading="lazy" by default. Since Astro 5.10, the priority prop applies loading="eager", decoding="sync" and fetchpriority="high" in one go:
---
import { Image } from 'astro:assets';
import hero from '../assets/hero.jpg';
---
<Image src={hero} alt="Workshop seen from the entrance" priority />
On an earlier version, write the loading="eager" and fetchpriority="high" attributes yourself.
Cloudflare
Versions Cloudflare dashboard, all plans (Polish from the Pro plan), November 2026.
No setting replaces fixing the template, but two features help: automatic conversion to WebP or AVIF (Polish or image transformations, depending on the plan) shortens the download time, and Early Hints (opens in a new tab) bring the request forward if your origin sends a preload Link header for the image.
Warning: CDN or plugin features that replace
srcattributes with placeholder images loaded by JavaScript apply to every image, including the main one. Exclude it explicitly.
Common mistakes
- Leaving
loading="lazy"on the main image because the component or the CMS adds it by default. - Putting
fetchpriority="high"on every image in the first screen: only one should have it. - Keeping the main visual as a CSS background without preloading.
- Loading the first slide through the carousel script: it waits for the library to be downloaded and executed.
- Fading the image in from zero opacity: as long as it is invisible, it does not count, and the LCP is delayed accordingly.
- Serving mobile visitors the image intended for a large screen, for lack of correct
srcsetandsizes. - Preloading a URL different from the one the tag will request: two downloads instead of one.
- Only testing the home page: the article, category and product templates each have their own LCP element.
Frequently asked questions
Should I put loading="lazy" on the main image?
No. With loading="lazy", the browser waits until it has computed the layout, and so until it has downloaded and applied the CSS, to know whether the image is on screen: its request starts late and the LCP slips. The main image should be an img tag present in the initial HTML, with no lazy loading at all, native or script-based, and it should carry the fetchpriority="high" attribute.
What is fetchpriority="high" for?
By default, images start with low priority and are only promoted once the layout is known. The fetchpriority="high" attribute asks the browser to download the image with high priority as soon as it discovers it in the HTML, which shortens the display delay of the LCP image. Put it on a single image per page: put everywhere, it no longer prioritizes anything.
Should I preload the LCP image with link rel="preload"?
Only if it cannot be discovered in the HTML, for example when it is declared as a CSS background or inserted by a carousel script. If the image is an img tag present in the initial HTML, the browser already finds it and fetchpriority="high" is enough. A preload must target exactly the URL that will be requested afterwards, otherwise the image is downloaded twice.
How do I know which image is the LCP element?
PageSpeed Insights identifies the LCP element and details its four phases. In the browser console, a PerformanceObserver of type largest-contentful-paint also shows the element and the image URL. Test on mobile and desktop, as the element is not always the same, and on every template: home, article, category and product pages each have their own.
Resources
- web.dev: Optimize Largest Contentful Paintweb.dev
- web.dev: Optimizing resource loading with Fetch Priorityweb.dev
- MDN: fetchPriority propertydeveloper.mozilla.org
- WordPress: Image performance enhancements in WordPress 6.3make.wordpress.org
- Shopify: image_tag filtershopify.dev
- Next.js: Image componentnextjs.org
- Nuxt Image: NuxtImg componentimage.nuxt.com
- Astro: Images referencedocs.astro.build
Updated on
Topic checklist (PDF)