Optimize images for the web
Images are usually the heaviest part of a page. Getting them to the right size often cuts load time more than any other change.
The rule
Upload images no larger than they'll be shown, then compress them. A phone photo of 4,032 by 3,024 pixels and 5 MB shown in a column 800 pixels wide wastes about 95% of its data.
Target sizes
| Image use | Width to upload | Target file size | Format |
|---|---|---|---|
| Full-width banner or hero | 1,600 to 2,000 px | 100 to 250 KB | WebP or JPEG |
| Image in a blog post or page | 800 to 1,200 px | 50 to 150 KB | WebP or JPEG |
| Product photo | 800 to 1,200 px | 50 to 120 KB | WebP or JPEG |
| Thumbnail or card | 300 to 600 px | 10 to 40 KB | WebP or JPEG |
| Logo | 2x the shown size, often 400 px wide | Under 30 KB | SVG, or PNG |
| Icons | Any | Under 5 KB | SVG |
| Background texture | 1,600 px or smaller | Under 100 KB | JPEG or WebP |
For sharp images on high-density screens (such as phones and recent laptops), use about 2x the width at which the image is shown, no more. A card shown at 400 px wide can be 800 px.
Pick a format
| Format | Best for | Notes |
|---|---|---|
| JPEG | Photos | Quality 70 to 80 is usually fine. 85 or more rarely looks better |
| WebP | Photos and graphics | Typically 25 to 35% smaller than JPEG at similar quality. Works in all current browsers |
| AVIF | Photos | Smaller still, but slower to make. Optional |
| PNG | Screenshots, sharp graphics, transparency | Large for photos. Avoid for them |
| SVG | Logos, icons, simple drawings | Scales to any size, tiny files |
| GIF | Avoid | Use a short MP4 or WebM for animation |
Resize and compress before you upload
Free tools that work well:
- Squoosh (
squoosh.app) in your browser. Resize, pick WebP, move the quality slider, watch the file size. - ImageOptim on Mac. Drag files in to compress them.
- Preview on Mac (Tools → Adjust Size) or Photos on Windows (resize).
- TinyPNG for PNG and JPEG.
Steps:
- Resize to the width in the table.
- Export as WebP or JPEG at quality 75.
- Check the file size against the target.
- Name it clearly, such as
sourdough-loaf.webp, notIMG_4021.webp.
WordPress
- WordPress creates smaller copies of each upload automatically. It still stores your original, so upload an already-sized image.
- LiteSpeed Cache can compress and convert images and lazy-load them. See LiteSpeed Cache explained.
- Add alt text to each image. It helps visitors who use screen readers, and search engines.
- Don't use a full-size image in a page and shrink it with settings in the editor. The browser still downloads the large file.
Stop layout jumps
Images without set dimensions cause the page to shift when they load. That counts against your CLS score. Give each image a width and height.
<img src="/images/sourdough-loaf.webp"
width="800" height="533"
alt="A sourdough loaf on a wooden board"
loading="lazy">
loading="lazy" delays images below the first screen. Don't use it on the largest image at the top of the page, because that delays your LCP. See Core Web Vitals for small business sites.
Check what you've done
Run a test. See Test your site's speed properly. In the waterfall, any image over about 200 KB deserves a second look.
Find images already on the server
- Go to Account → Hosting → your site → Files → File manager. Open
wp-content/uploads. - Sort by size, largest first.
- To bulk-compress WordPress images, use a plugin and back up first. See Keep your own off-site copy.
Large uploads also use storage. See See what's using your storage.
Still stuck? Ask us and we'll walk you through it.