Home › All Tools ›

HTML IFrame Generator

Use HTML IFrame Generator online for free at FreeToolZones — no sign-up, no watermark.

Loading tool...

The HTML IFrame Generator on FreeToolZones builds iframe elements for embedding one web page inside another. You enter the address to embed, set the width and height, add a descriptive title, and choose loading, referrer, fullscreen, and sandbox settings. The tool generates the complete iframe tag and shows a live preview, so you can confirm the embedded page displays before you copy the code.

Embedding is how maps, videos, documents, forms, and dashboards appear inside other pages. An iframe creates a window onto another page, complete with its own browsing context. Done well, embedding feels seamless: the content appears where readers need it, without a trip to another tab. Done carelessly, embedding creates slow pages, confusing behavior, and security exposure. The settings on an iframe decide which outcome you get.

This generator presents every meaningful iframe decision as a labeled control: size, title, loading behavior, referrer policy, fullscreen permission, and sandbox restrictions. This page explains each setting, what the generated code contains, and how to embed responsibly.

What Is the HTML IFrame Generator?

The HTML IFrame Generator is a browser-based tool that produces a complete iframe element from the values you enter. The essential input is the Page URL to embed, the address of the page that will appear inside the frame. If the URL is empty, the tool shows a message asking you to enter the URL to embed, and the preview and code are cleared. The tool starts with a placeholder example address already filled in, which you should replace with your real destination.

Size is controlled by two fields. The Width field accepts a pixel number or a percentage, defaulting to full width. If the entered width is not a valid number or percentage, the tool falls back to full width. The Height field accepts a pixel value from 50 to 2000, defaulting to 400, and values outside that range are clamped to the nearest allowed value. The Title field holds a description of the embedded content for accessibility, defaulting to a generic description that you should replace with a specific one.

The Loading dropdown controls when the browser fetches the embedded page. Lazy loading defers fetching until the frame is near the viewport, which speeds up the initial page load. Eager loading fetches immediately. The browser default option omits the loading attribute entirely, leaving the decision to the browser. Lazy is the default, since embedded content below the fold rarely needs to load immediately.

The Referrer policy dropdown controls what referrer information the browser sends when fetching the embedded page. The default option omits the attribute. The other options are no-referrer, no-referrer-when-downgrade, origin, same-origin, strict-origin, and unsafe-url, each sending a different amount of information about the embedding page. Choosing a policy is a privacy decision about how much of your page’s address the embedded site should learn.

The Allow fullscreen checkbox, on by default, adds the fullscreen attribute, letting the embedded content expand to fill the screen when it requests it. The Enable sandbox checkbox, also on by default, adds the sandbox attribute, which restricts what the embedded page can do. Five sandbox permission checkboxes, all off by default, selectively re-enable capabilities: scripts, same-origin access, forms, popups, and downloads. The permission checkboxes are disabled while the sandbox itself is off, since they have no meaning without it. When the sandbox is on and no permissions are selected, the generated tag carries a bare sandbox attribute, which applies the maximum restriction.

How to Use the HTML IFrame Generator

Building an embed takes a few steps.

  1. Enter the page URL to embed. Type or paste the full address of the page to embed, including the https prefix. Replace the placeholder example address with your real destination.
  2. Set the width and height. Enter a width as a pixel number or a percentage, and a height in pixels between 50 and 2000. Full width with a height of 400 suits most embeds. Check the preview to confirm the proportions suit the content.
  3. Write a descriptive title. Replace the generic default title with a specific description of the embedded content, such as what the embedded page shows or does. The title is read by assistive technology and is the only accessible name the frame has.
  4. Choose loading and referrer settings. Leave loading on lazy unless the embedded content must appear immediately. Choose a referrer policy that matches your privacy needs, or leave the browser default.
  5. Set fullscreen and sandbox options. Leave fullscreen on when the embedded content may need it, such as video players. Leave the sandbox on, and tick only the permissions the embedded content genuinely needs, starting with none and adding the minimum that makes the content work.
  6. Check the preview. The preview shows the embedded page at the chosen size with the chosen settings applied. If the preview stays blank, the embedded site likely blocks embedding, as explained in the limitations section.
  7. Copy the HTML. Press Copy HTML to copy the complete iframe element. If no URL has been entered, the tool shows a message explaining that you need to enter a URL first.

The output updates automatically as you change any setting, after a short delay. This makes it easy to tune the size: adjust the height, watch the preview, and settle on the value that shows the content without excessive empty space or scrolling. The preview applies the sandbox and fullscreen settings too, so it reflects the real behavior of the generated code, not just its size.

Test the embed with the minimum sandbox permissions first. If the embedded content needs scripts to function, add the scripts permission. If it needs to submit forms, add the forms permission. Adding permissions one at a time reveals exactly what the content requires, and keeps the embed as restricted as possible.

Key Features of the HTML IFrame Generator

The generator covers sizing, accessibility, performance, privacy, and security in one workflow.

  • URL input. The address to embed, with validation that prompts for a URL when the field is empty.
  • Flexible width. Pixel numbers or percentages, with an automatic fallback to full width for invalid input.
  • Clamped height. Heights from 50 to 2000 pixels, with out-of-range values clamped to the nearest limit.
  • Title field. An accessibility description included as the title attribute when supplied.
  • Loading control. Lazy, eager, or browser default, controlling when the embedded page is fetched.
  • Referrer policy control. Six policies plus the browser default, controlling referrer information sent to the embedded site.
  • Fullscreen control. A checkbox adding the fullscreen attribute when the embedded content may need it.
  • Sandbox with five permissions. A sandbox toggle plus selective permissions for scripts, same-origin access, forms, popups, and downloads.
  • Live preview. The embedded page renders at the chosen size with the chosen settings applied.
  • One-click copying. The Copy HTML button copies the complete iframe element.
  • Private processing. The code generation runs in your browser. The preview fetches the embedded page directly, as any browser would.

