HomeHow-ToHow To Easily Embed A YouTube Video In Your Website

How To Easily Embed A YouTube Video In Your Website

Disclosure

YouTube is one of the most popular video platforms on the web with over a billion views every day. But, you will also find YouTube videos on many other websites, using the embed feature. And, if you are looking to embed a YouTube video in your site, then there are a number of parameters that allow you to embed the video the way you choose. The parameters allow you to autoplay, show/hide controls, disable full screen, and so on.

Get the embed code from YouTube

  1. Browse to the YouTube video that you want to embed or share.
  2. Click the Share button below the video. A popup will open with share options and the share link shown
  3. Click on the embed button to get the HTML code to embed a Youtube Video as shown in the image below. Copy the video embed code.
embedlink only

The Embed Parameters

There are many YouTube parameters that you can use, offering a user control over many aspects of a video. Some of the more popular ones are:

  • autoplay
    • autoplay=0 (default); YouTube embed Autoplay is disabled
    • autoplay=1; autoplay enabled, the video starts to play automatically on page load
  • controls
    • controls=0 ; player controls not displayed
    • controls=1 (default); player controls displayed
  • fs
    • fs=0 ; full screen button disabled
    • fs=1 (default) ; full screen button enabled
  • rel
    • This particular parameter has undergone a change effective Sept 25th, 2018. In the past, you could use this parameter to disable the display of suggested or related videos at the end of a video. From Sept 25th, you will not be able to disable suggested or related videos, since it is considered an intrinsic part of the YouTube platform. Please note, the parameter is still valid and you can use it to set the suggested or related videos to show only videos from the same channel.
    • rel=1 (default); shows suggested or related videos from all YouTube channels
    • rel=0; suggested or related videos from the same channel
  • Enhanced Privacy Mode
    • Enhanced privacy mode allows you to embed a youtube video without using cookies to track user behavior. Any recommended videos will be purely based on the context of the current video playing.
    • To use this feature, replace ” https://www.youtube.com” with “https://www.youtube-nocookie.com” in the embed code.
  • Set Start and End Time of an Embedded YouTube Video

Related Article: The Right Way to Add Video in WordPress

An Example

You can see an embedded video from YouTube below, using the above parameters. The YouTube video is set to play with autoplay OFF, controls OFF, full-screen mode disabled, and enhanced privacy mode switched on. The code to embed a Youtube Video looks like this, with the parameters highlighted:

embed a youtube video
YouTube Embed Code with Parameters Highlighted

If you using a platform like WordPress or similar for your website, then it is quite likely that you probably have a YouTube Block in the platform’s frontend editor, that provides the HTML wrapper to insert the YouTube Video into your website. In this case, you won’t need full HTML code to embed the video. You will need the Youtube Video URL with the Video ID appended at the end, which looks like this:

“https://www.youtube.com/embed/MqNd1xD46VY”

The video ID is the alphanumeric text MqNd1xD46VY. The video ID is the unique identifier for a YouTube Video.

You can enter the URL as shown above along with the required parameters appended at the end as explained above. For example:

To embed a YouTube video in your website with Auto play on, use the following URL:

“https://www.youtube.com/embed/MqNd1xD46VY?autoplay=1”

To embed a video in your website with controls on, and full screen off, use the following URL:

“https://www.youtube.com/embed/MqNd1xD46VY?controls=1&fs=0”

The video ID in the above examples should be replaced with the Video ID of the YouTube video that you want to embed in the web page.

You may also like:

SEO Friendly Website: 11 Useful Tips You Should Know

How to Enable Object Caching in WordPress

SEO For Dummies: Everything You Need To Get Started

 

Disclosure: Coolfundas is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Read more about the disclosure.

↑ Back to Top

Shashi Venkatesh
Shashi Venkatesh
Shashi Venkatesh is a 22-year veteran of the technology industry, with experience developing and managing large-scale web applications for clients. He is a WordPress expert and has consulted extensively in the development of WordPress websites, blogs and ecommerce platforms.

LEAVE A REPLY

Please enter your comment!
Please enter your name here