Skip to content

Preloading Images on Shopify: Step-by-Step Guide (2026)

A practical 2026 guide to preloading on Shopify: find your LCP image, give it fetchpriority, use image_tag and preload_tag correctly, preload the right fonts, and skip the preloads that slow a store down.

Preloading Images on Shopify: Step-by-Step Guide (2026)

To preload images on Shopify, find the image that is your Largest Contentful Paint (LCP) element and render it with the image_tag filter, eager loading and fetchpriority="high". Add preload: true or a <link rel="preload"> tag only when the browser finds that image late, for example when it is a CSS background or comes from a JavaScript slider.

A preload is a hint that tells the browser to start a download before it would find the file on its own. On one or two files it makes LCP faster. On many files it makes the page slower, because everything competes for the same bandwidth. This guide walks through the LCP image, fetchpriority, Shopify's image_tag and preload_tag filters, fonts, and the cases where you should not preload at all. Every Liquid example follows Shopify's current theme documentation.

Preloading on Shopify at a glance

ResourceWhat to use on ShopifyWhen
LCP image rendered in Liquid (hero, main product image)image_tag with loading: 'eager' and fetchpriority: 'high'Always, on one image per page
LCP image the browser finds late (CSS background, JavaScript slider)Move it into an <img>. If you can't, preload it with image_tag: preload: true or a <link rel="preload" as="image">Only after a before-and-after test
Theme font used above the foldfont_url | preload_tag: as: 'font', type: 'font/woff2'One or two font files at most
Self-hosted font in /assetsasset_url | preload_tag: as: 'font', type: 'font/woff2'When the font is referenced late, inside a CSS file
Render-blocking CSS and JavaScript in <head>Nothing. Shopify preloads these for youNever add your own
Images below the foldloading="lazy" (the image_tag default from the fourth section down)Always
The next page a shopper opensSpeculation rules (Shopify already prefetches on click or tap)Only for links you are confident about

What does preloading do for Core Web Vitals?

Preloading changes when the browser discovers a file. It does not make the file smaller or the server faster. Shopify's documentation puts the difference clearly: preload discovers a resource that the browser would otherwise find too late, while fetchpriority="high" raises the priority of a resource the browser already knows about.

The Core Web Vitals in 2026 are three metrics, measured at the 75th percentile of page loads:

MetricWhat it measuresGoodDoes preloading help?
Largest Contentful Paint (LCP)When the largest element in the first view finishes rendering2.5 s or lessYes. This is the main metric preloading and fetchpriority improve
Interaction to Next Paint (INP)How fast the page responds to taps, clicks and key presses200 ms or lessNo. INP depends on JavaScript work. Defer scripts and remove unused apps instead
Cumulative Layout Shift (CLS)How much visible content moves while the page loads0.1 or lessSometimes. A preloaded font swaps in earlier, which can reduce a late layout shift

INP replaced First Input Delay (FID) as a Core Web Vital on March 12, 2024. Older guides that say preloading scripts improves FID are out of date: FID is no longer measured, and preloading JavaScript does not fix slow interactions.

Google's web.dev guide to LCP splits it into four parts: time to first byte, resource load delay, resource load duration and element render delay. Its guideline is that the two delay parts should be close to zero, with most of the time spent loading the HTML and the image itself. Preloading and fetchpriority attack the resource load delay: the gap between the HTML arriving and the browser starting to download the LCP image.

Step 1: How do you find the LCP image on your Shopify store?

Start with real user data, then confirm the element in a lab test.

  1. Shopify admin. Go to Analytics > Reports and search for "contentful" to open the LCP report. You can also open the web performance summary from Online Store > Themes. The data comes from real visits over the past 30 days, shown at the 75th percentile.
  2. PageSpeed Insights. Run your homepage, a product page and a collection page. The report names the LCP element for each URL.
  3. Chrome DevTools. Record a load in the Performance panel and open Insights. It shows the LCP element and its resource load delay. In the Network panel, turn on the Priority column to see whether the image downloads at High priority.

Our free Shopify speed test gives you a quick first read before you open DevTools.

On most Shopify themes the LCP element follows the page type:

Page typeUsual LCP elementWhat to do
HomepageThe hero or image banner in the first sectionEager loading and fetchpriority="high" on that one image
Product pageThe first image in the product galleryPrioritize the first gallery image only. Lazy load the rest of the gallery
Collection pageThe collection banner, or the first row of product cardsEager loading for the first few cards, lazy loading for the rest

