Skip to content

How to Make Images Responsive Without Breaking Core Web Vitals

By Priya Chandran · Published · Updated

Responsive images fix the wrong problem when you only add srcset and stop there. The real goal is serving the right image, at the right size, in the right format, for the device requesting it — and getting that wrong is one of the most common causes of a poor Largest Contentful Paint score. This guide walks through the three mistakes we see most often in real audits, then a working pattern you can copy directly.

What srcset and sizes actually do

The srcset attribute lists multiple versions of the same image at different widths, and sizes tells the browser how much horizontal space the image will occupy at different viewport widths. Together they let the browser pick the smallest file that still looks sharp on the visitor’s actual screen, before layout even happens. Get sizes wrong — or omit it — and the browser falls back to downloading the largest image in the set, defeating the entire point.

Mistake one: fixed pixel dimensions without a sizes attribute

A common pattern is writing srcset with three widths and then setting a fixed width and height in CSS without a matching sizes value. Without sizes, the browser assumes the image is 100% of the viewport width and downloads accordingly, which on a narrow card layout means shipping two or three times more image data than the page actually needs.

Mistake two: skipping width and height attributes

Omitting explicit width and height attributes (or an aspect-ratio in CSS) means the browser cannot reserve space for the image before it loads, so the page jumps when it finally arrives. That layout jump is exactly what Cumulative Layout Shift measures, and it is one of the easiest regressions to avoid entirely — the fix costs two attributes.

Mistake three: shipping the hero image as a legacy format

A large above-the-fold JPEG or PNG is routinely two to four times larger than the same visual quality delivered as WebP or AVIF. Since the hero image is very often the Largest Contentful Paint element itself, this single choice can single-handedly move a page from a good LCP score to a poor one. See web.dev’s Core Web Vitals guide for how LCP is measured in the field.

A pattern that avoids all three

Here is the checklist we hold every image against during an audit:

  • Serve modern formats (AVIF or WebP) with a JPEG/PNG fallback.
  • Set explicit width and height (or CSS aspect-ratio) on every image.
  • Write a sizes attribute that matches the image's real rendered width at each breakpoint.
  • Mark the LCP candidate image as high priority and skip lazy-loading it.

Tip: if you’re on Next.js, the built-in next/image component handles srcset generation, lazy loading, and layout reservation for you — see the official MDN documentation on srcset for the underlying browser behavior it wraps.

Key takeaways

  • A missing sizes attribute silently defeats a correct srcset.
  • Reserve layout space with width/height to avoid a CLS penalty.
  • Modern formats cut hero-image weight dramatically, which helps LCP directly.

Frequently asked questions

Do I need srcset if I already use next/image?

No. Next.js’s Image component generates the srcset and sizes attributes for you automatically based on the sizes prop you pass, so you rarely need to hand-write srcset in a Next.js app. The guidance in this article matters most when you’re working with plain <img> tags outside a framework that handles it for you.

Which image format should I default to in 2026?

AVIF gives the smallest file size for photographic content and is now supported in every major browser, so it’s a reasonable default with a WebP fallback for older clients. For simple graphics with flat colors, SVG usually beats both.

About the author

Priya Chandran is a Senior Frontend Engineer at Broken Fixture Co with 8+ years of experience building e-commerce storefronts, where she now works on the crawler that powers Fixture Scanner's performance-related checks. She has personally chased down more layout-shift regressions than she'd like to admit, and is a published author on web performance topics. She writes about performance and rendering on this blog roughly once a month.

Related reading: see our structured data checklist for another common source of avoidable audit failures, or the Fixture Scanner product page for how these checks run automatically against your own site.