Перейти к содержимому
Skip to content
← All articles

Image Optimization for Web Performance

Why Images Are the Main Performance Problem

Images account for 50-70% of total web page weight on average. According to HTTP Archive, the average page loads over 1 MB of images. Unoptimized images are the #1 cause of slow website loading and poor PageSpeed анализ scores.

Image optimization is the fastest way to speed up a website with minimal effort.

Modern Image Formats

WebP

Google's format, supported by all modern browsers (97%+ globally). Benefits:

AVIF

Format based on AV1, approximately 93% browser support. Best compression available:

When to Use Which Format

The Picture Element for Progressive Loading

Use <picture> to provide multiple formats:

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description" width="800" height="600">
</picture>

The browser picks the first supported format. Always specify width and height to prevent layout shift (CLS).

Responsive Images

The srcset attribute loads appropriately sized images for the device:

<img
  srcset="image-480.webp 480w,
          image-800.webp 800w,
          image-1200.webp 1200w"
  sizes="(max-width: 600px) 480px,
         (max-width: 1000px) 800px,
         1200px"
  src="image-800.webp"
  alt="Description"
>

Don't load a 2000px image for a 320px mobile screen. Savings can reach 80% of traffic.

Lazy Loading

Lazy loading defers loading images that aren't visible on screen until the user scrolls to them:

<img src="image.webp" alt="Description" loading="lazy">

Lazy loading rules:

<!-- LCP image — high priority -->
<img src="hero.webp" alt="Hero" fetchpriority="high">

<!-- Below-the-fold images — lazy loading -->
<img src="gallery-1.webp" alt="Gallery" loading="lazy">

Image Compression

Compression Quality

For photographs, optimal quality is 75-85%. The difference between 85% and 100% is barely visible to the eye, but file size can differ by 2-3x.

Compression Tools

Automation

Integrate optimization into your CI/CD pipeline or use a CDN with automatic conversion (Cloudflare Polish, imgproxy). Never rely on manual optimization — it will be forgotten.

Additional Optimizations

Preloading the LCP Image

<link rel="preload" as="image" href="hero.webp" fetchpriority="high">

CSS Sprites and Inline SVG

For small icons, use SVG sprites or inline SVG instead of separate files — this reduces the number of HTTP requests.

Loading Placeholders

Use CSS placeholders of the correct size or blurred previews (LQIP — Low Quality Image Placeholder) to prevent layout shift.

Check Loading Speed

Use the Enterno.io Speed Test to measure your page loading times. Compare results before and after image optimization. Check the HTTP response for image caching headers.

Summary

Image optimization is the most effective way to speed up a website. Use WebP/AVIF with fallbacks, responsive images for different screens, lazy loading for below-the-fold images, and automate compression. These measures can reduce page weight by 50-80%.

Check your website right now

Check now →
More articles: Performance
Performance
Web Application Caching Strategies
14.03.2026 · 10 views
Performance
Resource Hints Explained: Prefetch, Preload, Preconnect, DNS-Prefetch
16.03.2026 · 12 views
Performance
API Performance Metrics and Optimization
14.03.2026 · 10 views
Performance
Gzip vs Brotli: Web Compression Compared
16.03.2026 · 56 views