Development · 6 min read
Image Optimization for the Web: WebP, AVIF, and Responsive Images Explained
Images are usually the heaviest part of a page. Modern formats, responsive sizing, lazy loading, and compression cut their weight with no visible quality loss.
Share

Key takeaways
- Images are usually the heaviest assets on a page, so poor image handling is typically the main cause of slow load times.
- WebP is widely supported and produces smaller files than JPEG and PNG at the same visual quality.
- AVIF compresses further than WebP and is especially valuable for photographic, image-heavy sites.
- Responsive images use srcset and sizes so the browser downloads only the size it needs for each screen.
- Lazy loading, sensible compression, and image CDNs reduce initial load time and improve Core Web Vitals; never lazy-load the hero (LCP) image.
Images are usually the heaviest thing on a web page, often making up a large share of the total bytes a browser has to download. A single unoptimized hero image can weigh several megabytes on its own, and most pages carry many images, so unoptimized images are typically the main reason a site feels slow. Slow pages lose visitors, and images are almost always the first place to look.
The good news is that modern formats and delivery techniques can cut image payload dramatically with no visible loss of quality. The tools are mature, browser support is broad, and the only real question is whether your site is using them. For how delivery fits in, see our guide on how CDNs speed up your website globally.
Should a website use WebP or AVIF?
A website should serve AVIF where the browser supports it, fall back to WebP, and use JPEG or PNG as a last resort. WebP and AVIF are both modern image formats that compress better than the older JPEG and PNG at the same visual quality, so the practical answer is to use both in layers rather than choosing one.
WebP, developed by Google, produces noticeably smaller files than JPEG and PNG at comparable quality, and every modern browser supports it. If a site still serves only JPEG and PNG, switching to WebP is often the single highest-impact image change available.
AVIF pushes compression further still and adds support for HDR, wide color, and transparency. Its savings are most dramatic on photographic content, which makes it especially valuable for portfolios, product images, and image-heavy blogs. Browser support has expanded across Chrome, Firefox, and Safari.
The clean way to combine them is progressive format serving with the HTML picture element: offer AVIF first, WebP next, and a JPEG or PNG fallback last, so every visitor gets the most efficient format their browser can handle. On WordPress, plugins like ShortPixel or Imagify automate the conversion and serving. On custom builds, the conversion goes into the image pipeline using tools like sharp (Node.js) or Pillow (Python). This kind of work feeds directly into your Core Web Vitals scores.
What are responsive images?
Responsive images are differently sized versions of the same image, served so the browser downloads only the size it actually needs for the screen in front of it. Sending a 2400px-wide image to a 375px phone wastes most of the data; responsive images solve that.
The mechanism is two HTML attributes. The srcset attribute lists the available widths of an image, and the sizes attribute tells the browser how wide the image will display in the layout. The browser combines those with the device's screen and pixel density to pick the right file. Generating the set usually means creating a handful of widths (for example 400w, 800w, 1200w, 1600w, 2000w), which build tools and CDNs can produce automatically.

Should all images be lazy-loaded?
No. Below-the-fold images should be lazy-loaded, but the main hero image should not. Lazy loading is the practice of deferring an image's download until the user scrolls near it, set with the native loading="lazy" attribute. It improves initial load time because the browser only fetches what is visible in the first screenful.
The one image to never lazy-load is your Largest Contentful Paint (LCP) element, usually the hero image at the top of the page. That image should load immediately, because LCP is a Core Web Vitals metric and delaying it directly hurts your score.
What do image CDNs do?
Image CDNs handle format conversion, resizing, compression, and global delivery automatically, based on each visitor's browser, device, and connection. You upload one high-resolution original, and services like Cloudinary, imgix, or Bunny Optimizer serve an optimized version on the fly.
For sites with large image libraries, portfolios, real-estate listings, e-commerce catalogs, an image CDN removes the chore of manually producing and managing multiple formats and sizes. It centralizes all the optimization decisions in one place.
How do you compress images without visible quality loss?
You compress images by finding the quality level just above the point where artifacts become visible, which usually allows large file-size reductions with no perceptible difference. Compression is the art of trimming bytes the eye will not miss.
As rough starting points: JPEG quality around 75 to 85 (out of 100) suits photographic content, WebP around 75 to 80 delivers excellent results, and AVIF around 60 to 70 produces strong images at small sizes. Tools like Squoosh (browser-based), TinyPNG, and sharp let you compare compression levels side by side. The target is not the smallest possible file; it is the smallest file that looks indistinguishable from the original at its display size.
How much does image optimization affect SEO?
Image optimization affects SEO meaningfully because Google factors page speed into rankings, and images are usually the biggest lever you can pull on speed. A site that adopts modern formats, responsive images, lazy loading, and sensible compression can improve its Largest Contentful Paint substantially, often the difference between a "needs improvement" and a "good" Core Web Vitals result. For the broader picture, see why your website speed is killing your revenue.
Images are usually the first thing to address because they offer the best return for the effort. A few hours of optimization can shave seconds off load time, an improvement that might otherwise take weeks of code refactoring. Faster pages tend to mean lower bounce rates, longer sessions, and better conversion, which is why we treat image optimization as standard practice on every build. If your site feels heavy and you want it diagnosed and fixed, book a call.
Related service
Web design services in the PhilippinesFrequently asked questions
Why does image optimization matter for website performance?
Images are usually the heaviest assets a browser downloads, and most pages carry many of them. Because of that, unoptimized images are typically the main reason a site feels slow, and optimizing them gives a large speed improvement.
Should a website use WebP or AVIF?
Use progressive format serving: AVIF for browsers that support it, WebP as a fallback, and JPEG or PNG as the final fallback. Both modern formats compress better than the older ones at the same quality.
What are responsive images?
Responsive images are differently sized versions of the same image. The srcset attribute lists the available sizes and the sizes attribute tells the browser how wide the image will display, so it downloads only what it needs.
Should all images be lazy-loaded?
No. Below-the-fold images can use native lazy loading, but the LCP image, usually the hero, should load immediately because it directly affects Core Web Vitals.
What do image CDNs do?
Image CDNs such as Cloudinary, imgix, and Bunny Optimizer handle format conversion, resizing, compression, and global delivery automatically, based on each visitor's browser, device, and connection.
Slow site costing
you customers?
We build fast, conversion-focused sites. Let's see where yours is losing people.
Get in touchPillar guideDevelopment · Feb 26
Core Web Vitals Optimization: A Practical Guide to Google’s Page Speed Benchmarks
Resources · Apr 15
Monitoring Website Uptime: Tools and Strategies to Prevent Revenue-Killing Outages
Resources · Apr 14
Website Caching Strategies: Browser Cache, Server Cache, and CDN Cache Explained
Resources · Apr 5