It builds the same <iframe> YouTube's share dialog gives you, with the player parameters YouTube documents — start, autoplay, mute, loop, controls, rel — set from your choices, and optionally wrapped for responsive sizing. The preview is the real embed, so what you see is what your visitors get. Everything runs in your browser; the video link never leaves it.
YouTube Embed Code Generator
Paste a video link, pick the options you want — responsive, privacy-enhanced, autoplay, start time — and copy an embed snippet that works anywhere HTML does.
Embed code
Paste a video link to generate the code.
How this works
Frequently asked questions
What does 'responsive' change?
YouTube's own share dialog gives you a fixed 560 × 315 iframe, which overflows on phones and looks tiny on large screens. The responsive option wraps the iframe in a container that keeps a 16:9 shape and fills whatever width the page gives it — the version you want for almost any website. Turn it off only if you need an exact pixel size.
What is privacy-enhanced mode?
It swaps youtube.com for youtube-nocookie.com in the embed URL. YouTube then sets no cookies on your visitor until they actually press play, instead of on page load. It's the setting most GDPR and cookie-consent guides recommend, and it changes nothing about how the video looks or plays.
Why does autoplay force the video to be muted?
Every major browser blocks video that autoplays with sound, so an autoplay embed with sound on simply doesn't start. YouTube's own documentation says to pair autoplay with mute; this tool does that automatically so the code you copy actually works.
Does embedding a video count views or earn the creator anything?
Yes — views from embeds count toward the video's total, and ads still run on it, so embedding is fully supported and welcomed by YouTube. Some creators disable embedding on a specific video; in that case the player shows a "watch on YouTube" message instead, and the only fix is to link to the video directly.