Responsive Image Srcset Calculator
Generate responsive image candidate widths, srcset strings, sizes attributes, and starter img markup from entered display and layout assumptions. Use this responsive image srcset calculator when you already know the image slot and need practical markup, then cross-check with aspect ratio, viewport unit, and file size when dimensions, layout units, or bandwidth also matter. This calculator auto-updates when values change.
Responsive image inputs
Generate width candidates, srcset, and sizes markup.
Create the actual resized image files separately. This calculator generates markup and candidate widths; it does not resize, crop, compress, upload, or optimise image files.
Generated candidates
5
Widths: 320, 640, 960, 1280, 1920 px. Fallback image: 640px.
srcset
hero-320.webp 320w, hero-640.webp 640w, hero-960.webp 960w, hero-1280.webp 1280w, hero-1920.webp 1920w
sizes
(max-width: 768px) 90vw, 640px
img markup
<img src="hero-640.webp" srcset="hero-320.webp 320w, hero-640.webp 640w, hero-960.webp 960w, hero-1280.webp 1280w, hero-1920.webp 1920w" sizes="(max-width: 768px) 90vw, 640px" alt="" width="640" height="auto" loading="lazy" decoding="async">
About This Responsive Image Srcset Calculator
This responsive image srcset calculator helps plan the image widths and markup a browser needs to choose an appropriate file for different screens and pixel densities.
Enter the displayed image width, largest source width, mobile slot width, breakpoint, and desktop slot width. The calculator produces candidate widths, a srcset string, a sizes attribute, and starter img markup.
Use the aspect ratio calculator when the problem is proportional width and height. Use this tool when the problem is responsive image delivery markup.
Responsive Image Example
A hero image displayed at 640 px on desktop may need 320, 640, 960, 1280, and 1920 px files depending on source size and pixel density.
The srcset attribute lists available files with width descriptors. The sizes attribute tells the browser how wide the image will be in the layout.
When sizes is wrong, the browser may download an image that is too large or too small even if the srcset list is technically valid.
What This Generates
The width candidates are based on fractions and multiples of the entered display width, capped by the largest source image width.
The srcset output assumes a simple file naming pattern such as hero-640.webp. Adjust the file names if your CDN, image pipeline, or framework uses a different convention.
The img markup includes a lazy-loading starter example, but production pages should still set a real alt value and stable intrinsic dimensions.
Where This Fits Beside Other Tools
Use viewport unit calculator when you need to turn vw or vh layout units into pixels.
Use CSS clamp calculator when image-adjacent spacing or typography needs fluid CSS values.
This calculator does not crop, compress, upload, resize files, generate art-direction picture elements, or test Core Web Vitals.
A practical responsive image workflow
Start with the rendered image slot, not only the original image file. The browser chooses from srcset based on the layout width declared by sizes and the device pixel ratio.
Generate a sensible range of candidate widths, then create the real files in your image pipeline, CDN, CMS, or build process.
Copy the output into the real component and test it with browser devtools because CSS containers, object-fit, lazy loading, and framework image components can change the final request.
Worked example: 640 px display with 1920 px source
A desktop image displayed at 640 px may use candidates around 320, 640, 960, 1280, and 1920 px depending on density and source width.
The srcset attribute lists the files and width descriptors. The sizes attribute tells the browser how wide the image will render at the current viewport.
If sizes says the image is wider than it really is, the browser can waste bandwidth. If it says the image is narrower, high-density screens may receive a soft image.
How candidate widths are chosen
This calculator starts from the intended display width and creates common fractional and density-related candidates, capped at the largest source width.
The output uses width descriptors such as 640w, which are usually easier to manage for responsive layout images than fixed 1x/2x density-only sets.
The file names are a naming convention, not a file generator. Adjust them to match your CDN, static export, CMS, or framework image path.
What this calculator does not do
It does not upload, crop, resize, compress, transcode, strip metadata, generate blur placeholders, test Core Web Vitals, or create art-direction picture elements.
It also does not know your real CSS after hydration. Test the markup in the final layout, especially when containers change between mobile and desktop.
Use aspect ratio calculator for proportional dimensions and viewport unit calculator for vw/vh conversions.
What this responsive image srcset calculator covers
This page should target responsive image srcset calculator, srcset generator, sizes attribute calculator, responsive image markup, and image width candidates searches.
It generates markup from manual assumptions. It does not replace image optimisation pipelines, CDN transforms, framework image components, visual QA, or performance testing.
Responsive Image Srcset Calculator Example
A common workflow is to paste or enter a real sample, review the output, then adjust one setting at a time. This makes it easier to see exactly what changed and avoid copying an incorrect result.
For developer and web-design tasks, test the result in the place it will actually be used. Encoded text, CSS values, parsed URLs, timestamps, and generated strings can behave differently depending on the target system.
Practical Checks Before Using the Output
Check formatting, character escaping, units, timezone assumptions, and browser support before using the output in production. Small formatting differences can break code, URLs, data files, or layouts.
Avoid pasting private secrets, passwords, API keys, or personal data into tools unless you are comfortable with where that data is processed. These calculators are designed for convenient local checks, not secure secret handling.
Where This Helps in a Real Build
Design and frontend work often gets messy when values are guessed by eye. A calculator can turn a layout idea into a concrete number, whether you are scaling media, choosing colour formats, planning gaps, or building fluid CSS.
The best use is comparison. Try the value at small, medium, and wide sizes, then decide whether the output still feels balanced inside the actual component rather than only in the calculator preview.
Before You Paste Into CSS
Check the surrounding styles before copying the result. Padding, box sizing, container width, inherited font size, and browser rounding can all change how a mathematically correct value looks on the page.
Keep a short note of the design reason for the number if the value will live in production CSS. Future edits are easier when another person can see whether the value came from a ratio, a breakpoint, a spacing rule, or a one-off layout fix.
How to Use This Tool
- 1
Enter display and source width
Use the intended rendered image width and the largest file width you can generate.
- 2
Set layout slot assumptions
Add mobile viewport share, breakpoint, and desktop slot width so the sizes attribute matches the layout.
- 3
Choose naming and density options
Set the base file name, extension, and whether to include a 3x density candidate.
- 4
Copy srcset, sizes, or markup
Use the output as a starter and test it in the final component or template.
Frequently Asked Questions
Does this resize image files?v
No. It generates candidate widths and markup. Create the actual resized files with your image pipeline, CDN, CMS, or build process.
What is srcset?v
srcset lists available image files and their widths so the browser can choose a suitable resource.
What does sizes do?v
sizes tells the browser how wide the image will render at different viewport widths. It is essential for width-based srcset choices.
Should every image include 3x?v
Not always. 3x can be useful for small assets on dense screens, but large photographic images may waste bandwidth if the source is already large enough.
Does this create the resized image files?v
No. It creates width candidates and markup. Use an image pipeline, CDN, CMS, or build process to create the actual files.
What is the sizes attribute?v
sizes tells the browser the rendered image slot width so it can choose an appropriate srcset candidate.
Should I use width descriptors or 1x/2x descriptors?v
Width descriptors are usually better for responsive layout images because they work with the sizes attribute across many viewport widths.
Can this generate picture art direction markup?v
No. This version focuses on one image crop with width-based srcset. Art direction can be a separate tool if needed.
