Boneyard Tools

Responsive Image Srcset Generator

Build a responsive image srcset, the matching sizes attribute, and ready-to-paste img and picture markup. Choose width (w) or pixel-density (x) descriptors, point candidate URLs at a filename suffix, a query parameter, or a custom CDN template, and add AVIF or WebP sources.

How to generate a responsive image srcset

  1. Enter the base image URL or path.
  2. Pick width descriptors and list your candidate widths, or use density descriptors with a base width.
  3. Add sizes rules so the browser knows how wide the image renders at each breakpoint.
  4. Copy the generated srcset, sizes, or the full img or picture element.

Examples

Width descriptors with sizes

/images/hero.jpg, widths 640 1080 1920, 50vw above 1024px
srcset="/images/hero-640w.jpg 640w, /images/hero-1080w.jpg 1080w, /images/hero-1920w.jpg 1920w" sizes="(min-width: 1024px) 50vw, 100vw"

Density descriptors for an icon

/icons/star.png, base 48px, 1x 2x 3x
srcset="/icons/star-48w.png 1x, /icons/star-96w.png 2x, /icons/star-144w.png 3x"

Frequently asked questions

What is the difference between w and x descriptors?

Width (w) descriptors tell the browser each candidate's real pixel width so it can pick the best one for the layout and screen, and they need a sizes attribute. Density (x) descriptors just map files to 1x, 2x, 3x screens and are best for fixed-size images like icons or logos.

Why do I need a sizes attribute?

With width descriptors the browser chooses a candidate before layout, so it needs to know how wide the image will display. The sizes attribute gives that as CSS lengths per breakpoint, for example (min-width: 1024px) 50vw, 100vw. Without it the browser assumes 100vw.

Does this resize my images?

No. It only generates the markup that references your resized files. You still need to produce the actual width variants, whether that is at build time, with an image CDN, or by hand.

How are the candidate URLs built?

Choose suffix to insert -640w before the extension, query to append ?w=640, or a custom template with {name}, {ext} and {w} placeholders for your CDN. For AVIF and WebP sources the extension or a format parameter is swapped automatically.

When should I use the picture element instead of img?

Use a plain img with srcset for serving the same image at different resolutions. Use picture when you also want to offer modern formats like AVIF and WebP with a fallback, or to swap the art direction at different breakpoints.

Is my input sent to a server?

No. The markup is generated entirely in your browser, so nothing you enter leaves your device.

Related tools