MobileCheck

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.

DeviceViewport (CSS px)Pixel ratioImage (CSS px)Full sharpness (px)Downloads
iPhone 73752×343686690w (2.01×)
iPhone 7 Plus4143×3821146820w (2.15×)
iPhone 83752×343686690w (2.01×)
iPhone 8 Plus4143×3821146820w (2.15×)
iPhone X3753×3431029820w (2.39×)
iPhone XR4142×382764820w (2.15×)
iPhone XS3753×3431029820w (2.39×)
iPhone XS Max4143×3821146820w (2.15×)
iPhone 114142×382764820w (2.15×)
iPhone 11 Pro3753×3431029820w (2.39×)
iPhone 11 Pro Max4143×3821146820w (2.15×)
iPhone SE (2nd/3rd gen)3752×343686690w (2.01×)
iPhone 12 / 13 mini3753×3431029820w (2.39×)
iPhone 12 / 13 / 14 / 16e3903×3581074820w (2.29×)
iPhone 12 / 13 Pro Max, 14 Plus4283×3961188820w (2.07×)
iPhone 14 Pro / 15 / 15 Pro / 163933×3611083820w (2.27×)
iPhone 14 Pro Max / 15 Plus / 15 Pro Max / 16 Plus4303×3981194820w (2.06×)
iPhone 16 Pro / 17 / 17 Pro4023×3701110820w (2.22×)
iPhone 16 Pro Max / 17 Pro Max4403×4081224820w (2.01×)
iPhone Air4203×3881164820w (2.11×)
Samsung Galaxy S73603×328984820w (2.5×)
Samsung Galaxy S8 / S93603×328984820w (2.5×)
Samsung Galaxy S103603×328984820w (2.5×)
Samsung Galaxy S20 / S213603×328984820w (2.5×)
Samsung Galaxy S22 / S23 / S24 / S253603×328984820w (2.5×)
Samsung Galaxy S24 / S25 Ultra3842.813×352990820w (2.33×)
Samsung Galaxy A51 / A714122.625×380998820w (2.16×)
Samsung Galaxy A15 / A54 / A553842.813×352990820w (2.33×)
Galaxy Z Fold 5 (folded)3442.625×312819820w (2.63×)
Galaxy Z Flip 5 / 63603×328984820w (2.5×)
Google Pixel 24122.625×380998820w (2.16×)
Google Pixel 33932.75×361993820w (2.27×)
Google Pixel 4a / 53932.75×361993820w (2.27×)
Google Pixel 6 / 7 / 84122.625×380998820w (2.16×)
Google Pixel 9 / 9a / 104122.625×380998820w (2.16×)
Google Pixel 9 Pro4273×3951185820w (2.08×)
Xiaomi Redmi Note 8 / 93932.75×361993820w (2.27×)
Xiaomi Redmi Note 11 / 12 / 133932.75×361993820w (2.27×)
Xiaomi 133932.75×361993820w (2.27×)
Xiaomi 14 / 154003×3681104820w (2.23×)
Huawei P30 / P403603×328984820w (2.5×)
OnePlus 114122.625×380998820w (2.16×)
iPad 7–9 (10.2")8102×377754760w (2.02×)
iPad 10 / A16, iPad Air 10.9" / 11"8202×382764820w (2.15×)
iPad mini 6 / 77442×344688690w (2.01×)
iPad Pro 11" (2018–2022)8342×389778820w (2.11×)
iPad Pro 11" (M4 / M5)8342×389778820w (2.11×)
iPad Pro 12.9" / iPad Air 13"10242×315629690w (2.19×)
iPad Pro 13" (M4 / M5)10322×317635690w (2.17×)
Galaxy Tab S7 / S8 / S98002×372744760w (2.04×)
Galaxy Tab A8 / A9+8001.5×372558560w (1.51×)
Galaxy Z Fold 5 (unfolded)6902.625×317832820w (2.59×)
Lenovo Tab M10 FHD8001.5×372558560w (1.51×)
Xiaomi Pad 68002.25×372837820w (2.2×)
Laptop 1366 px (1×)13661×384384390w (1.02×)
Laptop 1440 px (2×, e.g. MacBook)14402×384768820w (2.14×)
Desktop 1920 px (1×)19201×384384390w (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):

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

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