Find your page's LCP element and get it loading first
Largest Contentful Paint element was the Lighthouse diagnostic that named the image, video or block of text Lighthouse timed as the page's LCP. Lighthouse 13 replaced it with the LCP breakdown insight, which still names the element and splits its time into phases. A separate insight, LCP request discovery, checks whether an LCP image was easy for the browser to find and fetch early. Start by finding out which element it measures: an LCP that's a heading needs different fixes from one that's a hero photo.
Which elements can be the LCP element
Images
An img element, or an image element inside an svg. For animated images such as GIFs, the time the first frame appears counts.
Video
A video element, timed at its poster image or its first frame, whichever shows up first.
CSS background images
An element with a background image loaded through url(). A CSS gradient doesn't count.
Blocks of text
A block-level element holding text. Its size is the smallest rectangle around the text, without padding, borders or margins.
Left out
Elements with zero opacity, elements covering the whole viewport, which Chrome treats as background, and low-detail placeholder images. An inline svg drawing isn't a candidate either.
These rules come from web.dev's LCP guide, which follows the Largest Contentful Paint API. The Lighthouse 13 release notes list the LCP breakdown insight, under its earlier id lcp-phases-insight, as the diagnostic's replacement.
Why the LCP element can change
The browser reports a new candidate each time a larger element finishes rendering, and stops once the visitor taps, scrolls or presses a key. A heading can be the LCP element until the hero image finishes loading and takes over. Images that haven't loaded yet and text still hidden while its web font loads don't count, so a slow font can leave a smaller element as the LCP for a while.
Only an element's first size and position count, so an image that starts off screen and slides in may never be reported, as web.dev's LCP guide explains. Size is measured within the viewport, so a phone and a desktop can pick different elements from the same page. Check the element in both the mobile and desktop reports before you decide what to optimize.
Log the LCP element in the console
// Paste into the DevTools console after the page has loaded
new PerformanceObserver((list) => {
const entries = list.getEntries();
const last = entries[entries.length - 1];
console.log("LCP element:", last.element, Math.round(last.startTime), "ms");
}).observe({ type: "largest-contentful-paint", buffered: true });
Get the LCP element loading early
- Put the image in the HTMLAn image set in CSS or added by a script can't be found while the browser reads the HTML. Use an img element in the HTML your server sends, or preload the image in the head.
- Mark it as high priorityGive the LCP image fetchpriority set to high, and give its preload link the same if you use one. Keep the hint to one or two images, or it stops helping.
- Never lazy-load itRemove loading set to lazy from the LCP image, and check that a lazy-loading script hasn't moved its address into a data-src attribute where the browser can't see it.
- Preload the font behind a text LCPWhen the LCP element is text in a web font, preload that font file and use a font-display value that shows the fallback right away.
Frequently asked questions
Why does Lighthouse pick a paragraph instead of my hero image?
Size is measured as what's visible in the viewport, and an image counts at its displayed size or its file's own pixel size, whichever is smaller. A small image stretched across the screen, a hero that sits below the first screen on phones or a background covering the whole viewport can all lose to a large block of text. web.dev's LCP guide explains how size is measured.
What does LCP request discovery check?
When the LCP element is an image, the insight checks that the image is discoverable from the HTML, either in the markup or preloaded, that it has fetchpriority set to high and that it isn't lazy-loaded. Chrome's LCP request discovery docs list the three conditions.
Where do I see how long each phase of LCP took?
In the LCP breakdown insight, which splits the time into time to first byte, resource load delay, resource load duration and element render delay. Chrome's LCP breakdown docs say most of the time should go to loading the resource rather than to the delays.
Speed up the image or text behind your LCP
- Website speedFind what makes your pages slow enough that visitors leave.
- LCP longer than 2.5sFind which part of loading delays your largest image or text block, then fix it for the whole group of pages.
- Image optimizationChoose smaller image files, reserve their space and delay pictures below the fold.
- Invisible text during font loadingSet font-display on every web font so text shows in a fallback font while the file downloads.