Images are usually the heaviest thing on a Shopify page, and the first thing people blame when a store feels slow. The usual answer online is "install an image compression app". Sometimes that helps. More often, Shopify image optimization comes down to a few things Shopify already does for you, a few it doesn't, and how your theme asks for images. This guide covers all three, in the order we check them.
- Shopify doesn't compress images on upload, but its CDN resizes them and serves WebP or AVIF to browsers that support them.
- Upload sensibly sized files: 2048 x 2048 px is Shopify's suggestion for square product images. Larger isn't better.
- The main image at the top of the page should never be lazy loaded. Images further down should be.
- Fix the theme before buying an app. Most image problems we see are in how the theme requests images, not in the files.
What Shopify already does with your images
It helps to know what happens between uploading a photo and a customer seeing it.
When you upload, Shopify stores the original. Its Help Center is direct about this: images aren't compressed when you upload them to the admin.
When a visitor loads a page, your theme asks Shopify's CDN for the image at a specific width. The CDN then:
- Resizes the image to the width the theme requests, so a 2048 px original can be sent as a 400 px thumbnail.
- Picks the format. Shopify checks which formats the visitor's browser supports and can serve WebP or AVIF instead of your JPEG or PNG. Shopify notes AVIF isn't used for every image size.
- May compress the image as it's served through the theme.
So a lot of the work people install apps for is already happening. Converting everything to WebP before upload, for example, doesn't buy much, because the CDN already serves modern formats to browsers that can use them.
What Shopify can't do is fix a theme that asks for the wrong size, loads the wrong images first, or reserves no space for them. That's where most of the speed is.
Step 1: get the upload size right
Start with what you put in.
Shopify's product media guidance says:
- For square product images, 2048 x 2048 px usually displays best.
- Product and collection images can be up to 5000 x 5000 px or 25 megapixels.
- Each file must be smaller than 20 MB.
Those are limits, not targets. A 5000 px photo straight from a camera gives the CDN more to process and gives you nothing extra on a phone screen. For most stores we suggest:
- Product images: 2048 px on the longest side, one aspect ratio for the whole catalogue (square or 4:5 portrait are common).
- Full-width banners and hero images: wide enough for large desktop screens, but exported at a reasonable quality rather than maximum.
- Logos and icons: SVG where the theme supports it, otherwise a small PNG.
Compressing files before upload is still worth doing for an old library of very large photos. A normal export from your photo editor at good quality is enough; you don't need to squeeze every kilobyte.
Mixed aspect ratios make collection grids uneven and product galleries jump as customers swipe. Pick one ratio and crop everything to it.
Step 2: check how your theme requests images
This is where we find most of the problems, especially on older or heavily customised themes.
Shopify's Liquid has an image_tag filter that does a lot of the right things by default. Used with image_url, it:
- generates a
srcsetwith a set of widths, so the browser can choose a small file on a phone and a larger one on a big screen; - adds
widthandheightattributes based on the image's aspect ratio; - sets
loading="lazy"automatically for images in sections further down the page.
Shopify's own current themes, such as Dawn and Horizon, are built this way. Problems tend to appear when:
- Custom sections hard-code a single large size, so every phone downloads a desktop-sized image.
- A page builder or app inserts its own
<img>tags withoutsrcset, sizes or dimensions. - Old theme code uses deprecated image filters from before
image_urlandimage_tagexisted. - The
sizesattribute is missing or wrong, so the browser assumes the image fills the whole screen and picks a bigger file than it needs.
You don't need to read Liquid to spot this. Open a product page on your phone, or in Chrome's device mode, and check the image requests in the Network tab: if a thumbnail that shows at 150 px wide is being downloaded at 1500 px or more, the theme is asking for the wrong size.
Step 3: don't lazy load the image that matters most
Lazy loading means the browser waits to download an image until it's about to scroll into view. It's a good default for images below the fold. It's a bad idea for the main image at the top of the page.
That top image is usually the page's Largest Contentful Paint (LCP) element: the biggest thing visible when the page loads. Google's web.dev guidance on optimizing LCP says plainly that you should never lazy load the LCP image, because it delays the most important thing on the page. A good LCP is 2.5 seconds or less.
On a Shopify store, the LCP image is usually:
- the hero image or slideshow on the homepage,
- the first product image on a product page,
- the collection banner, or the first row of product cards, on a collection page.
What to check:
- The first image in the first section loads eagerly, not with
loading="lazy". - That image has
fetchpriority="high", or is preloaded withimage_tag'spreload: true. Shopify recommends using preload sparingly, for above-the-fold images only. - Only one or two images get high priority. web.dev notes that prioritising more than that stops helping.
- Images further down the page are lazy loaded.
A common mistake is a homepage slideshow where every slide is high priority, or where the first slide is lazy loaded because it's inside a carousel that treats all slides the same. Another is a product gallery that loads all ten images up front. Both are small theme fixes.
Step 4: reserve space so the page doesn't jump
When an image loads without the browser knowing its size, the content below it gets pushed down. That's layout shift, measured as CLS, and it's how customers end up tapping the wrong button.
web.dev's guidance on layout shift is to always include width and height attributes on images, or to reserve the space with CSS aspect-ratio. image_tag adds the attributes for you. Custom code and apps often don't.
Watch for:
- product cards where the image area collapses and expands as images arrive;
- banners that use a CSS background image with no fixed height;
- review or Instagram widgets that load late and push the page down.
Step 5: cut images nobody sees
The fastest image is the one that isn't loaded. Look for:
- Hidden slideshow slides that load on mobile even though the slideshow is turned off or hidden on small screens.
- Separate desktop and mobile images where both download on every device.
- Second product images on hover, which make sense on desktop but are downloaded on phones where there is no hover. Some themes let you switch this off.
- Decorative background images that add weight without helping anyone buy.
If you're cutting images, also look at what else loads on the page. Our guide to Shopify apps slowing down your store covers the scripts side.
Step 6: alt text, for people and search
Alt text isn't a speed fix, but it belongs in any image clean-up. It's read aloud by screen readers and helps search engines understand the image.
In the admin, go to Products, open a product, click a media item and choose Add alt text. Shopify's alt text guide recommends keeping it to 125 characters or less. image_tag uses the media's alt text automatically on product images.
Good alt text describes what's in the image and what makes it different: "Linen shirt in sage green, front view, worn open over a white T-shirt" rather than "shirt" or the product name repeated. Since the European Accessibility Act now applies to many EU stores, this is worth doing properly.
Do you need an image optimization app?
Image apps usually do one or more of these: compress your existing files in bulk, convert formats, add lazy loading, or rename files and write alt text.
Before installing one, check each against what you already have:
- Format conversion: Shopify's CDN already serves WebP and AVIF where supported.
- Lazy loading: current themes using
image_tagalready do it, and an app that lazy loads everything can make LCP worse. - Bulk compression: can genuinely help if your library is full of huge camera files. Once it's done, you may not need to keep paying for it.
- Alt text and file names: useful as a starting point, but review what it writes.
The one thing to avoid is an app that adds its own storefront script to "optimise" images in the browser. That's extra code on every page, doing a job the theme should do in Liquid.
How to measure the result
Before changing anything, test three pages in PageSpeed Insights on mobile: the homepage, a collection and your best-selling product. Note LCP and CLS, and which element PageSpeed reports as the LCP element.
After the changes, test the same pages again. Then check Shopify's web performance reports (Analytics → Reports) over the following weeks, since they're based on real visitors and use a 30-day window.
Good signs:
- LCP on mobile moving toward 2.5 seconds or less;
- CLS at 0.1 or less;
- the LCP element loading early in the network waterfall, not after scripts and other images.
Shopify image optimization checklist
- Product images exported at around 2048 px, one aspect ratio across the catalogue
- Very large old files re-exported or compressed once
- Theme uses
image_urlandimage_tag, withsrcsetand a sensiblesizes - First image on each template loads eagerly with high priority
- Everything below the fold lazy loaded
- Every image has width and height or a reserved aspect ratio
- Hidden slides, duplicate mobile images and hover images reviewed
- Alt text added to product media
- Before and after numbers recorded in PageSpeed Insights
When it's the theme, not the images
If your theme is old enough that it predates image_tag, or images are scattered across custom sections and page builder blocks, fixing them one at a time can take longer than moving to a current theme. Our guide to Shopify Horizon migration explains when switching makes sense. If you'd rather keep your theme, image and speed fixes are part of our development services.
When we do this work, we do it on a duplicate of your live theme, agree with you what changes as we go, and publish in one click when it's ready, so the live store keeps running throughout.
FAQ
Does Shopify compress images automatically?
Not when you upload them. Shopify’s Help Center says images aren’t compressed on upload to the admin. When images are served through your theme, Shopify’s CDN can resize them, may compress them and can deliver them as WebP or AVIF if the visitor’s browser supports those formats.
What size should Shopify product images be?
Shopify says 2048 x 2048 px usually displays best for square product images. Product and collection images can be up to 5000 x 5000 px or 25 megapixels and must be smaller than 20 MB. Keep every image for one product in the same aspect ratio so the gallery doesn’t jump.
Should I upload images as WebP?
You can, but it isn’t necessary for speed. Shopify detects which formats the visitor’s browser supports and serves modern formats such as WebP or AVIF where it can. Upload a good-quality JPEG or PNG at a sensible size and let the CDN handle the format.
Do I need an image optimization app for Shopify?
Often not. Most of the gain comes from sensible upload sizes, a theme that requests the right image widths, and not lazy loading the main image at the top of the page. An app can help bulk-compress an old library of huge files, but check what it adds to your storefront before installing it.
