New series: what assistive tech really hears on your checkout page. Start with part one →
Shipwright
Home
Performance Jun 20, 2026 1 min read 532 views

Responsive Images with srcset, sizes, and No Guesswork

Priya Raman

Priya Raman

Database and performance engineer. Priya reads…

Share
Cover illustration for the article Responsive Images with srcset, sizes, and No Guesswork

Work out the sizes attribute from your layout instead of copying it from a blog post. Performance work goes wrong when it starts with a guess. Every change in this post began with a measurement on real hardware and ended with a second measurement to prove it helped.

Measure before you touch anything

Field data from real users tells you where the problem is; lab tools tell you why. We start with the Core Web Vitals report, pick the worst page template, and only then open the profiler.

hero-image.html
<img
  src="/img/hero-800.jpg"
  srcset="/img/hero-400.jpg 400w, /img/hero-800.jpg 800w, /img/hero-1600.jpg 1600w"
  sizes="(min-width: 1024px) 720px, 100vw"
  width="1600" height="900"
  alt="Dashboard showing request latency"
  fetchpriority="high"
/>

The change that mattered

The biggest single win was rarely clever. Right-sized images, fewer third-party scripts, and a cache header on static assets did more than any amount of micro-optimisation in our own code.

  • Start from field data, not a lab score.
  • Fix the largest resource first.
  • Compare percentiles, not single runs.
  • Re-measure a week later.

Verifying the win

After each change we compare the median and the 75th percentile, not the best run. A fix that only helps fast devices is not a fix for the people who were actually suffering.

Before you ship this

Lazy-loading the largest image above the fold makes LCP worse, not better. Give it fetchpriority=”high” instead.

Programs must be written for people to read, and only incidentally for machines to execute.

Harold Abelson, Structure and Interpretation of Computer Programs, 1985

Wrapping up

None of this is new, and that is the point. The techniques that last are usually the boring ones that are documented well and supported by the platform itself.

Priya Raman

Priya Raman

Author

Database and performance engineer. Priya reads query plans for fun and believes every slow page has a story worth measuring.

Related Posts

Comments 8

Chloe Martin

We run this in production at a fairly large scale and can confirm the caveats are real.

Oskar Nilsson

I would push back a little on the second section. In our monorepo the trade-off went the other way.

Sofia Rossi

Great post. Did you measure the impact before and after, or is this mostly from experience?

Amara Nwosu

Shared this with my team. The list near the end is going straight into our pull request template.

Priya Raman Author

The renaming spree is a rite of passage.

Diego Alvarez

We run this in production at a fairly large scale and can confirm the caveats are real.

Fatima Zahra

Came for the snippet, stayed for the explanation.

Liam O’Brien

Any thoughts on how this interacts with server-side rendering?

Leave a comment

Your email will not be published. Sign in for a faster experience.

Supports **bold**, *italic*, and `code`.