Images are almost always the heaviest part of an online store, and they're also the part that sells. Optimizing them means two things: making them load fast, and making them understandable to Google and to people who use a screen reader.
On Shopify, the platform does part of the work. The rest depends on how you prepare and upload your files.
What Shopify already does
Images in a Shopify store go through its content delivery network (CDN), which transforms them before sending them to the browser:
- Format. As the documentation for the
image_urlfilter explains, Shopify detects which formats the visitor's browser supports and picks the one with the best balance of quality and file size, such as WebP or AVIF. You upload a JPEG or PNG, and visitors often receive a lighter format. - Size. The theme can ask the CDN for the same photo at different widths. With the
image_tagfilter, the theme creates asrcset, so a phone downloads a small version and a large screen a large one. - Deferred loading. The same
image_tagsetsloading="lazy"on images in sections further down the page. We cover this in our guide to lazy loading.
This holds if the theme uses these filters, as recent themes do. An old or hand-coded theme may always load the photo at its original size: that's the first thing to check.
How to prepare files before uploading them
Format
According to Shopify's guide to media files, the best format for product photos is PNG, followed by JPEG; WebP, GIF, HEIC, TIFF, BMP and SVG are also accepted. Since Shopify converts the format served to the browser on its own, the upload is mostly about giving it a good original:
- Photos: good-quality JPEG, or PNG if you need maximum quality.
- Logos, icons, graphics with transparency: PNG, or SVG where the theme supports it.
To give you an idea of what modern formats save: according to Google, a lossless WebP is 26% smaller than a PNG, and a lossy WebP is 25 to 34% smaller than a JPEG of comparable quality.
Dimensions
Shopify's limits for product and collection images: up to 5000 × 5000 pixels (25 megapixels) and under 20 MB. Shopify recommends 2048 × 2048 pixels as the size that usually works best for square product photos.
Two practical rules:
- Don't upload huge photos "because Shopify will shrink them anyway." A file of many megabytes gives no visible quality gain over a photo at the recommended size.
- Use the same proportions for main photos. If one photo is square and the next is vertical, the collection grid falls out of alignment. Pick a format (square or 4:5, for example) and use it for every product.
Compression
Before uploading, run your photos through a compression tool (Squoosh, the export plugin of your photo editor, or similar). Lossy compression removes data the eye doesn't notice; lossless compression removes nothing but reduces file size less. For product photos, moderate lossy compression is almost always fine. Always keep the originals.
File name and alt text
File name
Google recommends short but descriptive file names and advises against generic names like IMG_1031.jpg (Google's image guidelines). Rename before uploading:
womens-white-leather-sneakers-side.jpg instead of IMG_1031.jpg.
Hyphens between words, no spaces, no accents.
Alt text
For Google, alt text (alt) is the most important attribute for describing an image, and it serves people who use a screen reader. Describe what can be seen, in the context of the page, without repeating keywords: Google warns that stuffing the alt with keywords worsens the experience and can look like spam.
- Weak: "sneakers"
- Too much: "women's sneakers leather sneakers white sneakers women's shoes"
- Good: "Women's white leather sneakers, side view"
Write a different text for each photo in the gallery: side, sole detail, worn.
How to add it on Shopify
For a product image, from Shopify's SEO guide:
- Go to Products and open the product.
- Click the image, then Edit alt text.
- Enter the text and save.
For a collection or blog post image: open the collection or post, click Update below the image, then Edit image, enter the text and save.
If your catalog is large, alt text can also be added in bulk through the product CSV import or with an app, but proofread it: generated text that's identical for every photo is useless.
Images and speed: where to look
Images weigh most heavily on two metrics Google measures:
- Largest Contentful Paint (LCP): how long the largest element on the first screen takes to appear, often the main photo. That image must not be lazy loaded.
- Cumulative Layout Shift (CLS): how much the page shifts while it loads. Images without width and height are a typical cause.
Under Analytics > Reports, Shopify has reports on these metrics by URL and by page type. For a spot check, use PageSpeed Insights on the homepage, a collection and a product page.
Optimization apps
There are many apps that compress images you've already uploaded, rename files and generate alt text. They can save time on large catalogs. Before installing one, though, remember that Shopify's CDN already handles format and resizing: an app makes sense mainly for compressing the originals and for bulk work on file names and alt text. Also, every app that adds scripts to the store has its own cost in speed.
The checklist
- The theme uses
image_urlandimage_tag(ask whoever develops it, or check that images have asrcset). - Photos uploaded at reasonable sizes (around 2048 × 2048 pixels for square product photos) and compressed.
- The same proportions for all main photos.
- Descriptive file names.
- Different, descriptive alt text for every image.
- Main image at the top without lazy loading, the others lazy loaded.
- Width and height on every image.
For the rest of the product page, see our guide to optimizing product pages. If you'd like us to check your store's images and speed, let's talk.
