YouTube Tools

YouTube Embed Code Generator

Paste a video link, set the options, then copy an iframe ready to drop into your page.

EMBED CODE
 

What this is

A YouTube embed code generator assembles the iframe element that displays a video inside your own web page. You can write it by hand, but the available parameters are easy to get wrong: some only work when paired with another, and some are named in ways that do not describe what they do. This builds the code for you and flags the combinations that will not behave the way you expect.

How it works

Autoplay only works when the video is also muted. Modern browsers block autoplay with sound, so setting autoplay without mute produces a video that simply sits there — not a mistake in your code, but a browser rule. This tool switches mute on automatically when you choose autoplay.

Looping requires a playlist parameter containing the video's own ID. Without it the video stops at the end instead of repeating. The quirk comes from how the YouTube player handles playlists, and this tool adds it for you.

Privacy mode uses the youtube-nocookie.com domain, which defers tracking cookies until a viewer actually plays the video. It is useful for sites that have to account for the cookies set on page load.

How to use it

  1. Paste the video link A watch link, short link, Shorts URL or a bare video ID — all are recognised.
  2. Set your options Size, start time, autoplay, loop and privacy mode. The code updates as you change them.
  3. Copy and paste Paste the code into your page's HTML, where you want the video to appear.

Common questions

Why does autoplay not work on my page?
Because browsers block autoplay with sound, so it only works when the video is muted as well. Add the mute parameter alongside autoplay and the video starts automatically without audio — viewers can unmute it themselves.
How do I make an embedded video loop?
Looping needs two parameters together: loop set to 1, and playlist set to the video's own ID. Setting loop alone does nothing, because the player needs a playlist to know what to play next.
Does embedding a video slow my page down?
Yes — a YouTube embed loads a substantial player script even if nobody presses play. If your page carries several videos, consider showing a thumbnail image first and only loading the iframe when it is clicked.
What is the difference between youtube.com and youtube-nocookie.com?
The nocookie domain defers tracking cookies until a viewer actually plays the video, while the standard domain sets them as soon as the page loads. The video itself is identical; only the cookie timing differs.

Notes

  • The code is assembled in your browser. The link you paste goes nowhere.
  • EnSaveNet is not affiliated with YouTube.