Book a call

Free guide, about 30 minutes

Fix a slow hero image on Shopify (LCP)

Make the first big image on a Shopify home or product page load faster: find the LCP element, stop lazy-loading it, size it properly and test again.

In short. Largest Contentful Paint should be 2.5 seconds or less for at least 75% of real visits. On most Shopify home and product pages, the LCP element is the first big image. Never lazy-load it, mark it with fetchpriority high, serve it at the size it's shown, avoid sliders at the top and delay app scripts that load before it.

Updated

The hero image is the large picture at the top of a home page, or the main photo on a product page. On a phone it is often the last big thing to appear, and Google measures that moment as Largest Contentful Paint, or LCP.

Work on the page your ads send the most people to. You need PageSpeed Insights and access to your theme.

Step by step

Tick each step as you go. Your ticks stay in this browser, so you can come back later.

0 of 9 done
  1. Measure the real number

    Run the page in PageSpeed Insights (pagespeed.web.dev) and choose Mobile. When there are enough visits, the top part shows real Chrome users. Google calls LCP good at 2.5 seconds or less, measured at the 75th percentile of visits.

  2. Find the LCP element

    Further down, PageSpeed Insights names the element that counts as Largest Contentful Paint. Check it is the image you expect; sometimes it is a banner, a video poster or a block of text.

  3. Never lazy-load it

    Lazy-loading tells the browser to wait, which is right for images further down and wrong for this one. In the theme code, the hero image should have loading set to eager, or no loading attribute at all. Many themes do this only for the first section, so keep the hero in the first section.

  4. Mark it as high priority

    Add fetchpriority="high" to that one image, so the browser fetches it before other images. In Liquid, the image_tag filter accepts fetchpriority: 'high'. Use it on one image per page only.

  5. Serve the right size

    Upload a sharp image and let Shopify resize it. The image_url filter with a width, passed to image_tag with widths and sizes, builds a srcset, so a phone downloads a small file instead of the original.

  6. Avoid a CSS background image

    An image set as a CSS background is found late by the browser and can't use srcset. A normal img tag, built with image_tag, loads sooner.

  7. Avoid a slider at the top

    A slider or carousel often hides its first image until a script runs, or loads several large images at once. One fixed image is faster. If you keep a slider, make sure the first slide shows without waiting for the script.

  8. Move app scripts out of the way

    Scripts from apps, chat and popups that load before the image compete with it. Turn off app embeds you don't need in Online Store > Themes > Customize > App embeds, and load the rest later where the app allows.

  9. Re-test on real visits

    Lab results change from run to run. After the change, go to Analytics > Reports in Shopify and search for Largest Contentful Paint. These web performance reports show the 75th percentile of real visits and can lag by up to 36 hours.

Scan your store's speed

When to ask for help

Ask for help if LCP stays above 2.5 seconds after these steps, if the hero comes from a page builder or app you can't edit, or if the theme code that renders it is hard to follow.

Book a call

Pick a time that suits you. The calendar only shows slots we're actually free, and you get an invite straight away.

Booking runs on Google Calendar. Open it in a new tab