Video content is a great way of adding value to a web page, whether it’s the main focus or for further reference. It can be costly to host and serve your own video content.

Thankfully, YouTube offers a solution to this dilemma. Here's how to embed a YouTube video on your website.

What Does Embedding a Video Mean?

Embedding refers to the process of displaying a YouTube video on a page on your own website. The video will display in a familiar-looking player, but YouTube’s servers deliver it.

Note that this form of presenting video is perfectly legal, and encouraged by YouTube. You don’t need to check if the video is copyrighted first.

How to Get the Embed Code From YouTube

Once you find the video you want to use, follow these steps to embed it:

  1. Press the Share button that appears immediately below the YouTube video that you want to embed.
  2. Press the Embed icon in the popup that appears.
    A screenshot of the YouTube website showing the Share popup with the embed button highlighted
  3. You should now see a popup window titled Embed Video. The video appears on the left and the embed code on the right. The embed code begins with <iframe.
  4. Press the Copy button in the bottom right corner of the popup. You should see the text Link copied to clipboard appear in the bottom left of the main browser window.
    A screenshot of the YouTube website showing the Share popup with embed code displayed
  5. The next step depends on the specifics of how you update your website. If you use a Content Management System (CMS), you’ll need to use an option that lets you edit HTML or the source of the page. Paste in the embed code, save your changes, and check the page to view your embedded video.

YouTube also lets you configure its player even further. In step four, you’ll see options allowing you to set the start time or hide the player controls. You can even enable privacy-enhanced mode, which reduces tracking of your site’s readers.

Related: How to Watch YouTube in Picture-in-Picture Mode on Desktop and Mobile

What Might Go Wrong

Embedding a YouTube video isn't always as straightforward as it seems. Here are a few things that you should consider before embedding a video:

  • Some videos may appear to embed correctly but then refuse to play. This will require some troubleshooting.
  • The player will not display private videos, so avoid using those.
  • Videos with embedding disabled will not play at all. Instead, they will link to YouTube for full viewing.

YouTube Is an Excellent Place to Host Your Videos

Because of its easy embedding feature, YouTube is a great option for video hosting. But, alternatives to YouTube are available, including rival Vimeo. Either is a better choice than hosting your own videos, especially for smaller sites.