
Images are the single largest contributor to page weight on the average website. According to HTTP Archive data, images account for approximately 50% of total page bytes. A single unoptimized hero image can be larger than all the HTML, CSS, and JavaScript on the page combined.
This is not just a performance problem — it is a revenue problem. Google reports that 53% of mobile visitors abandon pages that take longer than 3 seconds to load. Amazon found that every 100ms of added latency costs them 1% in sales. And since 2021, Google has used Core Web Vitals (including Largest Contentful Paint, which is often an image) as a ranking factor.
This guide covers every technique to optimize images for speed without sacrificing visual quality.
The Image Optimization Checklist
Before diving into details, here is the complete checklist. Every image on your website should pass these checks:
- Resized to display dimensions (not larger)
- Compressed with a quality-aware encoder
- Served in a modern format (WebP with fallback)
- Lazy-loaded if below the fold
- Has explicit width and height attributes
- Served via a CDN
- Has descriptive alt text (SEO bonus)
Step 1: Resize Before Compression
The most impactful optimization is also the simplest: do not serve images larger than their display size.
If an image displays at 800px wide on your website, serving a 4000px original wastes 96% of the pixel data (since pixel count scales with the square of dimensions: 4000/800 = 5x, and 5^2 = 25x more pixels than needed).
How to Determine the Right Size
- Hero images: 1920px wide for full-width desktop, 1200px for contained layouts.
- Blog post images: 800-1200px wide (typical content column width).
- Thumbnails: 300-400px wide.
- Profile pictures: 200-400px.
- Product images: 800-1200px for detail views, 400px for grid listings.
Use the Image Compressor at mergeimages.net to resize and compress in a single step. Upload your original, set your target dimensions, and download the optimized result.
Step 2: Choose the Right Compression
Lossy Compression (For Photographs)
Lossy compression removes visual information that the human eye does not notice. The key is finding the quality level where the compression is invisible:
| Quality Level | File Size Reduction | Visual Impact |
|---|---|---|
| 95 | 30-40% | Imperceptible |
| 85-90 | 60-70% | Negligible |
| 75-80 | 75-85% | Minor (visible at 200% zoom) |
| 60-70 | 85-90% | Noticeable on close inspection |
The sweet spot is quality 82-88. This produces files that are 60-70% smaller than the original with no visible quality difference at normal viewing distances.
MozJPEG vs Standard JPEG
The Image Compressor uses MozJPEG encoding, which produces files 5-10% smaller than standard JPEG encoders at the same quality level. This is a free performance win — the same visual quality in a smaller file.
Lossless Compression (For Graphics)
For PNGs, logos, and screenshots, lossless compression tools like OptiPNG or PNGquant reduce file size without removing any visual information. The Image Compressor handles PNG optimization as well.
Step 3: Serve Modern Formats
WebP produces files 25-35% smaller than JPEG at equivalent quality. In 2026, WebP is supported by 97%+ of browsers, making it safe for production use.
Implementation with HTML
<picture>
<source srcset="image.webp" type="image/webp">
<source srcset="image.jpg" type="image/jpeg">
<img src="image.jpg" alt="Description" width="800" height="600">
</picture>
This serves WebP to browsers that support it and falls back to JPEG for the rare browser that does not.
Automatic Format Conversion
Many CDNs (Cloudflare, Vercel, Netlify) can automatically convert and serve images in the optimal format based on the browser's Accept header. This is the lowest-effort approach — upload JPEG/PNG originals and let the CDN handle the rest.
Step 4: Implement Responsive Images
Different devices need different image sizes. A 1920px hero image is overkill for a 375px-wide phone screen.
Using srcset
<img
src="hero-800.jpg"
srcset="hero-400.jpg 400w, hero-800.jpg 800w, hero-1200.jpg 1200w, hero-1920.jpg 1920w"
sizes="(max-width: 600px) 400px, (max-width: 1200px) 800px, 1200px"
alt="Hero image description"
width="1200"
height="600"
>
The browser selects the smallest image that fits the current viewport, saving bandwidth on mobile devices.
Generating Multiple Sizes
For each important image on your site, generate 3-4 size variants:
- 400px — mobile phones.
- 800px — tablets, smaller laptops.
- 1200px — standard desktops.
- 1920px — large monitors, full-width layouts.
Use the Image Compressor to create each size variant with optimal compression.
Step 5: Lazy-Load Below-the-Fold Images
Images that are not visible when the page first loads should not be downloaded until the user scrolls near them.
Native Lazy Loading
<img src="image.jpg" loading="lazy" alt="Description" width="800" height="600">
The loading="lazy" attribute is supported by all modern browsers and requires zero JavaScript. The browser automatically defers loading until the image is near the viewport.
Do NOT Lazy-Load the LCP Image
The Largest Contentful Paint (LCP) image — usually the hero image or the first large image visible on page load — should load immediately. Lazy-loading the LCP image makes it load slower, hurting your Core Web Vitals score.
<!-- Hero image: eager load, high priority -->
<img src="hero.webp" loading="eager" fetchpriority="high" alt="Hero" width="1200" height="600">
<!-- Below-fold images: lazy load -->
<img src="section2.webp" loading="lazy" alt="Section 2" width="800" height="400">
Step 6: Set Explicit Dimensions
Always include width and height attributes on <img> tags:
<img src="photo.jpg" width="800" height="600" alt="Description">
This prevents Cumulative Layout Shift (CLS) — the jarring jump when an image loads and pushes content down. The browser reserves the correct space before the image downloads.
Step 7: Use a CDN
A Content Delivery Network serves your images from the server geographically closest to the user:
- Cloudflare — free tier includes image optimization (Polish, WebP conversion).
- Vercel — built-in image optimization for Next.js sites.
- Netlify — image CDN with automatic format conversion.
- Imgix/Cloudinary — dedicated image CDNs with URL-based transformations.
CDN delivery typically reduces image load time by 50-70% for users who are geographically distant from your origin server.
Step 8: Optimize for Core Web Vitals
Three Core Web Vitals metrics are affected by images:
Largest Contentful Paint (LCP)
- Target: Under 2.5 seconds.
- Impact: The hero image is often the LCP element.
- Fix: Preload the LCP image, use fetchpriority="high", compress aggressively, serve from CDN.
Cumulative Layout Shift (CLS)
- Target: Under 0.1.
- Impact: Images without dimensions cause layout shifts when they load.
- Fix: Always include width and height attributes. Use CSS aspect-ratio.
Interaction to Next Paint (INP)
- Target: Under 200ms.
- Impact: Large images in JavaScript frameworks can block the main thread during decoding.
- Fix: Use
decoding="async"on images. Use responsive images to avoid decoding unnecessarily large files.
Advanced Techniques
Progressive JPEG
Progressive JPEGs render a low-quality version immediately, then progressively sharpen as more data loads. This gives the perception of faster loading even when the total file size is identical.
Image Sprites (For Icons)
Combine multiple small icons into a single image and use CSS background-position to display each one. This reduces HTTP requests, though HTTP/2 has made this less critical than it was.
SVG for Icons and Logos
Vector graphics (SVG) are resolution-independent and often smaller than equivalent PNGs for simple graphics. They scale perfectly to any size without pixelation.
Base64 Inlining (Small Images Only)
For images under 2 KB (tiny icons, decorative dots), base64-encoding them directly in CSS eliminates the HTTP request entirely. Do not do this for larger images — the base64 encoding increases size by 33%.
Measuring Image Performance
Google PageSpeed Insights
Run your pages through PageSpeed Insights. It flags:
- Images that could be better compressed.
- Images served in outdated formats.
- Images that are larger than their display size.
- Missing lazy loading on offscreen images.
Chrome DevTools
- Open DevTools (F12).
- Network tab > filter by "Img."
- Sort by Size to find the largest images.
- Check the "Size" vs "Content" columns — if they differ significantly, you may be missing compression.
Quick-Win Optimization Workflow
For an existing website with unoptimized images:
- Audit: Run PageSpeed Insights and identify the largest images.
- Compress: Download each flagged image and run it through the Image Compressor at mergeimages.net.
- Resize: If any image is served at larger dimensions than it displays, resize to the display size during compression.
- Enhance if needed: For images that are too small after resizing, the Image Upscaler can enhance quality.
- Replace: Upload the optimized images and update your HTML/CMS.
- Verify: Re-run PageSpeed Insights and confirm improvement.
This process typically reduces total page weight by 40-70% with no visible quality change.
Conclusion
Image optimization is the highest-impact performance improvement for most websites. The combination of proper sizing, quality-aware compression via the Image Compressor, modern formats (WebP), lazy loading, and CDN delivery can reduce image payload by 70-80% while maintaining visual quality.
Start with the biggest images on your most-visited pages. Compress them, resize them, and serve them in WebP. That single change will likely improve your Core Web Vitals scores, reduce bandwidth costs, and deliver a noticeably faster experience to your visitors.