Check mobile separately. The LCP element on a phone is often different from the one on desktop, especially when the theme shows a separate mobile hero image.

Step 2: Load the LCP image eagerly with fetchpriority="high"

By default the browser discovers every image at Low priority. Only after layout does it work out which images are in the viewport and raise their priority. Shopify's theme documentation recommends fetchpriority="high" on the LCP image to remove that wait. It is a one-line change, and in most themes it does more than a preload tag, because an image that Liquid renders into the HTML is already found early by the browser's preload scanner.

The rules from Shopify's guidance:

  • Use it on one image per page: the hero image or the main product image.
  • Combine it with loading="eager" or no loading attribute. Never combine it with loading="lazy".
  • Prefer the first section (section.index == 1).
  • Don't hide the LCP image behind a fade-in or reveal animation. The LCP event waits for the animation even after the image has downloaded.

Here is the pattern for a hero or image banner section. Shopify's Horizon theme sets the priority the same way, from section.index:

{%- liquid
  assign hero_loading = 'eager'
  assign hero_priority = 'auto'
  if section.index == 1
    assign hero_priority = 'high'
  elsif section.index > 3
    assign hero_loading = 'lazy'
  endif
-%}
{{ section.settings.image
  | image_url: width: 1600
  | image_tag:
      loading: hero_loading,
      fetchpriority: hero_priority,
      widths: '600, 900, 1200, 1600',
      sizes: '100vw'
}}

Write the lazy branch as a positive test, section.index > 3. In the theme editor, in static sections and in Section Rendering API responses, section.index is nil. A test like section.index <= 3 is false for nil and would lazy load the hero in exactly those contexts.

For a collection grid, eager load only the cards a shopper sees first:

{% for product in collection.products %}
  {%- liquid
    if forloop.index <= 4
      assign image_loading = 'eager'
    else
      assign image_loading = 'lazy'
    endif
  -%}
  {{ product.featured_image
    | image_url: width: 400
    | image_tag:
        loading: image_loading,
        widths: '200, 300, 400',
        sizes: '(min-width: 1200px) calc(25vw - 2rem), (min-width: 768px) calc(33vw - 2rem), calc(50vw - 2rem)'
  }}
{% endfor %}

Always give LCP candidates an explicit sizes attribute. If a lazy loading library calculates sizes with JavaScript, the browser can't pick the right file until that script runs.

If your theme still uses the old img_url filter or hand-built CDN URLs, as many older tutorials do, switch to image_url and image_tag. img_url is deprecated, and image_tag adds width, height and a srcset for you.

Step 3: When should you use image_tag with preload: true?

The image_tag filter takes a preload parameter. When it is set to true, Shopify sends a Link HTTP header with rel=preload, including imagesrcset and imagesizes that match the tag's srcset and sizes. It does not change the <img> tag itself.

{{ section.settings.image
  | image_url: width: 1600
  | image_tag:
      preload: true,
      fetchpriority: 'high',
      widths: '600, 900, 1200, 1600',
      sizes: '100vw'
}}

Shopify converts these Liquid preloads into Link headers, which can go out as Early Hints (HTTP 103) before the HTML. That sounds like a free win, but there is a budget. Shopify sends at most 10 preload Link headers per response, and fills them in this order:

  1. Automatic preloads for the render-blocking scripts and stylesheets in your <head>
  2. Stylesheet preloads from stylesheet_tag: preload: true
  3. Other preloads, including fonts from preload_tag
  4. Script preloads
  5. Image preloads from image_tag: preload: true

Anything after the tenth entry is dropped, and image preloads sort last. A theme with 10 or more render-blocking files in the <head> has no room left for an image preload. If a preload you added doesn't appear in the document's Link response header, count the render-blocking files first.

Use preload: true on an image when all of these are true:

  • The image is the LCP element on that page.
  • The browser finds it late, which you can see in the Network waterfall.
  • A before-and-after test with several runs shows a faster LCP.

Web.dev also notes that browsers may not support responsive images in header-based preloads, which is one more reason to test instead of assuming. If the image is already in the HTML near the top of the page, fetchpriority="high" is the better tool.

Step 4: Fix images the browser can't discover early

Three theme patterns hide the LCP image from the preload scanner. Fix the pattern first. Preload only if you can't.

