
In this article
- Why images matter for speed and SEO
- Step 1: find your heaviest images
- Step 2: resize to the size you display
- Step 3: choose the right format
- Step 4: compress
- Step 5: set width and height
- Step 6: lazy load, but not the first image
- Step 7: serve the right size to each screen
- Step 8: name files and write alt text
- Step 9: use caching and a CDN
- Watch out for hotlinking and hacked images
- Common questions
- Check your own site now
Images are usually the heaviest part of a web page. A few oversized photos can make a site feel slow, hurt your Core Web Vitals and push visitors away before they read a word. The good news is that image fixes are quick and the gains are large.
This applies to every platform, whether your site runs on WordPress, Shopify, Wix, Squarespace, Webflow or custom code. The rules are the same everywhere.
Why images matter for speed and SEO
- Speed: large files delay the main image on the page, which is often the "Largest Contentful Paint" that Google measures.
- Layout jumps: images without set sizes shift the page as they load, which hurts "Cumulative Layout Shift".
- Search: descriptive file names and alt text help Google understand pictures and show them in image search.
- Accessibility: alt text lets screen readers describe an image to blind and low-vision visitors.
Step 1: find your heaviest images
Run your key pages through the page speed checker and look at the biggest files. Anything over about 200 KB deserves a look, and a photo of several megabytes straight from a phone or camera is almost always the culprit. The Core Web Vitals guide explains the other speed factors.
Step 2: resize to the size you display
Do not upload a 4000-pixel photo to show it 800 pixels wide. Resize it to roughly twice the largest size it appears on screen (for sharp display on high-density screens) before uploading. This single step often cuts a file by 90 percent.
Step 3: choose the right format
- WebP or AVIF: modern formats that are usually 25 to 50 percent smaller than JPEG at the same quality. Supported by all current browsers. Best default.
- JPEG: good for photographs when you cannot use WebP.
- PNG: for graphics that need transparency or sharp edges, but avoid it for photos.
- SVG: best for logos and icons, because it stays sharp at any size and is tiny.
Step 4: compress
Compression removes data you cannot see. Quality around 75 to 85 percent is usually indistinguishable from the original. Free desktop and online tools can do this, and most platforms and plugins can compress automatically on upload.
Step 5: set width and height
Always give each image its dimensions so the browser reserves space before it loads:
<img src="red-shoes.webp" width="800" height="600" alt="Red running shoes on a white background">
This stops the page from jumping around while images arrive.
Step 6: lazy load, but not the first image
Add loading="lazy" to images further down the page so they load only when a visitor scrolls near them. Do not lazy load the main image at the top, since that delays the most important paint. For that one, use fetchpriority="high" instead.
Step 7: serve the right size to each screen
Use srcset and sizes so phones download a small version and large screens get a bigger one. Most modern platforms generate these for you; check the page source to confirm.
Step 8: name files and write alt text
- Use short descriptive file names such as
red-running-shoes.webpinstead ofIMG_4821.jpg. - Write alt text that describes what the picture shows, in a natural sentence. Do not stuff keywords.
- Leave alt empty (
alt="") for purely decorative images so screen readers skip them.
The on-page SEO checker and the accessibility checker flag images with missing alt text. The accessibility checklist covers the rest.
Step 9: use caching and a CDN
Images rarely change, so let browsers keep them for a long time with cache headers. A content delivery network (CDN) serves them from a location close to each visitor. Confirm your headers with the HTTP header checker.
Watch out for hotlinking and hacked images
If your bandwidth suddenly spikes, other sites may be embedding your images directly. And if unfamiliar image files or folders appear on your server, it can be a sign of a break-in. See how to check if your website is hacked.
Common questions
What is a good image file size for a website?
Aim for under 100 to 200 KB for most content images, and smaller for thumbnails. Full-width hero images can be a little larger if they are compressed well.
Should I switch everything to WebP?
For photos, yes, in most cases. Keep a JPEG fallback only if you must support very old browsers.
Does alt text help rankings?
It helps Google understand the image and the page, and it can bring traffic from image search. Its first purpose is accessibility, so write it for people.
Will compression make my images look bad?
Not at sensible settings. Compare before and after at full size; if you cannot tell the difference, keep the smaller file.
Free tools for this problem
- Page speed checker: Lighthouse score, Core Web Vitals, server response and compression.
- On-page SEO checker: Score a page and preview its Google snippet.
- Accessibility checker: Find missing alt text, unlabeled fields, empty links and heading problems.
