cutfoto

How to optimize images for a website

On most websites, images make up the majority of the downloaded data. Optimizing them is one of the fastest ways to speed up pages and improve Core Web Vitals.

Why it matters

Google uses Core Web Vitals as part of page experience. Largest Contentful Paint (LCP) — often a hero image — should load within 2.5 seconds, and Cumulative Layout Shift (CLS) should stay below 0.1. Heavy, unsized images hurt both, especially on mobile connections.

The 4-step workflow

  1. Resize to display size. A photo shown 800 px wide does not need 4000 px. Use Resize image — about 2× the display width covers high-density screens.
  2. Choose a modern format. Convert photos to WebP (or AVIF) and keep PNG only for graphics that need lossless quality.
  3. Compress. In Compress image, quality 70–80% is usually invisible to visitors.
  4. Name files descriptively before uploading (see image SEO).

HTML tips

  • Always set width and height attributes so the browser reserves space (prevents layout shift).
  • Use loading="lazy" for images below the fold — but never on the main hero image.
  • Give the LCP image fetchpriority="high".
  • Serve several sizes with srcset and sizes so phones download smaller files.

Target file sizes

ImageTypical widthTarget size
Full-width hero1600–2400 px150–350 KB
Content image800–1200 px50–150 KB
Product image (with zoom)1200–2000 px100–300 KB
Thumbnail300–600 px10–40 KB

Frequently asked questions

Should I use WebP or AVIF?

WebP is the safe default with universal browser support. AVIF compresses better and is supported by modern browsers; use it if your platform can generate and serve it.

Related tools

More articles

All articles →