Responsive Image srcset and sizes Generator
Describe how wide an image is on phones, tablets and desktops: the generator writes the sizes attribute, suggests a small set of image widths from 54 real device screens, and gives you the <img> or <picture> markup.
1. Describe the image layout
sizes attribute
(min-width: 1232px) 384px, (min-width: 1024px) calc((100vw - 80px) / 3), (min-width: 600px) calc((100vw - 56px) / 2), calc(100vw - 32px)
2. Image widths for 54 real devices
5 widths: 390, 560, 690, 760, 820 px. Each device's need is covered by a file at most about 10% wider.
| Device | Viewport (CSS px) | Pixel ratio | Image (CSS px) | Full sharpness (px) | Downloads |
|---|---|---|---|---|---|
| iPhone 7 | 375 | 2× | 343 | 686 | 690w (2.01×) |
| iPhone 7 Plus | 414 | 3× | 382 | 1146 | 820w (2.15×) |
| iPhone 8 | 375 | 2× | 343 | 686 | 690w (2.01×) |
| iPhone 8 Plus | 414 | 3× | 382 | 1146 | 820w (2.15×) |
| iPhone X | 375 | 3× | 343 | 1029 | 820w (2.39×) |
| iPhone XR | 414 | 2× | 382 | 764 | 820w (2.15×) |
| iPhone XS | 375 | 3× | 343 | 1029 | 820w (2.39×) |
| iPhone XS Max | 414 | 3× | 382 | 1146 | 820w (2.15×) |
| iPhone 11 | 414 | 2× | 382 | 764 | 820w (2.15×) |
| iPhone 11 Pro | 375 | 3× | 343 | 1029 | 820w (2.39×) |
| iPhone 11 Pro Max | 414 | 3× | 382 | 1146 | 820w (2.15×) |
| iPhone SE (2nd/3rd gen) | 375 | 2× | 343 | 686 | 690w (2.01×) |
| iPhone 12 / 13 mini | 375 | 3× | 343 | 1029 | 820w (2.39×) |
| iPhone 12 / 13 / 14 / 16e | 390 | 3× | 358 | 1074 | 820w (2.29×) |
| iPhone 12 / 13 Pro Max, 14 Plus | 428 | 3× | 396 | 1188 | 820w (2.07×) |
| iPhone 14 Pro / 15 / 15 Pro / 16 | 393 | 3× | 361 | 1083 | 820w (2.27×) |
| iPhone 14 Pro Max / 15 Plus / 15 Pro Max / 16 Plus | 430 | 3× | 398 | 1194 | 820w (2.06×) |
| iPhone 16 Pro / 17 / 17 Pro | 402 | 3× | 370 | 1110 | 820w (2.22×) |
| iPhone 16 Pro Max / 17 Pro Max | 440 | 3× | 408 | 1224 | 820w (2.01×) |
| iPhone Air | 420 | 3× | 388 | 1164 | 820w (2.11×) |
| Samsung Galaxy S7 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Samsung Galaxy S8 / S9 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Samsung Galaxy S10 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Samsung Galaxy S20 / S21 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Samsung Galaxy S22 / S23 / S24 / S25 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Samsung Galaxy S24 / S25 Ultra | 384 | 2.813× | 352 | 990 | 820w (2.33×) |
| Samsung Galaxy A51 / A71 | 412 | 2.625× | 380 | 998 | 820w (2.16×) |
| Samsung Galaxy A15 / A54 / A55 | 384 | 2.813× | 352 | 990 | 820w (2.33×) |
| Galaxy Z Fold 5 (folded) | 344 | 2.625× | 312 | 819 | 820w (2.63×) |
| Galaxy Z Flip 5 / 6 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| Google Pixel 2 | 412 | 2.625× | 380 | 998 | 820w (2.16×) |
| Google Pixel 3 | 393 | 2.75× | 361 | 993 | 820w (2.27×) |
| Google Pixel 4a / 5 | 393 | 2.75× | 361 | 993 | 820w (2.27×) |
| Google Pixel 6 / 7 / 8 | 412 | 2.625× | 380 | 998 | 820w (2.16×) |
| Google Pixel 9 / 9a / 10 | 412 | 2.625× | 380 | 998 | 820w (2.16×) |
| Google Pixel 9 Pro | 427 | 3× | 395 | 1185 | 820w (2.08×) |
| Xiaomi Redmi Note 8 / 9 | 393 | 2.75× | 361 | 993 | 820w (2.27×) |
| Xiaomi Redmi Note 11 / 12 / 13 | 393 | 2.75× | 361 | 993 | 820w (2.27×) |
| Xiaomi 13 | 393 | 2.75× | 361 | 993 | 820w (2.27×) |
| Xiaomi 14 / 15 | 400 | 3× | 368 | 1104 | 820w (2.23×) |
| Huawei P30 / P40 | 360 | 3× | 328 | 984 | 820w (2.5×) |
| OnePlus 11 | 412 | 2.625× | 380 | 998 | 820w (2.16×) |
| iPad 7–9 (10.2") | 810 | 2× | 377 | 754 | 760w (2.02×) |
| iPad 10 / A16, iPad Air 10.9" / 11" | 820 | 2× | 382 | 764 | 820w (2.15×) |
| iPad mini 6 / 7 | 744 | 2× | 344 | 688 | 690w (2.01×) |
| iPad Pro 11" (2018–2022) | 834 | 2× | 389 | 778 | 820w (2.11×) |
| iPad Pro 11" (M4 / M5) | 834 | 2× | 389 | 778 | 820w (2.11×) |
| iPad Pro 12.9" / iPad Air 13" | 1024 | 2× | 315 | 629 | 690w (2.19×) |
| iPad Pro 13" (M4 / M5) | 1032 | 2× | 317 | 635 | 690w (2.17×) |
| Galaxy Tab S7 / S8 / S9 | 800 | 2× | 372 | 744 | 760w (2.04×) |
| Galaxy Tab A8 / A9+ | 800 | 1.5× | 372 | 558 | 560w (1.51×) |
| Galaxy Z Fold 5 (unfolded) | 690 | 2.625× | 317 | 832 | 820w (2.59×) |
| Lenovo Tab M10 FHD | 800 | 1.5× | 372 | 558 | 560w (1.51×) |
| Xiaomi Pad 6 | 800 | 2.25× | 372 | 837 | 820w (2.2×) |
| Laptop 1366 px (1×) | 1366 | 1× | 384 | 384 | 390w (1.02×) |
| Laptop 1440 px (2×, e.g. MacBook) | 1440 | 2× | 384 | 768 | 820w (2.14×) |
| Desktop 1920 px (1×) | 1920 | 1× | 384 | 384 | 390w (1.02×) |
54 devices from our catalog in portrait, plus three typical desktop screens (assumed, not from the catalog). "Downloads" assumes the browser takes the smallest file at least as wide as the image × pixel ratio, or the largest file if none is; browsers may choose differently, for example on a slow connection.
3. Markup
<img
src="/img/photo-820.jpg"
srcset="/img/photo-390.jpg 390w,
/img/photo-560.jpg 560w,
/img/photo-690.jpg 690w,
/img/photo-760.jpg 760w,
/img/photo-820.jpg 820w"
sizes="(min-width: 1232px) 384px, (min-width: 1024px) calc((100vw - 80px) / 3), (min-width: 600px) calc((100vw - 56px) / 2), calc(100vw - 32px)"
width="820" height="547"
alt="Describe the image"
loading="lazy" decoding="async">
Add img { max-width: 100%; height: auto; } to your CSS so the width and height attributes only set the aspect ratio.
How srcset and sizes work together
srcset lists the files you have and their real pixel widths (800w). sizes tells the browser how wide the image will be drawn, before the CSS has loaded. The browser multiplies that width by the screen's pixel ratio and picks a file at least that wide — a 358 px wide image on a 3× iPhone needs about 1074 pixels, on a 2.625× Pixel about 940 (MDN: Responsive images).
The rules for sizes (HTML standard):
- Entries are separated by commas; each is a media condition followed by a length:
(min-width: 1024px) 384px. - The browser uses the first entry whose condition matches, so list
min-widthconditions from the widest down. - The last entry has no media condition: it is the size for everything else, here the phones.
- Lengths can be px,
vworcalc(), but not percentages. - Without
sizes, asrcsetwithwwidths is treated as100vw— a half-width image then downloads twice as many pixels as it needs.
How the widths are chosen
For each device the tool works out the image's display width from your layout and multiplies it by the pixel ratio, capped at the density you choose. It then groups the needs from the smallest up: a group takes every need within a tolerance of its smallest, and its file is the group's largest need rounded up to 10 px. The tolerance starts at 10% and grows until there are no more widths than you allow. Few files, each only a little larger than the devices it serves.
Why cap at 2×? Most iPhones are 3× and many Android phones around 2.6×. For photos, the extra pixels of a 3× file are hard to see at arm's length, but the file can be more than twice the size of a 2× one. The cap only limits the widths the tool suggests: a 3× phone will still take a larger file if one exists for a bigger layout, as the "Downloads" column shows. Keep 3× for logos, screenshots with text and line art — or use SVG for those.
Formats, loading and layout shift
- AVIF and WebP are usually much smaller than JPEG at similar quality. With
<picture>, the browser takes the first<source>whosetypeit supports and falls back to the<img>; each source needs its ownsrcsetandsizes. widthandheightlet the browser reserve the image's space before it loads, which prevents layout shift. Give the original's proportions; the CSS line under the markup keeps the image responsive.loading="lazy"delays images below the first screen. Never on the main image at the top: that one getsfetchpriority="high", as the Largest Contentful Paint guide explains.decoding="async"lets the browser decode the image off the main path; it's a hint and harmless on images further down.
On iPhone vs Android
The same page can weigh more on an iPhone: with the same layout, an iPhone at 3× asks for a wider file than a Pixel or Galaxy A phone at 2.625×, so it often takes the next width up. The table above shows the difference per device. Android's Data Saver and slow connections can make Chrome pick a smaller file than the screen would need — the HTML standard leaves that choice to the browser — so treat "Downloads" as the typical case.
Checking the result
In Chrome DevTools, emulate a phone, reload, and look at the image's currentSrc in the Console or at the Network panel to see which file was taken. Compare per-device page weight in a MobileCheck report — the page weight guide covers what else adds up — and see the mobile viewport sizes list for every device's width and pixel ratio.
Frequently asked questions
What should the sizes attribute contain?
The width the image will be displayed at, for each layout: media conditions from the widest down, each followed by a width in px, vw or calc(), and a last entry without a condition. Percentages are not allowed. Without sizes, the browser assumes the image is as wide as the viewport (100vw).
How many image widths do I need in srcset?
Usually four to six. More widths save a few kilobytes per device but multiply the files you store and cache. Choose them so every common screen gets a file only a little larger than it needs, as this tool does.
Do 3x phones need 3x images?
Most iPhones are 3x, but for photos the difference between 2x and 3x is rarely visible at phone viewing distance, while the file can be more than twice as heavy. Capping the largest candidates around 2x is a common trade-off; keep 3x for sharp text or line art.
Should the main image be lazy-loaded?
No. Lazy-loading the image that becomes the Largest Contentful Paint delays it. Load the first-screen image normally with fetchpriority="high", and lazy-load images further down.
More free tools: color contrast checker · tap target size checker · mobile font size calculator · css media query generator · device mockup generator · viewport units visualizer · safe area inset preview · link preview checker · ai crawler access checker · image alt text checker · all tools