How to optimize the main image for page speed
Largest Contentful Paint (LCP) is the time it takes for the biggest image or text block on a page to appear. On product pages, that’s often the main photo. First check whether the image download is what slows LCP down. If it is, serve a smaller file sized for each screen and measure again.
Does a smaller main image make the page load faster?
Yes, when that image’s download is the slow part. A smaller image can make the main content appear sooner, but if the page is still waiting on JavaScript or styles, the paint time may not change.
High confidence. Strong evidence, or the platform says so in its own docs. Based on 2 sources: 2 official docs.
What to do
Use a mobile performance trace to find the main image. If its download is slow, serve sizes that match how it’s displayed and compress it. Then test the paint time again.
On this page
Is your main image slowing down LCP?
Find out with a mobile performance trace. In Chrome DevTools, open the Performance panel and record a page load with mobile throttling turned on. Find the LCPLCPLargest Contentful Paint: how long it takes for the biggest image or text block on a page to appear. Google calls under 2.5 seconds good. marker and check which element it points to. If it’s a product image, note when its download starts, how long it takes, and how long the browser waits to show it afterward.
Each answer points to a different fix. If the download itself is slow, make the file smaller. If the download starts late, check how the page tells the browser about the image. If the image arrives fast but stays hidden until a script finishes, fix that script first. Compressing the file won’t help with the last two.
Bottom line
Find the biggest of the three delays before you touch the image file.
How to serve responsive images
Say your backpack page sends a 2,400-pixel-wide, 520 KB photo to every device, even phones. Create smaller copies of the same photo, such as 480, 960 and 1,440 pixels wide. List them in the srcset attribute, which tells the browser which sizes exist. Then use the sizes attribute to say how wide the image appears in your layout. The browser picks the best file for each screen.
In this example, a phone might now download a 75 KB version instead of 520 KB. Your numbers will differ, so measure them. Zoom in on fine details, like stitching, to check that compression didn’t blur what customers need to see.
Use a modern format such as WebP or AVIF if your platform supports it. Set width and height so the browser can reserve space for the image. Add fetchpriority="high" only if this image really is the LCP element.
<img
src="/images/trail-20-960.webp"
srcset="/images/trail-20-480.webp 480w,
/images/trail-20-960.webp 960w,
/images/trail-20-1440.webp 1440w"
sizes="(max-width: 600px) 100vw, 600px"
width="960"
height="720"
alt="Trail 20 backpack with its front pocket open"
> Bottom line
Before you roll it out, check which file a phone and a desktop actually download. The Network tab in DevTools shows it.
Check the result: file size and paint time
Test before and after on the same device and network settings. Run a few tests with the cachecacheA saved copy of a page that can be sent to visitors quickly instead of building the page from scratch each time. disabled, using the checkbox in the DevTools Network tab. Record which file loaded, its size, and when the image appeared. Check a wide screen too, to catch a blurry image or a wrong sizes value.
If the file is smaller but the image appears no sooner, look at the gap between the download finishing and the image showing. A carousel waiting for JavaScript, for example, can use up the time you saved. Once enough real visits come in, check field datafield dataSpeed measurements from real visitors using Chrome, collected over the last 28 days., the measurements from real visitors, in PageSpeed InsightsPageSpeed InsightsGoogle’s free tool that measures how fast a page loads, with both real-visitor and test results. or Search ConsoleSearch ConsoleGoogle’s free dashboard for site owners. It shows which searches bring people to your site and flags problems Google finds..
Bottom line
A smaller file is only a win if the image shows up sooner. Measure when it appears, not just its size.
Should you lazy-load the main image?
No, not if it’s the LCP image. Lazy loading tells the browser to wait before downloading an image until it’s close to the screen. That’s useful for images further down the page. On the first image people see, it can delay the download.
Find the LCP element on a phone-sized screen. If it’s the main image, check the HTML for loading="lazy". Remove it from that image, then rerun the same mobile trace and compare when the download starts.
Keep lazy loading on the detail shots below the product specs. Test both a product page and a listing page. In the cited WordPress test, loading the first images right away helped the tested archive page more than the single post.
Bottom line
Lazy-load images further down the page, but load the first image people see right away.
See the evidence for Lazy-load the main image
No. Lazy-loading the main image can delay when people see it. In a WordPress lab test, loading the first visible images right away sped up an archive page’s main content but barely changed a single page.
Lazy-loading pushes an already-visible image’s request later. The WordPress test showed a noticeable change on archive pages and little change on single pages, so check your own templates.
- The performance effects of too much lazy loading
Median LCP dropped 14% desktop and 18% mobile on the tested archive when early images loaded eagerly. It changed by about 1% in either direction on the single page.
- Optimize Largest Contentful Paint
Chrome’s guide advises eager loading for the LCP image, because lazy loading can hold its request until layout confirms it should be loaded.
The evidence
Responsive images can reduce downloaded bytes and shorten the image request. Chrome’s example shows why the visible load time can stay the same if another resource still delays painting.
- Serve responsive images
The guide explains that serving a smaller, correctly sized candidate can reduce an LCP image’s resource load duration, particularly when desktop-sized images were being sent to mobile devices.
- Optimize Largest Contentful Paint
In the illustrated waterfall, compression shortens the image download but does not change the paint time. The saved time shifts to the wait before rendering.
Every source above was checked against the original by a second reviewer. How we rate the evidence