Add or Embed YouTube Videos to HTML Website

Updated: June 7th, 2022, 11:09:28 IST
Published: June 7th, 2022
Add or Embed YouTube Videos to HTML Website
Title: Add or Embed YouTube Videos to HTML Website

In this tutorial, I will teach you the easiest way to add and play YouTube video in HTML or on any website you host. With help of iframe tag we embed YouTube video to our webpage and no need to upload additional file. It's free to use anywhere on your website.

Embed YouTube videos using iframe

HTML Code:

<!DOCTYPE html>
<html>
<body>

<iframe width="420" height="345" src="https://www.youtube.com/embed/s8DgOeKSPuk">
</iframe>

</body>
</html>

 

 

Embed a video or playlist

  1. On a computer, go to the YouTube video or playlist you want to embed.
  2. Click SHARE Share.
  3. From the list of Share options, click Embed.
  4. From the box that appears, copy the HTML code.
  5. Paste the code into your website HTML.

For network administrators: You will need to add youtube.com to the firewall allowlist.

Important: If your website or app is aimed at children and includes YouTube material, you must use these tools to self-designate your site or app. This self-designation will prevent Google from serving targeted advertisements on certain sites or applications, and some functionality in the embedded player will be disabled.

How To Add a YouTube Video to Your Website - Steps

All you have to do is to copy and paste the URL of a video from YouTube into your HTML page.

Use the YouTube website to find the video you want to embedded.

Click the "Share" button under your YouTube video to expose the available sharing options.

When you click "Share" there is another button "Embed" you will get shown under the share button.

Click the "Embed" button and you will see a box just below it fill with code.

By clicking your mouse within the textbox filled with code, all the text in that field is highlighted. Right click in the text-filed and copy the code.

The next step is to paste the complete iframe code in your HTML page.

Embed YouTube videos using HTML object tag

HTML Code:


<!DOCTYPE html>
<html>
<body>
<object data="https://www.youtube.com/embed/s8DgOeKSPuk"
width="560" height="315"></object>
</body>
</html>

YouTube Video with autoplay


<iframe width="560" height="315"
src="https://www.youtube.com/embed/s8DgOeKSPuk?autoplay=1">
</iframe>

Add or Embed a YouTube video to powerpoint

1. Open PowerPoint and select the slide in which you want to insert a video.

2. Next step is to switch over to the Insert tab.

3. Then click on Video, and then Online Video.

4. Click inside the search field to the right of the YouTube option, then enter a search term for your video and press Enter on your keyboard.

5. Select the video that you want to insert into your presentation, then click the Insert button at the bottom of the window.

Select and drag the video to your desired location on the slide. Note that you can resize it by clicking one of the boxes on the perimeter of the video and dragging it accordingly.