The sandbox permission checkboxes deserve careful attention. The same-origin permission is the most powerful: combined with the scripts permission, it can allow the embedded page to remove its own sandboxing. Grant it only to content you fully trust, and never combine it with scripts for untrusted content. The tool defaults all permissions off, which is the safest starting point.

Practical Use Cases

Iframes embed many kinds of content, each with its own settings needs.

Embedding videos

Video players are the most common embed. They typically need fullscreen permission and script permission to run their player controls. Lazy loading suits videos below the fold, since the player code need not load until the reader scrolls near it. A descriptive title naming the video helps readers using assistive technology understand what the frame contains.

Embedding maps

Interactive maps embed well in iframes, letting readers pan and zoom without leaving the page. Maps need scripts to function, and they benefit from a generous height so the area is usable. Lazy loading keeps the map code from slowing the initial page load when the map sits far down the page.

Embedding documents and previews

Document viewers, slide decks, and file previews embed as frames showing the document inside the page. These embeds often work with minimal sandbox permissions, since the viewer handles interaction internally. A title describing the document helps readers decide whether to engage with the frame.

Embedding forms and booking tools

Third-party forms, booking widgets, and calculators frequently arrive as embed codes built on iframes. Forms need the forms permission when sandboxed, and usually need scripts as well. Test the full interaction in the preview, including submission, before publishing, since a missing permission can silently break the form.

Embedding dashboards and reports

Dashboards and reports from analytics and business tools embed as frames that update with the source data. These embeds need scripts and sometimes same-origin access, depending on how the tool is built. Because dashboards often contain sensitive data, review the referrer policy and sandbox settings with the data’s sensitivity in mind.

Previewing a page inside a page

Designers and reviewers sometimes embed a page preview inside a review or presentation page. A sandboxed frame with no permissions shows the page’s static appearance without letting it run scripts or navigate the parent. This is a safe way to show a page’s look without its behavior.

Tips and Best Practices

Responsible embedding balances functionality, performance, accessibility, and security.

  • Always write a specific title. The title is the frame’s accessible name. A generic title helps no one. Describe the embedded content in a few words.
  • Use lazy loading for below-fold embeds. Deferring the fetch until the frame nears the viewport speeds up the initial load and saves data for readers who never scroll to the embed.
  • Start sandboxed with no permissions. Add only the permissions the content demonstrably needs. The minimum working set is the safest set.
  • Be careful combining scripts and same-origin. Together, these permissions can let embedded content escape the sandbox. Grant the combination only to content you fully trust.
  • Size the frame to the content. A frame much larger than its content wastes space, and a frame much smaller forces scrolling inside the frame. Use the preview to find the right height.
  • Choose a referrer policy deliberately. The default sends full referrer information in many cases. A stricter policy protects reader privacy and reveals less about your page structure to the embedded site.
  • Test the full interaction. Do not test only the appearance. Click, submit, play, and navigate within the preview to confirm every needed capability works with the chosen permissions.
  • Provide a fallback link. Readers whose browsers or settings block the embed still need access to the content. A plain link to the embedded page, placed near the frame, guarantees access.

When an embed misbehaves, the sandbox permissions are the first place to look. A form that will not submit usually lacks the forms permission. A player that will not start usually lacks the scripts permission. A download that will not begin usually lacks the downloads permission. Add the missing permission, test again, and keep the rest off.

Limitations

Not every site allows embedding. Sites can block framing with response headers or a frame-ancestors policy, and when they do, the preview stays blank and the embedded page will not display on your site either. The tool’s own guidance states this plainly: if the preview stays blank, the site does not allow embedding. There is no setting in the generator that overrides a site’s decision to block framing, and attempting to circumvent it would violate the site’s intent.

The generator produces a single iframe element with a fixed set of attributes. It does not generate responsive wrapper markup, aspect ratio containers, fallback content, or scripts that resize the frame to its content. The preview shows the embedded page as the browser fetches it directly, which means preview behavior can differ from behavior on your published page, where headers and policies may interact differently. The tool does not save your settings; copy the code before leaving the page.

Frequently Asked Questions

Why is my preview blank?

The embedded site likely blocks framing with response headers or a frame-ancestors policy. If the preview stays blank, the site does not allow embedding, and no generator setting can override that decision. Use a plain link to the page instead.

Should I use lazy or eager loading?

Use lazy loading for embeds below the fold, so the embedded page loads only when the reader scrolls near it. Use eager loading when the embed is the main content and must appear immediately. The browser default omits the attribute.

What does the sandbox attribute do?

It restricts what the embedded page can do, blocking scripts, forms, popups, and same-origin access unless the corresponding permission is granted. A bare sandbox attribute applies the maximum restriction.

Which sandbox permissions should I enable?

Enable only what the content needs. Start with none, test, and add permissions one at a time until the content works. Avoid combining scripts with same-origin for untrusted content.

Why is the title important?

The title is the accessible name of the frame, read by assistive technology to identify the embedded content. A specific, descriptive title helps readers understand what the frame contains before engaging with it.

Is my embed data uploaded anywhere?

The code generation runs in your browser. The preview fetches the embedded page directly from its own address, as any browser visiting that address would.

Related Tools

Browse More Tools