Add YouTube videos and playlists to a website or blog by embedding it.
Here’s how to embed a video:
- Click the Share link under the video.
- Click the Embed link.
- Copy the code provided in the expanded box.
- Paste the code into your blog or website.
Here’s how to embed a playlist:
- Click Playlists on the left side of your YouTube page
- Click the playlist title you'd like to embed.
- Click the Share link.
- Click the Embed link.
- Copy the embed code that appears in the menu below.
- Paste the code into your website or blog.
Embedding optionsUse HTTPS
HTTPS (Hypertext Transfer Protocol Secure) adds a layer of protection around information travelling between your computer and a web server.
Websites that use HTTPS might generate a "mixed content" warning if a video isn’t embedded with HTTPS since not all parts on the webpage are secure, which is why you might select the "Use HTTPS" option under the embed code.
Enabling this option means that YouTube won’t store information about visitors on your web page unless they play the video.
There are two styles of embed codes that are available for YouTube videos.
- New embed code: This code begins with "<iframe..." and supports both Flash and HTML5 video
- Old embed code: This code begins with "<object..." and only supports Flash.
Some sites only support the old embed code, so if a site rejects the new embed code, check the Use old embed code option under the embed code, which will generate a code that begins with "<object..."
To make an embedded video autoplay, add "&autoplay=1" to the video’s embed code, right after the video ID (the series of letters that follows "v/").
Here’s an example:
<object height="350" width="425"><param name="movie" value="http://www.youtube.com/v/OdT9z-JjtJk&autoplay=1" /><embed height="350" src="http://www.youtube.com/v/OdT9z-JjtJk&autoplay=1" type="application/x-shockwave-flash" width="425"></embed></object>
Add "#t=" to a video’s embed code, followed by the time at which you’d like the video to begin playing.
For example, if you want a video to start at 2 minutes and 30 seconds into the video, your embed code would look something like the following:
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/UkWd0azv3fQ#t=2m30s" width="420"></iframe>
You can also choose a caption language for the embedded video. To specify the caption language for the video that you'd like to embed, just add "&cc_lang_pref=fr&cc_load_policy=1" to the video's embed code.
- "cc_lang_pref" sets the language for the captions shown in the video.
- "cc_load_policy=1" turns captions on by default.
- "fr" represents the language code for French. You can look up 2-letter language codes in the ISO 639-1 standard.
- Visit your Video Manager.
- Find the video you'd like to change and click Edit.
- Click Advanced Settings under the video.
- Untick the Allow Embedding tickbox under the "Distribution Options" section.
- Click Save changes at the bottom of the page.