Images are beautiful. They make your WordPress site engaging, professional, and compelling. They also make it slow — unless you optimise them.
On most WordPress websites, images account for 50–80% of total page weight. A single unoptimised hero image can weigh more than the rest of the entire page combined. Multiply that by dozens of images across a blog post or product gallery, and you have a site that crawls.
The good news: image optimisation is one of the most impactful and achievable performance improvements you can make to any WordPress site. This comprehensive guide covers every aspect of WordPress image optimisation — compression, resizing, format conversion, lazy loading, and more — with step-by-step instructions for each.
Before optimisation even begins, the single most impactful thing you can do is upload images at the correct size — not at their original camera or design file dimensions.
The problem: A modern DSLR camera produces images at 5000px wide or larger. Your blog post content column is 800px wide at most. Uploading the 5000px original and letting WordPress display it at 800px means the browser downloads a file 6x larger than it needs to.
The fix: Resize images to approximately their display dimensions before uploading.
How to check display dimensions:
<img> elementFree tools to resize before uploading:
General dimension guidelines:
| Image Type | Recommended Max Width |
|---|---|
| Full-width hero image | 1600px |
| Blog post featured image | 1200px |
| Blog post body image | 800px |
| Product image (WooCommerce) | 1000px |
| Thumbnail | 400px |
| Logo | 400px |
| Author avatar | 200px |
Using the right file format for each type of image is one of the easiest ways to dramatically reduce file sizes without any visible quality loss.
JPEG (.jpg) — Best for photographs and images with many colours and gradients. Good compression, wide compatibility. Use for all photos.
PNG (.png) — Best for graphics, logos, screenshots, and images that require transparency. PNG is lossless but produces larger files than JPEG for photographs. Never use PNG for photos — use JPEG instead.
WebP — Google's modern image format. Produces files 25–35% smaller than JPEG at equivalent quality, with support for transparency. Supported by all modern browsers (Chrome, Firefox, Safari, Edge). This should be your default format for new images.
AVIF — Next-generation format, even smaller than WebP. Browser support is still catching up (Chrome and Firefox support it, Safari partially) — use as a progressive enhancement alongside WebP.
SVG — For logos, icons, and simple graphics. Vector-based, infinitely scalable with no quality loss, and typically very small file sizes.
GIF — Avoid unless you specifically need animation. For animated images, consider using short MP4 or WebM videos instead — they're dramatically smaller.
Quick format decision guide:
Even after resizing and choosing the right format, images can often be compressed further — removing metadata, redundant colour information, and optimising encoding — without any visible quality loss.
Compress Before Uploading (Manual):
Compress After Uploading (Plugin):
These plugins process your existing Media Library and automatically compress new uploads going forward:
Smush (free tier — WPMU DEV)
ShortPixel (freemium — 100 images/month free)
Imagify (freemium — 20MB/month free)
EWWW Image Optimizer (freemium)
WebP images are 25–35% smaller than JPEG at equivalent visual quality. Switching your WordPress site to serve WebP images is one of the most impactful format changes you can make.
How to enable WebP in WordPress:
Most image optimisation plugins handle WebP conversion automatically:
These plugins create WebP versions of all your images and serve them to browsers that support WebP, while automatically falling back to JPEG/PNG for older browsers.
Verify WebP is being served:
.webp, WebP is being servedLazy loading defers the loading of off-screen images until the user scrolls near them. Without lazy loading, every single image on your page loads immediately — including ones at the very bottom that most visitors never reach.
WordPress 5.5+ lazy loading:
WordPress added native lazy loading in version 5.5. All images automatically get the loading="lazy" attribute, which modern browsers respect natively — no plugin required.
Verify it's working by inspecting an image element and confirming the loading="lazy" attribute is present.
loading="lazy" on it.Every <img> tag in your page's HTML should have explicit width and height attributes set. This allows the browser to allocate the correct space for images before they finish loading — preventing layout shifts that hurt your CLS (Cumulative Layout Shift) score.
WordPress sets these automatically when you insert images through the block editor using standard image blocks. Problems occur with:
Check for missing dimensions:
In Google PageSpeed Insights, look for the "Image elements do not have explicit width and height" warning.
Fix in the block editor:
Click any image block → check the settings panel on the right → ensure width and height are set.
A desktop hero image displayed at 1400px wide doesn't need to be the same file served to a mobile phone displaying it at 380px wide. Serving identically sized images to all devices wastes bandwidth on mobile.
WordPress srcset — how it works:
WordPress automatically generates multiple image sizes when you upload (thumbnail, medium, large, and any custom sizes your theme defines) and outputs a srcset attribute on <img> tags listing all available sizes. Browsers automatically download the most appropriate size for the user's screen.
Ensure srcset is working:
Inspect any image on your site — it should have a srcset attribute listing multiple image URLs at different sizes. If it doesn't, your theme may be suppressing this.
Add custom image sizes (if needed):
If your theme needs image sizes that WordPress doesn't generate by default, add them in functions.php:
add_image_size( 'hero-mobile', 600, 400, true );
add_image_size( 'hero-desktop', 1400, 600, true );
Serving images from a CDN dramatically reduces load times for visitors who are geographically distant from your server. A CDN caches your images on servers around the world — a visitor in Tokyo gets your images from a Tokyo server, not one in London.
Options:
Most performance plugins (WP Rocket, LiteSpeed Cache) include CDN integration settings where you enter your CDN URL and they automatically rewrite image URLs.
Image optimisation is the most impactful performance improvement available to most WordPress sites. Start by resizing images to the correct display dimensions and switching to WebP format — these two changes alone can reduce your page weight by 60–80%. Then install an image compression plugin to automate the process going forward and bulk-process your existing media library.
The whole process can be completed in an afternoon — and the results will show immediately in your PageSpeed scores, your load times, and your user experience.
Need help auditing and optimising your WordPress site's images? Our performance team handles full image optimisation as part of our WordPress speed optimisation service.
Contact us today