In this guide: How to optimize images for the web without losing quality: correct sizes, modern formats like WebP and AVIF, compression tools and plugins, and lazy loading.
Images often make up the largest part of a web page’s size. Unoptimized photos are one of the most common reasons websites load slowly — and one of the easiest problems to fix. Here’s how to make images light without making them look bad.
The good news: with the right process, you can often cut image weight dramatically with no visible difference.
Resize before uploading. Check the largest size your theme displays images at:
WordPress automatically generates multiple sizes and uses responsive images (srcset) so browsers choose an appropriate size. Uploading a sensible maximum size keeps this efficient.
Always define width and height (WordPress does this for images added via the editor). This prevents layout shifts that hurt CLS — see Core Web Vitals Explained.
Crop to the right aspect ratio so the browser doesn’t download pixels that are hidden.
| Format | Best for | Notes |
|---|---|---|
| WebP | Photos and graphics | Much smaller than JPEG/PNG; supports transparency; very wide browser support |
| AVIF | Photos | Often even smaller than WebP; slower to encode; broad modern browser support |
| JPEG | Photos (fallback) | Universal; use good compression |
| PNG | Screenshots, graphics needing lossless quality | Large for photos |
| SVG | Logos, icons, illustrations | Vector — sharp at any size, tiny files; sanitize uploads for security |
WordPress supports uploading WebP and AVIF (on servers with support). Optimization plugins can also convert existing images automatically and serve modern formats with fallbacks.
Lossy vs lossless:
For most websites, smart lossy compression is the best balance.
Before upload (desktop/web tools):
Automatic (WordPress plugins):
Compare options in Best Image Optimization Plugins for WordPress.
CDN image optimization: some CDNs resize, compress, and convert images on the fly based on the visitor’s device.
Lazy loading delays loading images until they’re about to appear on screen. It saves bandwidth and speeds up initial page load.
loading="lazy" to images by default.fetchpriority="high" to your main hero image for faster LCP.wordpress-dashboard-menu.webp, not IMG_1234.jpg).Further reading: official WordPress documentation
We may earn a commission on purchases made through these links, at no extra cost to you.
Don’t miss the chance to participate in the biggest giveaway of this year.