An iframe is an HTML element that shows another web page or document inside a box on your own page, such as a YouTube video, a map, a booking form or a payment widget. The name means “inline frame”. The content inside the box lives at its own address, so search engines and AI systems usually treat it as belonging to that address, not to your page.
What is an iframe? #
MDN, the reference for web developers, describes the iframe element as a nested browsing context that embeds one document in another. In plain words: a window cut into your page that looks out onto a different page. That inner page has its own HTML, its own CSS, its own scripts and its own URL. A simple one looks like this:
<iframe src="https://www.example.org/map" title="Map of our shop" loading="lazy"></iframe>
The src attribute says what to load. The title says what it is. The loading attribute says when to load it.
Where do small businesses meet iframes? #
- Video players from YouTube or Vimeo.
- Maps showing where you are.
- Booking calendars, chat boxes and review widgets from outside services.
- Card payment fields, which payment companies often load in a frame so card numbers never touch your page.
- Social media posts and some advertising.
You may have dozens of them without knowing. Many page builders and plugins add them for you.
Why does it matter for search? #
Text inside an iframe is not really your text. It sits at another address, and that address is what gets crawled and indexed. Google’s robots rules page says Google is allowed to index the content of a page when it is embedded in another page through iframes. That content is still credited to its source. So if your opening hours, prices or product details only appear inside a frame, your own page may look thin to a search crawler, and that is a quick route to thin content.
There is a control for the owner of the embedded page. Google added the indexifembedded rule in a January 2022 post. Used together with noindex, it says: do not show this page on its own, but do let its content count when it is embedded through an iframe. The post gives the meta tag version and an X-Robots-Tag header version. Google’s robots meta tag documentation adds that it only has an effect when paired with noindex.
Why does it matter for AI answers? #
An AI crawler fetches your page to read it. Many of them do not run scripts and do not follow every frame. If the facts a customer needs are locked in an embedded widget, a large language model may never see them, or may credit them to the widget’s company. Then an assistant may guess, which is how an AI hallucination about your firm starts. For answer engine optimisation, the rule is simple: put the key facts in plain text on your own page, and use the frame for the interactive extra.
How does it affect speed? #
Every frame is a whole extra page to fetch. MDN warns that each one adds memory and computing cost. web.dev’s guide to lazy loading iframes says built-in lazy loading is well supported across the major browsers. It reports that lazy loading YouTube embeds saves around 500 KB on the first page load. Adding loading="lazy" to frames lower down the page lets the browser wait until a visitor scrolls near them. That frees bandwidth for your Largest Contentful Paint and helps your Core Web Vitals. Do not lazy load a frame that sits above the fold. See lazy loading and page speed.
What about accessibility? #
Give every frame a title. MDN says the value should concisely describe the embedded content. Without one, screen reader users have to go inside the frame to work out what it is. That is confusing on a page with several frames. It is part of good web accessibility.
What about security? #
Frames work both ways. You can embed others, and others can embed you. Someone could put your login or checkout page in an invisible frame and trick people into clicking. This is called clickjacking. To stop it, send a Content-Security-Policy header with frame-ancestors. MDN notes that leaving it unset allows anything. The value 'none' blocks all embedding, much like the older X-Frame-Options: deny. MDN also says this rule cannot go in a meta tag; it must be an HTTP header.
When you embed other people’s content, the sandbox attribute removes powers such as running scripts or opening pop-ups. MDN strongly discourages combining allow-scripts with allow-same-origin for same-origin content, because the frame can then remove its own sandbox.
Common mistakes #
- Key facts only in a widget. Prices, hours or reviews shown only inside a frame are not your page’s words.
- No title. Screen readers announce an unnamed frame.
- Everything loads at once. Five embeds near the bottom of the page all load before anyone scrolls.
- No frame-ancestors rule. Your pages can be framed by any site.
- Whole pages built from frames. Old sites that frame their own content split one page into several URLs, which muddles canonical tags and internal linking.
A worked example #
A café embeds a booking widget, a map and an Instagram feed on its contact page.
| Element | Before | After |
|---|---|---|
| Booking widget | Hours and phone number only inside it | Hours and phone written as page text above it |
| Map | No title, loads at once | title=”Map of the café”, loading=”lazy” |
| Instagram feed | Loads at once at the bottom | loading=”lazy” |
| Page header | No frame-ancestors | frame-ancestors ‘self’ |
Now a search engine and an AI assistant both read the hours as the café’s own words, and the page loads less on first view.
How to check it #
- View the page source and search for
<iframe. Note eachsrc. - Test what text a machine reads without scripts, using our AI Readiness Checker.
- Check your response headers for frame-ancestors and X-Frame-Options with our HTTP Header Checker. The Security Headers Checker grades them.
- Use the Link Checker to find frames whose source has moved or died.
- For speed, the Page Speed Checker (coming soon) shows heavy embeds. Our free Core Web Vitals calculator explains the scores.
- In Google Search Console, use URL Inspection to see the rendered HTML Google got.
Questions #
Does Google index text inside an iframe? #
It can, but it is tied to the embedded page’s address. Do not rely on it for your own page.
Are iframes bad for SEO? #
No. A video or map in a frame is fine. The problem is when the frame holds the only copy of your key facts.
Should I lazy load every iframe? #
Only those below the first screen. A frame visible on load should load straight away.
Can I stop other sites framing my pages? #
Yes. Send Content-Security-Policy: frame-ancestors 'self' as a header.
Related words #
Sources #
- MDN: the iframe element, checked 24 November 2026
- MDN: CSP frame-ancestors, checked 24 November 2026
- web.dev: It’s time to lazy-load offscreen iframes, checked 24 November 2026
- Google Search Central: Robots meta tag, data-nosnippet and X-Robots-Tag specifications, checked 24 November 2026
- Google Search Central Blog: Letting Google index embedded content (21 January 2022), checked 24 November 2026
Updated 24 November 2026 by URSY.
Cite this page: Iframe. URSY. Updated 24 November 2026. https://ursy.com/wiki/iframe/ · Section links
Tools for this
- LiveAI Readiness Checkeris your site ready for ChatGPT, Gemini, Claude? Score + fixesRun the check →
- LiveAI Bot Checkerwhich AI bots your robots.txt lets inRun the check →
- LiveRobots.txt Checker + Generatortest any address against your rules, or write new onesRun the check →
- LiveSchema Markup CheckerRun the check →