Image optimization is the single biggest factor in website speed. Images typically account for 50-70% of a webpage's total size, directly impacting load times, user experience, and Google rankings. This guide shows you exactly how to optimize images for maximum performance.
Quick wins: Compress images (60% smaller), convert to WebP, use lazy loading. These 3 changes can cut load time in half.
Why Image Optimization Matters (With Real Data)
| Metric | Impact |
|---|---|
| 53% of mobile users | Leave if page takes >3 seconds to load |
| 1 second delay | = 7% drop in conversions |
| Google ranking factor | Core Web Vitals directly affect SEO |
| Bandwidth costs | Smaller images = lower hosting bills |
| Carbon footprint | Optimized sites use less energy |
The Hidden Cost of Unoptimized Images
A typical e-commerce page with 20 product images:
| Scenario | Total image size | Load time (3G) |
|---|---|---|
| Unoptimized | 15 MB | 25+ seconds |
| Basic optimization | 3 MB | 8 seconds |
| Full optimization | 800 KB | 2.5 seconds |
That's 18x smaller and 10x faster with proper optimization.
The 5 Pillars of Image Optimization
1. Choose the Right Format
| Image type | Best format | Why |
|---|---|---|
| Photos | WebP > JPG | 30% smaller than JPG |
| Screenshots | PNG or WebP | Lossless, sharp text |
| Logos/icons | SVG | Vector, infinitely scalable |
| Simple graphics | SVG or PNG-8 | Tiny file size |
| Animations | WebP > GIF | 90% smaller than GIF |
Format Decision Tree
Is it a photo?
βββ Yes β WebP (JPG fallback)
βββ No β Does it need to scale?
βββ Yes β SVG
βββ No β Need transparency?
βββ Yes β WebP or PNG
βββ No β WebP or JPG
2. Compress Without Visible Quality Loss
Modern compression can reduce images by 60-80% without noticeable degradation.
Compression Settings by Use Case
| Use | JPG quality | WebP quality | Expected reduction |
|---|---|---|---|
| Hero images | 80-85% | 80% | 60-70% smaller |
| Product photos | 75-80% | 75% | 70-75% smaller |
| Blog images | 70-75% | 70% | 75-80% smaller |
| Thumbnails | 60-70% | 60% | 80-85% smaller |
Tool: ConvImg Compress - Free, maintains quality, batch processing.
3. Resize to Display Dimensions
Never load a 4000px image to display at 400px.
| Common mistake | Real need | Wasted data |
|---|---|---|
| 3000x2000 hero | 1200x800 | 80% wasted |
| 2000x2000 thumbnail | 300x300 | 97% wasted |
| 4K product photo | 800x800 | 95% wasted |
Responsive Images with srcset
<img
src="image-800.webp"
srcset="
image-400.webp 400w,
image-800.webp 800w,
image-1200.webp 1200w
"
sizes="(max-width: 600px) 400px, 800px"
alt="Description"
>
Tool: ConvImg Resize - Create multiple sizes instantly.
4. Implement Lazy Loading
Only load images when they're about to enter the viewport.
Native Lazy Loading (Modern Browsers)
<img src="image.webp" loading="lazy" alt="Description">
What to Lazy Load
| Element | Lazy load? |
|---|---|
| Above-the-fold images | No - load immediately |
| Below-the-fold images | Yes |
| Product gallery thumbnails | Yes |
| Blog post images | Yes |
| Hero/header images | No |
5. Convert to Modern Formats (WebP/AVIF)
| Format | Browser support | Compression |
|---|---|---|
| WebP | 97%+ browsers | 30% smaller than JPG |
| AVIF | 85%+ browsers | 50% smaller than JPG |
| JPG | 100% | Baseline |
Serving WebP with Fallback
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Description">
</picture>
SVG: The Secret Weapon for Icons & Logos
SVG is dramatically underused. For logos and icons, it's often 10-50x smaller than PNG.
PNG vs SVG Comparison
| Asset | PNG size | SVG size | Difference |
|---|---|---|---|
| Simple icon | 15 KB | 0.5 KB | 30x smaller |
| Logo | 50 KB | 3 KB | 17x smaller |
| Illustration | 200 KB | 20 KB | 10x smaller |
When to Use SVG
β Always for:
- Logos
- Icons
- Simple illustrations
- UI elements
- Charts/graphs
β Never for:
- Photographs
- Complex gradients
- Detailed artwork
Tool: ConvImg PNG to SVG - Vectorize logos instantly.
Core Web Vitals: Google's Image Requirements
Google measures three key metrics that images directly impact:
Largest Contentful Paint (LCP)
What: Time for largest element (usually hero image) to load. Target: Under 2.5 seconds. Image impact: Hero images are usually the LCP element.
Optimization tips:
- Preload hero images:
<link rel="preload" as="image" href="hero.webp"> - Use WebP format
- Size appropriately
- Serve from CDN
Cumulative Layout Shift (CLS)
What: Visual stability - do elements jump around? Target: Under 0.1. Image impact: Images without dimensions cause layout shifts.
Fix: Always specify width and height:
<img
src="image.webp"
width="800"
height="600"
alt="Description"
>
Or use aspect-ratio CSS:
img {
aspect-ratio: 16 / 9;
width: 100%;
height: auto;
}
Interaction to Next Paint (INP)
What: Responsiveness to user interactions. Image impact: Heavy images can block main thread.
Fix: Use lazy loading, optimize JavaScript image handlers.
Quick Optimization Checklist
Before Launch
- All images compressed (70-85% quality)
- WebP format with JPG fallback
- Responsive images with srcset
- Width/height attributes on all images
- Lazy loading on below-fold images
- Hero image preloaded
- Icons/logos as SVG
Ongoing
- New uploads automatically compressed
- Monthly audit with PageSpeed Insights
- Monitor Core Web Vitals in Search Console
- Remove unused images
Tools for Image Optimization
Compression & Conversion
| Tool | Best for | Price |
|---|---|---|
| ConvImg Compress | Quick compression, batch | Free |
| ConvImg PNG to SVG | Vectorizing logos | Free |
| ConvImg Resize | Creating responsive sizes | Free |
Testing & Monitoring
| Tool | What it does |
|---|---|
| PageSpeed Insights | Performance score, LCP/CLS |
| WebPageTest | Detailed waterfall analysis |
| Chrome DevTools | Network tab, image sizes |
| Search Console | Core Web Vitals monitoring |
Framework-Specific Optimization
Next.js
import Image from 'next/image';
<Image
src="/hero.jpg"
width={1200}
height={800}
alt="Description"
priority // For above-fold images
placeholder="blur"
/>
Next.js automatically:
- Converts to WebP
- Creates responsive sizes
- Lazy loads
- Prevents CLS
WordPress
- Install plugin: Imagify, ShortPixel, or Smush
- Enable WebP conversion
- Set up lazy loading
- Use CDN (Cloudflare, BunnyCDN)
Static Sites
Use build-time optimization:
- Eleventy: eleventy-img plugin
- Gatsby: gatsby-plugin-image
- Hugo: Built-in image processing
Real-World Case Study
E-commerce site with 500 product images:
| Metric | Before | After | Improvement |
|---|---|---|---|
| Total image size | 45 MB | 4 MB | 91% smaller |
| Page load time | 12s | 2.8s | 77% faster |
| PageSpeed score | 35 | 92 | +57 points |
| Bounce rate | 65% | 38% | 27% reduction |
| Conversions | 2.1% | 3.4% | 62% increase |
Changes made:
- Compressed all images (80% quality)
- Converted to WebP
- Implemented lazy loading
- Added proper dimensions
- Used CDN
Frequently Asked Questions (FAQ)
How much should I compress images?
For web: 70-85% quality is the sweet spot. Most users can't see the difference between 85% and 100%, but file size is 3-4x smaller.
Does image optimization affect SEO?
Yes, directly. Google uses Core Web Vitals (LCP, CLS) as ranking factors. Faster sites rank higher and have lower bounce rates.
Should I use WebP or AVIF?
WebP has 97%+ browser support and is safe to use with fallbacks. AVIF is better compression but only 85% support. Use WebP now, consider AVIF for modern audiences.
How do I optimize images for mobile?
- Create smaller versions for mobile (srcset)
- Use lazy loading (loading="lazy")
- Test on real devices, not just desktop
- Target under 100KB for mobile images
What's the ideal image size for web?
- Hero images: 100-200 KB max
- Blog images: 50-100 KB
- Thumbnails: 10-30 KB
- Icons: Under 5 KB (use SVG)
Conclusion
Image optimization is the highest-impact performance improvement you can make. The basics are simple:
- Compress - 70-85% quality
- Resize - Match display dimensions
- Convert - Use WebP
- Lazy load - Below-fold images
- SVG - For all icons/logos
Every kilobyte saved translates to faster loads, better rankings, and happier users.
Optimize Your Images Now
Use ConvImg's free tools:
- Compress Images - Reduce by 60-80%
- Resize - Create responsive sizes
- PNG to SVG - Vectorize logos