CSS background images

A hero set as background-image is found only after the CSS downloads and parses. Shopify recommends an <img> positioned absolutely with object-fit: cover instead, which is how Dawn and Horizon build their hero media. If the background must stay, preload the same files the CSS uses, mirroring its sizes:

<link
  rel="preload"
  as="image"
  fetchpriority="high"
  href="{{ section.settings.image | image_url: width: 1600 }}"
  imagesrcset="{{ section.settings.image | image_url: width: 800 }} 800w,
               {{ section.settings.image | image_url: width: 1200 }} 1200w,
               {{ section.settings.image | image_url: width: 1600 }} 1600w"
  imagesizes="100vw"
>

Put the tag at the top of the section's markup, before the element that uses the background. The browser then finds the image as soon as it parses the section, instead of waiting for the CSS. If the URLs or sizes don't match what the CSS actually uses, the browser downloads a second image and the preload only adds weight.

JavaScript lazy loaders and sliders

Libraries such as lazysizes replace src with data-src, so the browser can't see the image URL until the script runs. Replace data-src with src, use native loading="lazy" for images outside the first view, and remove the library. In a slider, only the first slide can be the LCP element. Give it eager loading and let the other slides load lazily.

Separate mobile and desktop hero images

Many themes render two hero images and hide one with CSS. The browser downloads both, and often only the desktop image gets fetchpriority. Use one <picture> element with a mobile <source> and put fetchpriority="high" on the inner <img>, so it applies to whichever source the browser picks.

Step 5: Should you preload fonts on Shopify?

Preload a font only if text in the first view uses it and the browser finds it late. A font referenced inside a separate CSS file is the first valid use case that Shopify's documentation lists for preload, because the browser can't see it until the CSS has downloaded and parsed.

For a font chosen in the theme editor, the font_url filter returns the woff2 file from the Shopify CDN, normally under /cdn/fonts/ on your own domain. Shopify's example for a layout head, based on Horizon, looks like this:

{%- unless settings.type_body_font.system? -%}
  {{ settings.type_body_font | font_url | preload_tag: as: 'font', type: 'font/woff2' }}
{%- endunless -%}

Font preloads must be CORS-enabled, even for fonts on your own domain. Without the crossorigin attribute, the browser fetches the font twice. preload_tag adds crossorigin="anonymous" by itself when as is font, so don't pass it again. If you write a plain tag, as Dawn does, add it yourself:

<link rel="preload" as="font" href="{{ settings.type_body_font | font_url }}" type="font/woff2" crossorigin>

A few more font rules for Shopify themes:

  • Preload one or two font files at most, usually the body font or the heading font used in the first view. Don't preload bold and italic variants as well.
  • For a licensed font that isn't in Shopify's library, upload the woff2 file to /assets and preload it with asset_url | preload_tag. Shopify recommends this over loading from Google Fonts, because it removes a connection to another domain.
  • Use font_face: font_display: 'swap' so text shows in a fallback font while the web font loads, and tune the fallback with size-adjust to reduce layout shift when it swaps.
  • Place font preloads and your base stylesheet above {{ content_for_header }}. Shopify streams most storefront pages, and everything above that tag reaches the browser while your sections are still rendering.

What should you not preload on Shopify?

Shopify's guidance is to use preload for one or two resources that the browser discovers late, and to test every change. Leave these out:

  • Render-blocking CSS and JavaScript in the <head>. Shopify scans the rendered head on every response and preloads up to 10 of them automatically. Your own preload for the same file wastes a slot.
  • Images that are already in the HTML near the top. The preload scanner finds them. Use fetchpriority="high" on the LCP image instead.
  • More than two resources. If too many files are high priority, none of them really are. This replaces the "two to five images per page" advice that older guides, including the first version of this one, used to give.
  • Images below the fold, gallery thumbnails, the second and later carousel slides, and decorative backgrounds.
  • The wrong breakpoint. A desktop hero preloaded on mobile is pure waste.
  • JavaScript, to fix slow interactions. It won't help INP. Use defer on non-critical scripts, remove apps you no longer use and load code on interaction.
  • A preconnect to cdn.shopify.com. Shopify already sends one, and theme assets now load from a /cdn path on your own domain. Preconnect only to late-discovered third-party origins, such as a video host.

Chrome shows a console warning about three seconds after the load event when a preloaded file isn't used. Treat that warning as a bug to fix.

