Start a project

Tool 40 of 100 · Images

Responsive srcset Generator

Describe how wide an image shows at each breakpoint and get the correct sizes attribute, the widths you need, resized files and ready-to-paste picture markup.

Responsive srcset Generator at a glanceIllustration: 1, Your layout; 2, processed in your browser; 3, srcset + sizes.Responsive srcset Generator1Your layout</>3srcset + sizes2In yourbrowser
1 Your layout 2 processed on your device 3 srcset + sizes

Responsive srcset Generator

Layout

ViewportImage slotChosen width at 1x, 2x, 3x

Image and output

sizes

sizes attribute

Markup

<picture> markup

01

What it does

Works out sizes and the widths needed from your layout, resizes an image to AVIF, WebP and JPEG, and writes <picture> markup.

  • sizes attribute from breakpoints and layout widths
  • Widths needed for 1x, 2x and 3x screens
  • Resizes on this device to AVIF, WebP and JPEG
  • <picture> markup with width, height and loading

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

<picture> markup and a ZIP of resized images, with a Copy and a Download button on every result.

  • srcset
  • sizes
  • AVIF
  • WebP

Why it matters

Responsive images are one of the biggest performance wins and one of the most misunderstood features: the sizes attribute must describe the layout, not the image, and the widths in srcset should match the sizes the layout really needs on real screens.

This generator works both out from a description of your layout, then resizes the image on your device to each width in modern formats and writes the markup, including width and height so the layout doesn't shift.

How it works

  1. InputHow wide the image shows at each breakpoint
  2. In your browserWidths picked for 1×, 2× and 3× screens
  3. Outputsrcset, sizes and a picture element

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Adding responsive images.

By the numbers

The widths the tool picks for the sample layout330w: 330 px wide; 400w: 400 px wide; 480w: 480 px wide; 660w: 660 px wide; 800w: 800 px wide; 990w: 990 px wide; 1200w: 1200 px wide330w330 px wide400w400 px wide480w480 px wide660w660 px wide800w800 px wide990w990 px wide1200w1200 px wide
Chosen by this tool from 15 common screen widths at 1×, 2× and 3× pixel density, keeping a new size only when the last one would be too big, so every screen gets a file close to what it needs. The sizes attribute it writes: (min-width: 1280px) 400px, (min-width: 768px) calc(50vw - 2rem), calc(100vw - 32px). Source: MDN: responsive images.
Show the numbers as a table
Width
330w
400w
480w
660w
800w
990w
1200w

How to use it

  1. Describe the image's width at each breakpoint.
  2. Choose screen densities and the size step.
  3. Pick an image and the formats.
  4. Copy the markup and download the ZIP.

FAQ

What's the sizes attribute for?

It tells the browser how wide the image will display, before the CSS loads, so it can pick the right file from srcset.

Why not just use 2x of the largest size?

Phones would download a desktop-sized file. Matching widths to the layout saves the most bytes on small screens.

Is AVIF always smaller?

Usually, by 20 to 50 percent against JPEG. Some browsers can't create AVIF, so the option is off if yours can't.

Are images uploaded?

No. They're resized on your device.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk