How to embed a video using HTML code?

To embed a video in an HTML page, use the <iframe> element. The source attribute included the video URL. For the dimensions of the video player, set the width and height of the video appropriately.

The Video URL is the video embed link. The video we will be embedding our example will be YouTube.

To get the embed link, go to a YouTube Video and click embed as shown below. You will get a link for embed here −

You can try to run the following code to learn how to embed a video using HTML code. Copy the embed link as shown above and add it to the HTML document


Live Demo

<!DOCTYPE html>
      <title>HTML Video embed</title>
      <p>Learn Eclipse</p>
      <br />
      <iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>

Updated on: 02-Sep-2023

65K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started