BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

Picture tag: When to use it instead of srcset

The HTML picture tag lets the browser choose between image files by format, screen size or color scheme. Use it for format fallbacks and different crops.

Monthly searches · picture tag
1.3k
Keyword research data
picture tag
Picture tag: When to use it instead of srcset
Click the image to view it full size

The <picture> element is an HTML wrapper for one image that comes in several files. Inside it you list <source> elements, each with a condition, and end with an ordinary <img>. The browser goes through the sources in order, takes the first one whose conditions it meets, and shows that file in the <img>. If none match, or the browser is very old, it shows the <img>'s own src.

<picture>
  <source srcset="team.avif" type="image/avif">
  <source srcset="team.webp" type="image/webp">
  <img src="team.jpg" alt="Our support team at the 2026 summer meetup" width="1200" height="800">
</picture>

Here a browser that supports AVIF loads team.avif, one that supports only WebP loads team.webp, and everything else loads the JPEG.

The <img> isn't just a fallback. It's the element that actually displays the image, so alt, width, height, loading and CSS such as object-fit all go on the <img>, not on <picture>.

Use picture for these three jobs

You want to... Condition on each <source> Example
Serve newer formats with a fallback type="image/avif", type="image/webp" AVIF, then WebP, then JPEG
Show a different crop on different screens (art direction) media="(min-width: 75em)" Wide banner on desktop, square crop on phones
Swap images for dark or light mode media="(prefers-color-scheme: dark)" A light logo on dark backgrounds

For newer formats, see WebP. For crops, the media conditions work like the media queries in your CSS.

Use srcset instead when it's the same image

If you only need the same picture at different sizes or pixel densities, skip <picture> and put srcset and sizes on the <img>:

<img src="team-800.jpg"
     srcset="team-480.jpg 480w, team-800.jpg 800w, team-1600.jpg 1600w"
     sizes="(max-width: 600px) 100vw, 800px"
     alt="Our support team at the 2026 summer meetup" width="800" height="533">

The difference is who decides. srcset on an <img> gives the browser suggestions, and it picks a file based on screen, network and settings; it can choose a smaller file in data-saving mode, for example. <picture> gives commands: the browser must use the first matching source. Use commands only when you need them, for a format the browser might not support or a crop that must change. Responsive images covers srcset and sizes in depth.

You can also combine the two: each <source> can carry its own srcset and sizes, so one art-directed crop still comes in several widths.

What Google sees in a picture element

Google finds images in the src attribute of the <img>, including an <img> inside <picture>. It also notes that some browsers and crawlers don't understand <picture> or srcset, and recommends always giving the <img> a fallback src. Google Search Central

So, for image SEO:

  • Make the <img src> a real, good-quality version of the image, not a tiny placeholder. It's the file you can count on Google finding.
  • Use a format Google supports there: BMP, GIF, JPEG, PNG, WebP, SVG or AVIF.
  • Write one alt text that fits every version. There's only one alt, on the <img>, so "Our support team at the summer meetup" must describe the wide shot and the square crop alike.

Rules that keep picture working

  • Always end with an <img>. Without it nothing displays. Both the opening and closing <picture> tags are required.
  • Put the most specific or preferred source first. The browser takes the first match, not the best one. List AVIF before WebP, and a min-width: 75em source before a min-width: 40em one.
  • Give each crop its dimensions. When sources have different aspect ratios, add width and height to each <source> as well as to the <img>, so the browser reserves the right space and the page doesn't jump. That jump is cumulative layout shift.
  • Don't mix descriptor types. Within one srcset, use either width descriptors (480w) or density descriptors (2x), never both.
  • Treat the hero image with care. If the picture is your largest image above the fold, it's probably your Largest Contentful Paint element: don't lazy-load it, and consider fetchpriority="high" on the <img>.

Browser support

Every current browser supports <picture>. It has worked across browsers since March 2016, from Chrome 38, Firefox 38 and Safari 9.1. A browser that doesn't know the element simply ignores the <source> lines and shows the <img>, which is why the fallback matters.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.