The direct answer: convert your images to WebP or AVIF, target a file size between 50 and 150 KB for content images, and use lossy compression at 75–85% quality. The human eye rarely notices the difference—and you'll reclaim most of the performance gain right there.
Images account for 50–70% of a typical webpage's total weight. When left unoptimized, they slow down load times, tank your Core Web Vitals scores, and cost you search rankings. The good news: optimizing images doesn't mean publishing blurry photos. It means choosing the right format, the right compression level, and serving images the smart way.
This guide covers everything you need: modern formats, free and paid tools, implementation techniques, and the most common mistakes to avoid. Follow the steps in order and you'll see results from day one.
1. Choose the Right Image Format
Format choice is the single most impactful decision. Using JPEG where PNG belongs—or vice versa—can triple file size needlessly.
Recommended Modern Formats
- WebP: Supported in all modern browsers since 2020. Delivers 25–35% smaller files than JPEG at equivalent quality. Use it as your default for photos and rich-color graphics.
- AVIF: Up to 50% lighter than JPEG. Growing support (Chrome, Firefox, Safari 16+). Ideal for sites that prioritize maximum performance.
- SVG: For logos, icons, and vector graphics. Scales losslessly to any resolution and weighs very little.
- PNG: Reserve for images that require transparency and where SVG doesn't apply. Avoid for photographs.
When to Keep Using JPEG
If your hosting environment or CMS doesn't support automatic conversion and you need universal compatibility, JPEG is still a valid option for photos. Target 80% quality as a good balance point.
| Format | Best use | Transparency | Relative size |
|---|---|---|---|
| WebP | Photos, banners, graphics | Yes | Low |
| AVIF | High-quality photos | Yes | Very low |
| SVG | Logos, icons | Yes | Very low |
| PNG | Screenshots, complex transparency | Yes | High |
| JPEG | Photos (legacy) | No | Medium |
2. Compression: Lossy vs. Lossless
Lossy compression discards image data the human eye doesn't easily perceive. Lossless compression reorganizes data without eliminating anything. For the web, lossy compression is almost always the right choice for photographs.
Recommended Quality Levels
- 75–80% quality in JPEG/WebP: for general content images (articles, covers).
- 85%: for product images in online stores where detail matters.
- 90%+: only when the image is the central product (art photography, portfolios).
A 2 MB image converted to WebP at 80% quality can easily drop to 180–250 KB, with a difference that's practically imperceptible to the naked eye.
Free Compression Tools
- Squoosh.app (Google): real-time visual comparison in the browser. The most educational tool for learning the ropes.
- TinyPNG / TinyJPG: drag-and-drop, optimizes up to 20 images at once for free.
- ImageOptim (macOS): lossless compression for PNG and JPEG without touching visual quality.
- cwebp / avifenc: command-line tools to automate conversion on servers.
3. Resize Before You Compress
The most common mistake: uploading a 4000 × 3000 px photo and letting HTML display it at 800 × 600 px. The browser downloads the full 4 MB even though it shows it small.
Practical Size Guidelines
- Header/hero images: 1600 px wide maximum.
- Article images: 800–1000 px wide is enough for most layouts.
- Thumbnails: 400 px or less.
- E-commerce product photos: 1000–1200 px, with optional click-to-zoom.
In WordPress, enable additional image sizes in functions.php with add_image_size() and serve the correct size using the srcset attribute.
Responsive Images with srcset
<img
src="photo-800.webp"
srcset="photo-400.webp 400w, photo-800.webp 800w, photo-1200.webp 1200w"
sizes="(max-width: 600px) 400px, (max-width: 1000px) 800px, 1200px"
alt="Product photo showing fabric texture detail"
width="800"
height="600"
>
With srcset, the browser downloads only the version it needs based on the device. On mobile, this can mean loading images 3–4 times smaller than the desktop version.
4. Lazy Loading: Only Load What's Visible
The loading="lazy" attribute tells the browser to defer loading images until the user scrolls near them. It's native in all modern browsers and requires no JavaScript.
<img src="photo.webp" alt="Image description" loading="lazy" width="800" height="400">
Important: don't apply lazy loading to the main image visible on screen (above the fold). That penalizes LCP (Largest Contentful Paint). Reserve loading="lazy" for images below the fold.
For the hero or first visible image, use the opposite approach:
<link rel="preload" as="image" href="hero.webp">
You can explore more techniques in our web performance resource center.
5. Plugins and Automation for WordPress
If your site runs on WordPress, manually optimizing images one by one doesn't scale. Use a plugin that automates conversion, compression, and lazy loading.
| Plugin | WebP Conversion | Lazy Loading | Price |
|---|---|---|---|
| ShortPixel | Yes (automatic) | Yes | Free / from $3.99 USD/month |
| Imagify | Yes | Yes | Free 20 MB / from $4.99 USD/month |
| EWWW Image Optimizer | Yes | Yes | Free / paid plans |
| Smush | Pro only | Yes | Free (limited) / $7.50 USD/month Pro |
For high-volume image sites, a professional web optimization service can handle plugin configuration, bulk conversion of existing images, and CDN integration so you never have to think about it again.
Key Takeaways
- Convert your images to WebP at minimum; consider AVIF for maximum performance.
- Use lossy compression at 75–85% quality—the visual difference is minimal and the file size savings are significant.
- Resize images to their actual display size—never upload 4K images to display them at 800 px.
- Implement srcset to serve different sizes based on the visitor's device.
- Apply
loading="lazy"to below-the-fold images; usepreloadfor the hero image. - On WordPress, an image optimization plugin automates the process from day one.
- Always include
widthandheightattributes to prevent layout shifts (CLS).
If you'd rather have an expert handle it, the team at elenlace.com can audit and optimize every image on your site, integrating CDN and automation so you never have to think about it again.
FAQ
Is WebP always better than JPEG?
For most cases, yes. WebP delivers smaller file sizes at equivalent quality and is supported by all modern browsers. The only reason to prefer JPEG today is compatibility with very old clients or systems that don't support WebP.
How much can I compress an image without it showing?
It depends on the content. For photos of landscapes or people, dropping to 75–80% quality in WebP is practically imperceptible. For images with text or graphics with sharp edges (like screenshots), only go down to 85–90% to avoid visible artifacts.
Does lazy loading affect SEO?
No, as long as you correctly implement alt, width, and height attributes. Googlebot handles native HTML lazy loading without issues. What does hurt SEO is having images without descriptive alt text.
Do I need to re-optimize images already on my site?
Yes. Images uploaded before you implemented your optimization strategy remain at their original file size. Plugins like ShortPixel or EWWW have a "bulk optimization" feature that reprocesses all existing images in your media library.
Compare providers
Other providers and guides worth comparing: