Skip to content
Sidebar

Optimize Shopify Images for Speed: A Step-by-Step Guide (2026)

Optimize Shopify Images for Speed: A Step-by-Step Guide (2026)

1) Stage safely (2 minutes)

  • Online Store → Themes → … → Duplicate your live theme.
  • Work on the staging copy; only publish after you test mobile & desktop.
  • If you’re nervous about deploying changes, skim: Safe Theme Updates on Shopify.

2) Find your heavy hitters (5 minutes)

  • Run Lighthouse on Home, a key Collection, and a Product page.
  • Note the LCP element (often the hero) and images > ~200–300 KB on mobile. Those are your targets.

Want the bigger picture of speed strategy? Read later: Shopify Site Speed Optimization: Improve UX and Conversions.

3) Choose the right format

  • WebP for photos/marketing images.
  • JPEG as fallback if needed (progressive).
  • PNG only for true transparency/UI elements.
  • SVG for logos/icons.

(If your current theme makes media feel heavy, consider switching to a design that treats images right. See live demos: Modern, responsive Shopify themes.)

4) Compress safely (export once, use everywhere)

  • WebP (lossy): quality ~70–85
  • JPEG: quality ~60–75 (progressive)
  • Target ≤150–200 KB for above-the-fold hero on mobile; ≤80–120 KB for product/collection cards.

5) Make images responsive with srcset + sizes

Let the browser choose the best width. Paste this into your section/snippet and adjust sizes to match your layout:

{%- assign widths = "320,480,640,768,960,1200,1440,1920" | split: "," -%}

<img

  src="{{ image | image_url: width: 768 }}"

  srcset="{% for w in widths %}{{ image | image_url: width: w }} {{ w }}w{% unless forloop.last %}, {% endunless %}{% endfor %}"

  sizes="(max-width: 480px) 100vw, (max-width: 768px) 92vw, (max-width: 1200px) 86vw, 1200px"

  width="{{ image.width }}" height="{{ image.height }}"

  alt="{{ image.alt | escape }}"

  loading="lazy" decoding="async">

6) Prevent layout shift (CLS) the easy way

Always set intrinsic width/height (as in the snippet above) or use a ratio wrapper:

.media-card { aspect-ratio: var(--card-ratio, 4 / 5); overflow: hidden; }

.media-card img { width: 100%; height: 100%; object-fit: cover; }

This locks the slot before the image loads, so nothing jumps.

7) Lazy-load everything (except the LCP)

  • Non-critical images: keep loading="lazy" + decoding="async".
  • Do not lazy-load the hero/LCP image.

8) Give your hero (LCP) VIP treatment

Load the hero eagerly, with responsive widths and proper priority:

<img

  src="{{ section.settings.hero_image | image_url: width: 1920 }}"

  srcset="

    {{ section.settings.hero_image | image_url: width: 960  }} 960w,

    {{ section.settings.hero_image | image_url: width: 1440 }} 1440w,

    {{ section.settings.hero_image | image_url: width: 1920 }} 1920w"

  sizes="100vw"

  width="{{ section.settings.hero_image.width }}"

  height="{{ section.settings.hero_image.height }}"

  alt="{{ section.settings.hero_image.alt | escape }}"

  loading="eager" fetchpriority="high">

Now your fold renders fast and stable—what shoppers actually feel.

9) Backgrounds & banners (when you can’t use <img>)

Prefer <img> for real content. If you must use CSS backgrounds, swap sources per breakpoint:

<style>

  .hero { background-image: url('{{ section.settings.hero_image | image_url: width: 960 }}'); }

  @media (min-width: 1024px) {

    .hero { background-image: url('{{ section.settings.hero_image | image_url: width: 1920 }}'); }

  }

</style>

10) Product & collection images: keep them consistent

  • Standardize the aspect ratio (e.g., 1:1 or 4:5) across cards.

Center crop where needed:
{{ product.featured_image | image_url: width: 800, crop: 'center' }}

  • PDPs can use larger widths (1200–1600) with srcset.
  • Technical products? Use object-fit: contain.

Ready to see fast, conversion-focused layouts in action? Browse our Shopify theme demos.

11) Preload the hero & keep caches clean

Preload the main hero so the download starts earlier:

<link rel="preload" as="image"

  href="{{ section.settings.hero_image | image_url: width: 1440 }}"

  imagesrcset="

    {{ section.settings.hero_image | image_url: width: 960  }} 960w,

    {{ section.settings.hero_image | image_url: width: 1440 }} 1440w,

    {{ section.settings.hero_image | image_url: width: 1920 }} 1920w"

  imagesizes="100vw">

When you replace assets, version filenames (e.g., hero-v2.jpg) to bust cache. And avoid “double-optimizing” (two apps compressing the same file).

Final checklist (copy/paste)

✅ Non-critical images: lazy + async

✅ Hero (LCP): eager + fetchpriority=high + srcset

✅ width/height (or aspect-ratio) set → no CLS

✅ WebP/JPEG used appropriately; PNG only for true transparency

✅ sizes matches layout (no 2000px resource into a 360px slot)

✅ Backgrounds swapped by breakpoint or converted to <img>

✅ Re-run Lighthouse: improved LCP/CLS/INP

What to read next (only the useful ones)

Want the shortest path to a faster, higher-converting storefront? Start with a theme that’s already optimized for responsive media, Core Web Vitals, and clean UX patterns.
👉 Preview Ella Theme demos — then apply your brand in minutes.

Previous Posts
Next Posts

Bring your ideas to life for 1 $/month

Start Shopify for Free, then enjoy your first 3 months for $1/ month.

Our Expertise

We utilise our experience as Designers & Developers to offer an unparalleled level of service and efficiency.
Theme Design

We’ve a team of talented designers. We specialise in making absolute Shopify & BigCommerce themes for your store.

Theme Development

We’ve a team of talented programmers. Our high-quality products always bring users the best experience of shopping

Theme Customization

We also provide customization service for Shopify & BigCommerce to satisfy special requirements & turn them into the best.

Theme Expert

We are experts. Custom BigCommerce & Shopify themes & designs for 200+ businesses in over the world. Showcase

Thanks for subscribing!

This email has been registered!

Veloza has officially launched on the Shopify Theme Store! Discover our newest theme, designed to help you create a stunning and seamless shopping experience.

Login

Currency

Shopping Cart
0 items
Shopify Only Charges $1 In The First 3 Months. TRY IT FREE