---
title: "What is the use of HTML Iframe?"  
description: "HTML Iframe (inner frame) is used to embed another document within the current HTML document."  
author: "Ashutosh Patel"  
published: 2024-06-10  
updated: 2024-06-10  
canonical: https://www.mindstick.com/articles/336065/what-is-the-use-of-html-iframe  
category: "html"  
tags: ["html", "html5", "html tags", "html iframe"]  
reading_time: 2 minutes  

---

# What is the use of HTML Iframe?

### HTML Iframe

An HTML iframe (short for inline frame) is used to insert a new HTML document into the current HTML document. This allows you to [display content](https://www.mindstick.com/forum/118/problem-in-display-content-of-one-page-to-another-page) from another site or another part of the same site in [your site](https://yourviews.mindstick.com/view/84025/top-10-possible-reasons-why-your-site-traffic-dropped).

#### Here are some common HTML iframes

**External Inputs**\
You can embed content from other websites such as maps, videos, or [social media](https://www.mindstick.com/articles/1843/impact-of-social-media-in-seo) feeds into your site using iframes.

**Advertisements being shown** \
Ads from the ad network can be displayed in iframes on [web pages](https://answers.mindstick.com/qa/35620/how-would-you-change-the-format-of-all-the-phone-numbers-in-10-000-static-html-web-pages).

**Third Party [Integration](https://answers.mindstick.com/qa/35605/which-country-organized-operation-sadbhavana-for-national-integration)** \
Iframes can be used to [integrate third-party](https://answers.mindstick.com/qa/111792/how-do-i-integrate-third-party-apis-into-my-applications) [applications](https://yourviews.mindstick.com/view/85123/latest-applications-and-innovations-in-sports-analytics-wearables-and-broadcasting) or widgets into the web, such as calendars, chat widgets, or booking systems.

**Modular system design** \
Iframes allow you to divide your web page into modular components, each with distinct content or functionality.

**Proper input** \
Iframes provide some protection by sandboxing embedded content, isolating it from the rest of the web page and preventing malicious code from affecting the main page

However, it is important to use iframes judiciously, as overusing them can affect page performance and [user experience](https://yourviews.mindstick.com/view/87076/explore-your-career-in-user-experience-design), and inserting external content if not done properly a, it can pose a safety hazard

## Basic Syntax-

**![What is the use of HTML Iframe?](https://www.mindstick.com/mindstickarticle/835323e0-e3d1-44b0-bb3a-3fd7cf0d4627/images/7b1d5c39-f1d5-44ae-b823-69930a354cac.jpg)**

## Example-

Here is a basic example of how you can show a YouTube video on an HTML page

![What is the use of HTML Iframe?](https://www.mindstick.com/mindstickarticle/835323e0-e3d1-44b0-bb3a-3fd7cf0d4627/images/7f780727-2880-44c1-b8eb-5be36c36f014.png)

**In the above example-** \
The **“iframe”** element is used to embed a **YouTube** video. The src attribute specifies the **URL** of the video to be embedded (in this case "**https://www.youtube.com/embed/N8H1y7DkVPo**"). The `width`and `height`attributes determine the shape of the `iframe`, with `frameborder="0"` removing the border around the iframe. The `allowfullscreen`attribute enables [video playback](https://answers.mindstick.com/qa/108885/how-to-troubleshoot-a-tv-with-distorted-video-playback) in **full screen** mode.

## Output-

![What is the use of HTML Iframe?](https://www.mindstick.com/mindstickarticle/835323e0-e3d1-44b0-bb3a-3fd7cf0d4627/images/eb060253-664e-49a3-b178-bcddbf07eca6.png)

**Also, Read:** [Explain the HTML Events.](https://www.mindstick.com/articles/336061/explain-the-html-events)

---

Original Source: https://www.mindstick.com/articles/336065/what-is-the-use-of-html-iframe

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
