An iframe displays one HTML document inside another. The embedded document has its own URL, its own scripts and its own relationship with search engines. That separation is the source of everything worth knowing about iframes and search.

The rule of thumb

Content you want a page to rank for should be in that page’s own HTML, not in an iframe.

Google renders pages and may load the iframes on them. Its 2022 post introducing indexifembedded confirms that content embedded through iframes can be indexed as part of the embedding page. But “can” is the operative word. The framed document is also a page at its own URL, and a search engine may index it there, attribute the content to that URL, or not load it at all. Most other crawlers, including most AI crawlers, do not load iframes any more than they run scripts (see JavaScript and search).

So an iframe is a reasonable way to include something supplementary. It is an unreliable way to supply the substance of a page.

When iframes are fine

  • Third-party widgets: maps, video players, booking forms, payment fields, social embeds. These are someone else’s application and the iframe boundary is a security feature.
  • Sandboxed or untrusted content, such as user-submitted HTML or advertising.
  • Content that should not count as yours, where the separation is the intention.

For video, embedding a player in an iframe is standard practice. Google’s video guidance asks that the page around the player describe the video and that you supply structured data or a video sitemap, since the player itself tells a crawler very little.

When they cost you

  • Main content in a frame. Product descriptions, articles or reviews loaded from another URL in an iframe may never be credited to the page that displays them.
  • Framing your own pages to build a layout. This is a leftover from the era of framesets. Each framed document can turn up in search results by itself, without the navigation that was supposed to surround it.
  • Framing someone else’s page as your content. It adds nothing a search engine will credit to you.
  • Syndicated widgets that carry your content. If you publish an embeddable widget, the content inside it lives at your widget URL, which may be indexed as a thin standalone page.

That last case is what indexifembedded was created for.

If you publish embeddable content

Suppose you provide a document at embed.example.com/chart/123 for others to embed. You do not want that bare URL in search results, but you are happy for the content to be indexed as part of the pages that embed it.

Using noindex alone used to prevent both. Google’s indexifembedded rule, used together with noindex, separates them (specification):

<meta name="googlebot" content="noindex, indexifembedded">

or as a response header:

X-Robots-Tag: googlebot: noindex, indexifembedded

It only has an effect alongside noindex. At the time of the announcement Google said it was the only search engine supporting the rule.

Attributes worth setting

On any iframe you add to a page (MDN reference):

<iframe
  src="https://www.example.com/embed/123"
  title="Map showing our three branch locations"
  loading="lazy"
  width="600" height="400"
  referrerpolicy="strict-origin-when-cross-origin"
  sandbox="allow-scripts allow-same-origin">
</iframe>
  • title describes the frame to people using screen readers. The W3C lists it as a sufficient technique for identifying frames. It is an accessibility requirement first and may give crawlers a small hint as well.
  • loading="lazy" defers loading until the frame is near the viewport. Third-party embeds are often the heaviest things on a page, and web.dev’s guidance recommends lazy-loading those that start off-screen. Do not lazy-load a frame that is visible when the page opens.
  • width and height reserve the space so that the layout does not shift when the frame loads. That protects the Cumulative Layout Shift measurement discussed in our landing pages guide.
  • sandbox restricts what the framed document can do. Grant only the permissions the embed needs.

Controlling who frames you

The reverse question is whether other sites may put your pages in their iframes. Two response headers govern that: X-Frame-Options (DENY or SAMEORIGIN), and the more flexible Content-Security-Policy: frame-ancestors. These exist to prevent clickjacking. They are security controls and have no direct effect on ranking, but if you set them, embeds of your own pages elsewhere will stop working, so decide deliberately.

Checking

Fetch the embedding page with a tool that does not render, such as our crawler view. It lists the iframes found on the page and shows the text extracted from the page’s own HTML. Whatever is missing from that text and present in a browser is living in a frame or a script.