Images account for an average of 50% of a webpage's total weight. Optimizing them is the single highest-impact performance improvement most websites can make.
Why Image Optimization Matters
Google uses Core Web Vitals as a ranking factor. The most image-sensitive metric is Largest Contentful Paint (LCP) — how quickly the main content element loads. On most pages, the LCP element is an image.
An unoptimized hero image can take 5-10 seconds to load on a mobile connection. Optimized, the same image loads in under 1 second.
Step 1: Choose the Right Format
This is the highest-leverage decision:
- ●WebP — 25-30% smaller than JPG. Use as your default for all web images.
- ●AVIF — 50% smaller than JPG. Use if your audience has modern browsers.
- ●JPG — Universal fallback for maximum compatibility.
- ●PNG — Only for images that need transparency and lossless quality (logos, icons).
For most websites, converting all images to WebP is the single biggest win.
Step 2: Size Images Correctly
Never serve a 4000px image in a 400px container. This wastes bandwidth and slows rendering.
Calculate the Right Size
Multiply the display width by 2 for retina support. If your content area is 800px wide, serve 1600px images. If a thumbnail is 200px, serve 400px.
Generate Multiple Sizes
For responsive layouts, generate 3-4 sizes and use srcset:
- ●640px for mobile
- ●1024px for tablet
- ●1920px for desktop
ImgGPT's Resize tool handles this quickly.
Step 3: Compress Aggressively
After sizing, compress with a quality slider:
- ●Hero images: Quality 80-85
- ●Content images: Quality 75-80
- ●Thumbnails: Quality 65-75
- ●Decorative backgrounds: Quality 60-70
The visual difference between quality 80 and quality 100 is imperceptible to most viewers. The file size difference is 3-5x.
Step 4: Implement Lazy Loading
Images below the fold should not load until the user scrolls near them. Add the loading attribute:
<img src="photo.webp" loading="lazy" alt="Description">Do NOT lazy-load the LCP image (usually the hero). That should load immediately.
Step 5: Use a CDN
Serve images from a Content Delivery Network. CDNs cache your images at edge locations worldwide, reducing load times for users far from your server.
ImgGPT's project system hosts images on Cloudflare's global CDN automatically. Save an image to a project and use the CDN URL directly.
Step 6: Set Explicit Dimensions
Always specify width and height on image elements to prevent layout shift (another Core Web Vital):
<img src="photo.webp" width="800" height="600" alt="Description">This lets the browser reserve space before the image loads.
The Complete Workflow
- ●Start with original high-quality source
- ●Resize to display dimensions (2x for retina)
- ●Compress (quality 80 for WebP)
- ●Convert to WebP
- ●Add lazy loading for below-fold images
- ●Serve from CDN
- ●Test with Google PageSpeed Insights
Measuring Results
Use Google PageSpeed Insights or Lighthouse to measure before and after. Focus on:
- ●LCP — Should be under 2.5 seconds
- ●Total image weight — Aim for under 500 KB total per page
- ●CLS — Should be under 0.1 (set explicit dimensions)
Image optimization is not glamorous, but it is one of the highest-ROI activities in web development.
Ready to edit your images?
25+ free editing tools and 40+ AI models — no signup required for free tools.
Try ImgGPT Free