Preload, prefetch, prerender and preconnect: what is the difference?

HintWhat it doesWhich pageOn Shopify
preloadDownloads a file early, at high priorityCurrent pageOne or two late-discovered files: an LCP image, a font
fetchpriorityRaises or lowers the priority of a file the browser already knows aboutCurrent pagehigh on the LCP image, low on off-screen slides
prefetchFetches a likely next page during spare time, without rendering itNext pageOn by default: since June 2025 Shopify sends speculation rules that prefetch when a shopper presses or taps a link
prerenderLoads and renders the whole next page in the backgroundNext pageOnly for high-confidence links, such as a "View product" button. Watch for early analytics events and stale cart content
preconnectOpens the connection to another domain earlyCurrent pageShopify preconnects to the first three third-party origins in your head. Add your own only for origins found late

Shopify reports that its default prefetch rules make same-site navigations in Chromium browsers about 220 ms faster at the median on desktop and about 20 ms faster on mobile. Safari and Firefox ignore speculation rules for now.

How do you test that preloading worked?

  1. Record a baseline. Note LCP at the 75th percentile in Shopify's web performance report, and the PageSpeed Insights result for the same three page types.
  2. Make one change at a time. Add fetchpriority first, then test a preload only if the image is still discovered late.
  3. Check the waterfall. In the DevTools Network panel the LCP image should start early and show High in the Priority column.
  4. Check the Link response header on the document request. It lists every preload Shopify sent, so you can see whether yours survived the 10-entry limit.
  5. Check the console for unused preload warnings.
  6. Compare several runs. Lab results vary from run to run, so average a few.
  7. Confirm in field data. Shopify's report covers the past 30 days of real visits, so give a change a few weeks before you judge it.

Preloading is one part of a faster store. Our guide to speeding up a Shopify website covers apps, scripts and Liquid, and the Shopify image optimization checklist covers file sizes and formats.

Can an app handle preloading for you?

An image app can compress and convert your files, which shortens the resource load duration. It can't decide which image is your LCP element on each template, and it can't fix a hero built as a CSS background. That work lives in theme code. When we build or rework a theme, we set the LCP image, fetchpriority, font preloads and head order per template, then check the result in field data. If your theme needs that, see our Shopify theme development service.

FAQ

How do I preload an image in Shopify?

For the main image at the top of the page, render it with image_tag and set loading: 'eager' and fetchpriority: 'high'. That is usually enough, because the browser finds an image in the HTML early. Add preload: true to image_tag, or a <link rel="preload" as="image"> in the head, only when the image is discovered late, such as a CSS background, and only if a test shows a faster LCP.

How many images should I preload on a Shopify page?

Usually none or one. Shopify's guidance is to preload only one or two critical resources per page in total, fonts included. Use fetchpriority="high" on the single LCP image and lazy load everything below the fold.

Does preloading improve Shopify SEO?

It can improve LCP, which is one of the Core Web Vitals that Google uses as a ranking signal. A faster LCP alone won't move rankings much, though. Content, links and crawlability matter more, and a bad preload can make LCP worse. Measure the change in field data instead of assuming it helped.

Does Shopify lazy load images automatically?

Yes, when you use image_tag without a loading attribute. It applies loading="eager" to images in the first three sections and loading="lazy" from the fourth section down. It also loads eagerly when section.index is nil, for example in the theme editor. Themes that hard-code loading="lazy" on the hero override this and slow down LCP.

Is fetchpriority supported in all browsers?

All current major browsers support it. Web.dev lists support from Chrome and Edge 102, Firefox 132 and Safari 17.2. Older browsers ignore the attribute, so adding it carries no risk.

What is the difference between preload and prefetch?

Preload downloads a file the current page needs, right away and at high priority. Prefetch downloads something the shopper will probably need on the next page, at low priority. Shopify already prefetches pages when a shopper presses or taps a link, so most stores don't need to add prefetch hints by hand.

Want this kind of result on your store?

We do Shopify SEO that moves rankings and revenue — not just impressions.

The checklist we run before touching a client's code

Get it by email, plus a few short notes over the next two weeks: what we see most often on Shopify stores and what actually fixes it.

No spam. Unsubscribe anytime. Privacy Policy

Want more of our posts in your Google results? Add Codersy as a preferred source.

Add Codersy on Google(opens in a new tab)