Skip to main content
Web PerformanceImage OptimizationSEOCore Web Vitals

How to Reduce Image Size for Your Website: Complete Performance Guide

HeyCompress Team11 min read

Why Image Size Matters for Your Website

Images are the single largest contributor to page weight on the modern web. According to the HTTP Archive, images account for an average of 42% of a web page's total transfer size. For image-heavy sites like e-commerce stores, portfolios, and blogs, this figure can exceed 70%.

This has direct consequences for your business:

  • Page load speed: Large images are the primary cause of slow-loading pages. Studies show that 53% of mobile visitors abandon a site that takes more than 3 seconds to load.
  • SEO rankings: Google uses page speed as a ranking factor. Slow pages rank lower in search results, reducing organic traffic.
  • Core Web Vitals: Google's Core Web Vitals metrics — particularly Largest Contentful Paint (LCP) — are heavily influenced by image loading. Pages failing CWV thresholds receive a ranking penalty.
  • Conversion rates: Amazon found that every 100ms of additional load time cost them 1% in sales. Walmart reported a 2% increase in conversions for every second of improvement.
  • Bandwidth costs: If you serve millions of page views, unoptimized images can add thousands of dollars to your CDN bill annually.

The good news: image optimization is the lowest-hanging fruit in web performance. A few straightforward techniques can cut your image payload by 60–80% without any visible quality loss.

Format Selection Guide

Choosing the right format is the highest-impact optimization you can make. Here is a practical guide based on content type:

  • Photographs and natural images: Use WebP (with JPEG fallback). WebP delivers 25–34% smaller files than JPEG at equivalent quality. For cutting-edge optimization, serve AVIF with WebP and JPEG fallbacks.
  • Logos and icons: Use SVG whenever possible. SVG is a vector format that scales perfectly at any size and typically weighs only 1–5KB. For raster logos, use PNG-8 or WebP lossless.
  • Screenshots and UI images: Use PNG or WebP lossless. JPEG creates visible artifacts around text and sharp edges.
  • Decorative backgrounds: Use JPEG or WebP at 60–70% quality. Slight quality reduction is imperceptible when images are behind text or overlays.
  • Animated content: Use MP4 video instead of GIF. An animated GIF can be 10–50× larger than the same content as an MP4 video. For short loops, WebP animation is also efficient.

Compression Ratios by Format

Here is what you can expect in terms of size reduction when compressing a typical 1920×1080 photograph:

  • Original uncompressed BMP: ~6MB (baseline reference)
  • PNG (lossless): ~3–5MB (30–50% reduction) — not recommended for photos
  • JPEG at 85% quality: ~300–500KB (92–95% reduction)
  • WebP at 80% quality: ~200–350KB (94–97% reduction)
  • AVIF at 75% quality: ~150–250KB (96–98% reduction)

These numbers demonstrate why format selection matters so much. The difference between PNG and AVIF for a photograph can be 20× in file size with no perceptible quality difference.

Responsive Images with srcset

Serving a single large image to all devices is wasteful. A user on a 360px-wide mobile screen does not need a 2000px-wide desktop image. Responsive images solve this by letting the browser choose the most appropriate size.

The key attributes are srcset (which lists available image sizes) and sizes (which tells the browser how large the image will be displayed). Together, they allow the browser to download only the pixels it actually needs.

Recommended breakpoints for responsive images:

  • 320w — Small mobile devices
  • 640w — Large mobile / small tablet
  • 960w — Tablet
  • 1280w — Desktop
  • 1920w — Large desktop / Retina

Generating these variants can be automated using image processing tools, build plugins, or image CDNs. The effort is minimal compared to the bandwidth savings — responsive images typically reduce mobile image payloads by 50–70%.

Lazy Loading Implementation

Lazy loading defers the loading of off-screen images until the user scrolls near them. This dramatically improves initial page load time because only the images visible in the viewport are loaded upfront.

The simplest implementation uses the native loading="lazy" attribute, which is now supported by all major browsers. Add it to every image that is not immediately visible when the page loads.

Critical exception: Never lazy-load your LCP image — this is typically the hero image or the first large image visible on the page. Lazy loading the LCP image delays it and directly hurts your Largest Contentful Paint score. Instead, use loading="eager" and fetchpriority="high" on the LCP image to ensure it loads as fast as possible.

For more advanced lazy loading with fade-in animations and placeholder blurs, consider using the Intersection Observer API or a lightweight library.

Implementing Next-Gen Formats

To serve modern formats with proper fallbacks, use the HTML <picture> element. The browser evaluates sources in order and uses the first format it supports. This lets you offer AVIF and WebP to browsers that support them while falling back to JPEG for older browsers.

If you use a framework like Next.js, the built-in Image component handles format negotiation automatically — serving WebP or AVIF based on the browser's Accept header.

CDN and Image Optimization Services

An image CDN serves your images from edge servers close to your users, reducing latency. Modern image CDNs go further by offering on-the-fly optimization:

  • Automatic format conversion: Detect the browser and serve the best supported format
  • Dynamic resizing: Generate responsive image variants on demand
  • Quality optimization: Apply intelligent compression based on content analysis
  • Caching: Store optimized variants at the edge for instant delivery

Popular image CDN options include Cloudinary, Imgix, Cloudflare Images, and Vercel's built-in image optimization.

Size Recommendations by Image Type

Here are target file sizes to aim for based on image purpose:

  • Hero/banner images: 80–150KB (compressed WebP/AVIF at full width)
  • Content images: 40–100KB (inline article or product photos)
  • Thumbnail images: 10–30KB (gallery grids, card previews)
  • Icons and logos: 1–10KB (SVG preferred, or compressed PNG-8)
  • Background images: 50–120KB (lower quality is acceptable)
  • Avatar images: 5–15KB (small display size)

These targets assume proper resizing and modern format usage. If your images significantly exceed these sizes, there is room for optimization.

Measuring Performance with Lighthouse

Google Lighthouse is the standard tool for measuring image performance. Run a Lighthouse audit (available in Chrome DevTools under the Lighthouse tab) and look for these image-specific recommendations:

  • Properly size images: Flags images served at larger dimensions than displayed
  • Serve images in next-gen formats: Identifies images that would benefit from WebP or AVIF
  • Efficiently encode images: Flags images that can be compressed further without quality loss
  • Defer offscreen images: Suggests lazy loading for images below the fold

Aim for a Lighthouse Performance score of 90+ on both mobile and desktop. Image optimization alone can often improve your score by 15–30 points. Tools like HeyCompress make it easy to batch-process all your website images to hit these targets.