Speed & Performance
Your Shopify hero image loads last. Here is how to make it load first.
On most Shopify homepages, the biggest thing on the first screen is the hero: the large banner image at the top. Google measures how long it takes to appear and calls it Largest Contentful Paint. Under 2.5 seconds counts as good. On many stores we test, the hero is one of the last things to arrive, so shoppers look at an empty or grey box while everything else loads around it.
This guide shows how to find out why your hero is slow and how to fix each cause, with Liquid examples you or your developer can apply on a copy of your theme.
Step 1: confirm the hero is the problem, and which part of it
- Run your homepage through PageSpeed Insights and open the mobile result.
- Find the diagnostic that names your Largest Contentful Paint element. If it is your banner image or a slide, this guide applies.
- Look at the breakdown of that time. PageSpeed Insights splits it into four parts, and each one points to a different fix:
- Time to first byte: how long the server took to send the page. On Shopify this is rarely the main problem.
- Resource load delay: how long the browser waited before it even started downloading the hero. A long delay means the browser found the image late.
- Resource load duration: how long the download itself took. A long duration means the file is too big for a phone.
- Element render delay: how long the downloaded image waited before it was shown. A long delay here usually means scripts or a slideshow are holding it back.
Fix the largest of the four first.
Long download: the image is too big for phones
A banner uploaded at 3,000 to 4,000 pixels wide is often sent to phones at full size. Shopify can resize images automatically, but only if the theme asks for sensible sizes. In the section that outputs the hero, use Shopify's responsive image tag:
{{ section.settings.image
| image_url: width: 2000
| image_tag:
widths: '375, 550, 750, 1100, 1500, 2000',
sizes: '100vw',
loading: 'eager',
fetchpriority: 'high' }}
The browser then picks the smallest file that looks sharp on the screen in front of it, and Shopify serves modern formats such as WebP automatically. Also check the original: around 2,000 pixels wide is enough for almost any banner.
Use a separate image for phones
A wide landscape banner is a poor fit for a tall phone screen: it either shrinks to a thin strip or gets cropped, and the phone still downloads a large image. Many themes have a separate mobile image setting on the banner or slideshow section. Use it with a portrait crop. If yours does not, a <picture> element can serve a different crop below a set width:
{%- assign desktop = section.settings.image -%}
{%- assign mobile = section.settings.image_mobile | default: desktop -%}
<picture>
<source media="(max-width: 749px)"
srcset="{{ mobile | image_url: width: 750 }} 750w,
{{ mobile | image_url: width: 1100 }} 1100w"
sizes="100vw">
{{ desktop | image_url: width: 2000 | image_tag:
widths: '1100, 1500, 2000', sizes: '100vw',
loading: 'eager', fetchpriority: 'high' }}
</picture>
The setting name (image_mobile above) depends on your theme, or it needs adding to the section schema.
Long load delay: the browser finds the hero late
The browser can only download an image once it knows it exists. Three common patterns hide the hero until late:
- The hero is a CSS background image. Something like
style="background-image: url(...)", or a background set in a stylesheet, is only discovered after that CSS has loaded and applied. Replace it with a real<img>using the image tag above, positioned with CSS so the design does not change. - The hero is lazy-loaded. If the image tag has
loading="lazy", the browser deliberately waits. The hero should always beloading: 'eager'. Keep lazy-loading for images further down the page. - A script inserts the hero. Some slideshow and page builder sections add the image with JavaScript after the page loads. Output the first slide's image directly in the Liquid, so it is in the page from the start.
The fetchpriority: 'high' option in the examples above tells the browser this image matters more than the others it found at the same time. Use it on the hero only.
Long render delay: the image is ready but not shown
Slideshows that wait for JavaScript
Many slideshow sections keep every slide hidden until their script has set them up. On a slow phone that script can finish seconds after the image arrived. Make the first slide visible by default in the theme CSS and hide only the others. Or ask whether you need a slideshow at all: a single strong image usually loads faster and is easier for shoppers to take in.
Scripts that block the page
If PageSpeed Insights lists render-blocking files, the browser cannot show anything, the hero included, until they finish. Move non-essential scripts to load with defer or after the page is usable, and remove leftovers from apps you no longer use. Our guide to finding what slows a Shopify store down on mobile covers how to track them down.
Text in the hero that waits for a font
If the largest element is a headline over the image rather than the image itself, a custom web font may be delaying it. Fonts set in the theme editor already use font-display: swap in current Shopify themes. Check any fonts that were added by hand.
A video hero
An autoplaying video in the first screen is often several megabytes on its own. Give the video a poster image, a light still frame that shows straight away, and consider showing only that image on phones. If the video is important to the brand, place it further down the page instead.
Step 2: check the result
- Make the changes on a duplicate theme (Online Store > Themes > Duplicate), preview it on a phone, then publish.
- Run PageSpeed Insights again and compare the main content time and its four-part breakdown with your first run.
- Watch the Core Web Vitals report in Google Search Console. It is based on the last 28 days of real visitors, so it improves gradually over the following weeks.
The hero is usually the single biggest win for mobile speed, and often the quickest. If your store also stays blank before the hero appears, start with our guide to a Shopify homepage that is blank on mobile. And if you would rather have it done, hero and first-screen fixes are part of our Shopify speed optimisation work.