Image optimization is the practice of delivering images at the smallest file size that still looks right on the user's screen. It combines format choice, compression level, correct dimensions and delivery settings.
Why it matters
Images are usually the heaviest part of a page and often the LCP element, so they strongly affect loading speed and data cost. Typical wins include switching photos from JPEG to WebP or AVIF, resizing a 4000 px original to the 1200 px the layout needs, and using SVG for logos and icons.
Example
<picture>
<source type="image/avif" srcset="hero.avif">
<source type="image/webp" srcset="hero.webp">
<img src="hero.jpg" width="1200" height="600"
alt="Hero" fetchpriority="high">
</picture>
Width and height prevent layout shift. A below-the-fold image would use loading="lazy"; the hero image should not.
Common mistakes
- Serving desktop-sized images to phones; use
srcsetandsizes. - Using PNG for photographs, or JPEG for flat graphics and text.
- Stripping so much quality that artifacts appear. Check visually.
- Lazy loading the LCP image.
- Missing long cache headers on fingerprinted images.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.