1. Home
  2. Glossary
  3. Responsive images
Performance

Responsive images (srcset)

The srcset and sizes attributes list several sizes of an image so the browser downloads one that fits the screen. They stop phones from downloading desktop-sized files.

Why it matters

Phones do not need desktop-sized images. Offering several widths lets the browser choose and avoids wasted downloads.

Example

<img src="photo-480.webp"
  srcset="photo-480.webp 480w, photo-960.webp 960w"
  sizes="(min-width:800px) 480px, 92vw" alt="">

Where you will see it

The free Image alt text & size checker looks at this on a live page and explains what it finds in plain English: find images with missing alt text, heavy files, outdated formats or no width and height.

Related terms

  • Modern image formats: Image formats that usually give smaller files than JPEG or PNG at similar visual quality.
  • Page weight: The total size of all files a browser downloads to show a page: HTML, CSS, JavaScript, images, fonts and more.
  • Responsive design: Building a page so the same HTML adapts to any screen size using flexible layouts and CSS media queries.

Go deeper

  • Page weight explained: What page weight means, which files make pages heavy, how to measure transferred size, and practical ways to shrink images, scripts, fonts and video.

← All 66 glossary terms

↑ ↓ to moveEnter to openEsc to closeAll results