Download our Free HTML Cheat Sheet - Quick Reference for Beginners

iFrame generator

Use this iFrame generator to create the code for an inline frame (iframe) to display another webpage within your page, with a live working preview as you build it.
This live preview updates as you fill in the form below.
Live preview - updates as you type
Live preview
Showing a placeholder page - enter a URL below to preview it. Some sites block being shown in an iframe (via X-Frame-Options), in which case they'll refuse to load here even though the code will still work fine placed on your own page for URLs that do allow it.

Basic options

Iframe ID:
Not seen on the page - only needs to be unique if you're using more than one iframe on the same page, or they'll conflict. It's also what a link's target attribute points at if you want a link elsewhere on the page to load into this iframe (see the FAQ below).
URL of page to load in iframe:
Full URL or the relative path
Scrolling:
Width:
Height:
Border style:
Fill in the form, then click Generate to get your iframe code.
</>
Your iframe code will appear here

About iframes

An iframe (inline frame) embeds a second, entirely independent webpage inside a rectangle on your own page - its own document, scripts and styles, sandboxed from the page that contains it. It's the same mechanism behind embedded YouTube videos, Google Maps embeds, and payment widgets: the parent page includes a chunk of someone else's site without merging the two together.

Give the iframe a name and you can also change what it shows without a full page reload - point any link's target attribute at that name and clicking it loads the link's URL inside the iframe instead of navigating away, similar to how framesets worked in the pre-CSS era, but scoped to just the one element.

Frequently asked questions

Why won't some websites load in my iframe?

Many sites send an X-Frame-Options or Content-Security-Policy: frame-ancestors header specifically to stop being embedded in someone else's page (a security measure against "clickjacking"). If a site blocks framing, no iframe code - including this one - can override that; you'll need to link to it normally instead.

Is using an iframe bad for SEO?

Content inside an iframe belongs to the embedded page, not yours - search engines generally won't credit that content to your page. Use an iframe for functional embeds (maps, forms, widgets, another site's page), not for content you want your own page to rank for.

How do I make the iframe responsive?

Set the width to 100% and a fixed height, or wrap the iframe in a container styled with aspect-ratio in your stylesheet if you need it to scale proportionally (common for embedded video).

Can a link elsewhere on the page change what's shown in the iframe?

Yes - use the "Iframe ID" field above, then set any link's target attribute to that same ID. Clicking the link loads its href inside the iframe instead of navigating the whole page.