Most websites still ship the same large image to phones, tablets and desktops. In 2026 that is no longer acceptable — or necessary.
If you’ve ever looked at a PageSpeed report and seen “Properly size images” or “Serve images in next-gen formats” as the biggest opportunities, this masterclass is for you. We’re going to go far beyond the basics and show you how to deliver the perfect image to every device without wasting a single byte.
srcset + sizes, the <picture> element for art direction, modern format delivery (AVIF → WebP → JPEG), density vs width descriptors, and real production patterns that actually work in the wild. 1. Why Responsive Images Still Matter in 2026
Even with fast networks and modern devices, images remain one of the heaviest parts of most web pages. Serving a 2000px-wide image to a phone that only displays it at 400px is pure waste — it costs bandwidth, slows down LCP, and hurts your Core Web Vitals.
The goal of responsive images is simple: give the browser enough information so it can choose the most appropriate file for the current screen size, resolution, and network conditions.
2. The Foundation: srcset + sizes
This is the core technique you need to understand. The browser needs two pieces of information:
- srcset — Which image files exist and how wide they are
- sizes — How wide the image will actually be displayed in the layout at different viewport sizes
Here’s a solid real-world example:
srcset="
hero-800.avif 800w,
hero-1200.avif 1200w,
hero-1600.avif 1600w,
hero-2400.avif 2400w"
sizes="(max-width: 768px) 100vw,
(max-width: 1200px) 90vw,
1200px"
src="hero-1200.jpg"
alt="Descriptive alt text"
width="1200" height="630"
loading="lazy">
A few important notes:
- Always include a fallback
src(usually a solid JPEG or WebP) - Always set explicit
widthandheightto prevent layout shift - The
sizesattribute is what most people get wrong — take time to match it to your actual CSS layout
3. Art Direction with the <picture> Element
Sometimes you don’t just want a smaller version of the same image — you want a completely different crop or composition on mobile. That’s where the <picture> element shines.
<source media="(max-width: 767px)" srcset="hero-mobile.avif" type="image/avif">
<source media="(max-width: 767px)" srcset="hero-mobile.webp" type="image/webp">
<source srcset="hero-desktop.avif" type="image/avif">
<source srcset="hero-desktop.webp" type="image/webp">
<img src="https://file-hosting.dashnexpages.net/webp/hero-desktop.jpg" alt="..." width="1600" height="700">
</picture>
This pattern lets you serve a tighter, more focused crop on mobile while keeping the full wide version on desktop. It’s especially useful for hero sections and campaign landing pages.
4. Modern Format Stack (2026 Best Practice)
The recommended order in 2026 is clear:
- AVIF — Best compression for photos and complex images
- WebP — Excellent fallback with near-universal support
- JPEG (or PNG when you need transparency) — Final safety net
Always put the newest format first inside <picture>. The browser will pick the first one it supports and ignore the rest.
5. Width Descriptors vs Density Descriptors
There are two ways to describe images in srcset:
- Width descriptors (
800w,1200w, etc.) — Best for flexible, responsive layouts - Density descriptors (
1x,2x,3x) — Better for fixed-size elements like icons or logos
For the vast majority of content images, width descriptors are the better choice. Only switch to density descriptors when the image is displayed at a fixed pixel size.
6. Real-World Production Checklist
Here’s the practical checklist I actually use when implementing responsive images on client sites:
- Generate 3–4 widths for every important image
- Always include explicit
widthandheightattributes - Never lazy-load the LCP (Largest Contentful Paint) image
- Add
fetchpriority="high"to the hero / LCP image - Use
loading="lazy"on everything below the fold - Test with Chrome DevTools network throttling and the Performance panel
- Check the “Network” tab to confirm the browser is actually downloading the size you expect
7. Common Mistakes to Avoid
- Writing a
sizesattribute that doesn’t match the real CSS layout - Forgetting the fallback
src - Lazy-loading the hero image
- Only offering WebP and skipping AVIF
- Generating too many sizes (4 is usually enough)
- Not setting width and height (this causes layout shift)
8. Putting It All Together
When you combine proper srcset + sizes, the <picture> element for art direction, and a modern format stack (AVIF → WebP → JPEG), you get images that are sharp on every device while staying as light as possible.
This is one of the highest-leverage performance improvements you can still make in 2026. The techniques above are battle-tested and work across real client projects.
Start with your hero images and the largest content images first — those usually deliver the biggest gains.
