Iframes aren't bad for SEO by themselves. Google can index framed content, but it's generally credited to the iframe's source URL, not your page, so anything you want to rank belongs in your own HTML. Use iframes for videos, maps and widgets, give each a title, reserve its space and lazy-load it to protect Core Web Vitals.
Does Google index iframe content?
Yes, with a catch. When Googlebot renders your page and finds an <iframe src="…">, the framed document is a separate URL. Google can crawl and index that URL on its own, provided robots.txt allows it and it isn't marked noindex. The content is generally attributed to the source URL, not to the page that embeds it.
Google may associate framed content with the parent page in some cases, and its indexifembedded rule (covered below) exists precisely because embedded content can be indexed as part of the embedding page. But Google doesn't document exactly when that happens, so don't build a strategy on it. The safe assumption:
- Text, headings and links inside an iframe don't count as your page's on-page content.
- Embedded content doesn't pass the ranking value that the same content would have in your own HTML.
- If the iframe source is blocked by robots.txt, Google can't fetch it at all.
To see what Googlebot renders for a specific page, run the live test in Search Console's URL Inspection tool and check the screenshot and rendered HTML.
When are iframes bad for SEO?
Pages that are mostly embedded content
The classic problem is a page whose main content is an iframe: a "tool" page that frames an app on another domain, a partner article framed in, or a page that is just a big embedded form or PDF. From Google's point of view your URL has a heading, some navigation and a box. There's little on the page to understand or rank, and the valuable content is credited elsewhere.
The fix isn't to remove the embed. Add real, original content around it: what the tool does, how to use it, the key facts from the document, answers to the questions people search for. If you control both sides, consider serving the content directly on the page instead (see the alternatives below).
Iframes and Core Web Vitals
Performance is the more common way iframes cost you. Each iframe is a full document with its own HTML, CSS, scripts and often trackers. How that shows up in Core Web Vitals:
| Metric | How iframes can hurt it | Main fix |
|---|---|---|
| LCP (Largest Contentful Paint) | Eagerly loaded embeds compete with your hero image, fonts and CSS for bandwidth and CPU. | loading="lazy" below the fold; facades for heavy players. |
| INP (Interaction to Next Paint) | Third-party scripts inside frames can compete for the main thread in some browsers, making your page slower to respond. | Fewer embeds; load them on interaction. |
| CLS (Cumulative Layout Shift) | An iframe without dimensions, or one that resizes after load, pushes content down. | width/height or aspect-ratio; a reserved minimum height for auto-resizing widgets. |
Core Web Vitals are one ranking signal among many, so a slow embed won't sink a strong page. They do affect how your page feels, and they're the part of iframe SEO you fully control.
When iframes are fine for SEO
Most iframes are harmless because they're supporting content, not the main content:
- Videos from YouTube or Vimeo next to a written explanation.
- Maps on a contact or location page that already lists the address in text.
- Widgets such as booking forms, calculators, social posts, payment forms and support chat.
- Documents like PDFs, when the page also summarises them (see how to embed a PDF in HTML).
The pattern is the same each time: the page stands on its own in text, and the iframe adds something text can't. For the basics of embedding cleanly, see how to embed a website in HTML.
Iframe SEO best practices
Give every iframe a title and surrounding text
<h2>Visit our Berlin office</h2>
<p>We're at Example Strasse 1, 10115 Berlin, five minutes from the main station.</p>
<iframe
src="https://www.google.com/maps/embed?pb=YOUR_EMBED_PARAMS"
title="Map of our Berlin office"
width="600" height="450"
style="width:100%; height:auto; aspect-ratio:4/3; border:0"
loading="lazy"></iframe>
The title tells screen reader users what the frame contains. The surrounding text gives search engines the facts (here, the address) in your own HTML, where they count.
Lazy-load iframes below the fold
loading="lazy" is supported for iframes in modern browsers and defers the frame until it's near the viewport. Don't lazy-load an iframe that is the first thing visitors see; that only delays it.
Use a facade for YouTube and other heavy players
A facade shows a lightweight thumbnail and play button, and only creates the real iframe when clicked. The open-source lite-youtube-embed component does this, or you can write a small version:
<button class="yt-facade" data-id="VIDEO_ID" aria-label="Play video: Product tour">
<img src="https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg" alt="" loading="lazy">
</button>
<style>
.yt-facade, .yt-player { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.yt-facade { padding: 0; cursor: pointer; background: #000; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; }
</style>
<script>
document.querySelectorAll('.yt-facade').forEach(function (btn) {
btn.addEventListener('click', function () {
var iframe = document.createElement('iframe');
iframe.className = 'yt-player';
iframe.src = 'https://www.youtube-nocookie.com/embed/' + btn.dataset.id + '?autoplay=1';
iframe.title = btn.getAttribute('aria-label');
iframe.allow = 'autoplay; encrypted-media; picture-in-picture';
iframe.allowFullscreen = true;
btn.replaceWith(iframe);
}, { once: true });
});
</script>
With a facade, there's no video iframe in the rendered page until someone clicks. If appearing in video results matters, add VideoObject structured data and check the page with URL Inspection rather than assuming Google still finds the video.
Reserve space to prevent layout shift
Set width and height attributes or a CSS aspect-ratio so the browser holds the box before the frame loads. For widgets that grow to fit their content, set a sensible min-height. Our responsive iframe guide covers aspect ratios and auto-resizing.
How to use noindex and indexifembedded for embeddable content
If you publish content for others to embed (players, widgets, charts, badges), you usually serve it from dedicated URLs like /embed/video/42. Those bare pages make poor search results, so decide how Google should treat them:
| Goal | What to send on the embed URL |
|---|---|
| Keep the embed URL out of search entirely | noindex |
| Keep the embed URL out of search, but let Google index its content as part of pages that embed it | noindex + indexifembedded |
| Rank the embed URL itself | Nothing, but that's rarely what you want |
indexifembedded is a Google robots rule. It only has an effect together with noindex, and other search engines may not support it. As an HTTP header, which also works for non-HTML responses:
X-Robots-Tag: noindex, indexifembedded
Or as a meta tag in the embed page's <head>:
<meta name="robots" content="noindex, indexifembedded">
Scoped to embed routes in Nginx:
location /embed/ {
add_header X-Robots-Tag "noindex, indexifembedded" always;
# ...proxy_pass or root as usual
}
Google has to crawl a URL to see its noindex or indexifembedded rule. A robots.txt Disallow hides both rules and stops Google fetching the content when it renders pages that embed it.
Embed URLs also need framing headers that allow partner sites. A strict site-wide X-Frame-Options: DENY will break them; scope a frame-ancestors policy to the embed routes as described in clickjacking protection and X-Frame-Options vs frame-ancestors.
Canonical tags for embed-only URLs
If /embed/video/42 shows the same video as your full page /videos/42, you have two ways to consolidate:
noindexon the embed URL (optionally withindexifembedded). This is the clearest signal for a bare player page.rel="canonical"to the full page, if the embed page is a close duplicate and you'd rather Google fold its signals into the main URL. Canonicals are a hint, and Google may ignore one pointing at a page that looks quite different.
Pick one approach per URL. Combining noindex with a canonical to another page sends mixed signals. Also keep the full page self-canonical and indexable, and link embeds back to it (a "Watch on our site" link, for example) so users and crawlers can reach the version you want to rank.
<!-- On /embed/video/42, if you choose the canonical route -->
<link rel="canonical" href="https://your-site.example/videos/42">
Iframes vs server-side includes vs APIs for content you want to rank
When the content is yours and you want it to rank on the embedding page, an iframe is the wrong tool. Compare the options:
| Method | Content counts for the page? | Best for |
|---|---|---|
| Iframe | Generally no; credited to the source URL | Third-party players, maps, isolated widgets, untrusted content |
| Server-side include or rendering (SSI, edge includes, server components, templates) | Yes; it's in the HTML Google receives | Your own content shared across pages or sites |
| API + client-side rendering | Usually, if Google renders the JavaScript successfully; rendering can be delayed | Interactive or frequently updated data |
| API + server-side rendering | Yes | Syndicated content you want indexed on each page |
If partners syndicate your content in their own HTML, ask them to add a cross-domain canonical to your original or to noindex their copy, so you aren't competing with your own content.
Where iframe SEO and accessibility overlap
Several iframe SEO best practices are accessibility requirements too:
titleattribute: screen readers announce it when entering the frame. Make it describe the content, not just say "iframe".- Text alternatives: a transcript for videos or an address for maps helps users who can't use the embed, and it's indexable text on your page.
- Keyboard access: users must be able to tab into and out of the frame. Test that embedded widgets don't trap focus.
- No hidden frames with content: tracking frames should be hidden from assistive technology (
aria-hidden="true"andtabindex="-1"), and anything meaningful should be visible.
An iframe SEO audit checklist
- List every iframe on key templates:
document.querySelectorAll('iframe')in the console, or a crawler that reports iframes. - For each page, check that its main content is in the page's own HTML, not inside a frame.
- Confirm every iframe has a descriptive
title. - Check dimensions:
width/heightoraspect-ratioset, no layout shift on load. - Lazy-load below-the-fold iframes; don't lazy-load the first one in view.
- Replace heavy video embeds with facades where video search isn't a priority.
- Review field Core Web Vitals in Search Console for templates with embeds.
- For embed URLs you publish:
noindex(plusindexifembeddedif wanted), not blocked in robots.txt, framing allowed for partners. - Check that every embed actually loads. A frame blocked by headers or mixed content shows an empty box or an error, which is bad for users.
For that last step, paste each iframe src into the testiframe.com iframe tester, or deep link it as https://testiframe.com/?url=https%3A%2F%2Fyour-site.example%2Fembed%2Fvideo%2F42. It shows a live preview and reports whether X-Frame-Options, frame-ancestors, mixed content or a bot challenge blocks the frame. The "Would it load on your site?" check tests against a partner's origin. If something is blocked, the refused-to-connect guide walks through the fixes.
FAQ
Does Google index iframe content?
Yes, Google can crawl and index the page an iframe points to, as long as robots.txt allows it and the page is not noindexed. That content is generally credited to the iframe's source URL rather than to the page embedding it, although Google may associate it with the parent page in some cases.
Are iframes bad for SEO?
Not by themselves. Iframes become a problem when a page is mostly embedded content with little text of its own, or when heavy embeds slow the page and hurt Core Web Vitals. Videos, maps and widgets alongside real content are fine.
Do YouTube embeds slow down my page?
A standard YouTube iframe loads a player with a lot of script before anyone presses play. Lazy load it with loading="lazy" if it is below the fold, or replace it with a facade: a thumbnail and play button that only loads the real iframe when clicked.
What does indexifembedded do?
indexifembedded is a Google robots rule that only has an effect together with noindex. It keeps the URL itself out of Google's index but allows Google to index its content when it is embedded in another page through an iframe. Other search engines may not support it.
Should I noindex my embed pages?
Usually yes. Embed-only URLs such as /embed/video/42 are bare pages that make poor search results. Add X-Robots-Tag: noindex, or noindex with indexifembedded if you want the content indexed where it is embedded, and keep the full page as the version you want to rank.