UTILS.
Private by default
⧉

Image srcset Generator

Generate a responsive <img> tag with srcset and sizes from a path and width list.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
— output appears here —

About this tool

Image Srcset Generator writes the HTML for a responsive image. Enter the base image path, a comma-separated list of widths and the alt text, and it produces an img tag with src, srcset, sizes and alt attributes, ready to copy.

File names are built by inserting a -{width}w suffix before the extension, so /img/hero.jpg with 320, 640 and 1280 gives hero-320w.jpg, hero-640w.jpg and hero-1280w.jpg, each with a matching w descriptor. Widths are read as whole numbers, sorted from smallest to largest, and duplicates, zeros and non-numeric entries are dropped. The src fallback is the largest file, and sizes is set to (max-width: Wpx) 100vw, Wpx using that largest width. A dot in a folder name is not mistaken for an extension, and a path without an extension simply gets the suffix at the end.

The tool only writes markup: you still have to create and upload the resized files with those names, and you should adjust sizes to match your real layout. Double quotes in the alt text are escaped, but other special characters are left as typed. Nothing is uploaded; it runs in your browser.

Frequently asked questions

How are the srcset URLs named?
The width is inserted before the extension as -{width}w, so /img/hero.jpg at 640 becomes /img/hero-640w.jpg 640w. You need to export your files with the same names.
Do I still need to create the resized images?
Yes. The tool only generates the HTML. Use an image resizer or build step to produce a file for each width and upload them.
What does the sizes attribute say?
It is (max-width: Wpx) 100vw, Wpx with W as your largest width: full viewport width on narrower screens, otherwise W pixels. Edit it if your layout is narrower or in columns.
What happens to invalid widths?
Entries that are not positive numbers are ignored, duplicates are removed and the rest are sorted ascending. If none remain, no output is shown.

More tools