YouTube Embed Code Generator
Embed videos on any website in seconds
What does embedding a YouTube video do?
Embedding lets a YouTube video play directly on any website — a blog post, a course page, a portfolio — without visitors leaving the page. The video still lives on YouTube: views count for the creator, and the familiar player controls work exactly as expected. For creators, embeds are free distribution; for site owners, they're rich content without hosting costs.
Why fixed widths break on mobile
The default embed code YouTube gives you is 560 pixels wide. On a phone screen that's wider than the viewport, so the video overflows or gets awkwardly squished. The fix is a responsive wrapper: a container with aspect-ratio: 16 / 9 and the iframe set to fill it completely. The video then scales to any screen while keeping its shape — no black bars, no overflow.
Privacy-enhanced mode and GDPR
Standard embeds load cookies from youtube.com the moment the page loads, which can be a problem under GDPR and similar privacy laws. Privacy-enhanced mode serves the player from youtube-nocookie.com instead, which doesn't store tracking cookies until the visitor actually plays the video. If your audience is in the EU, turn it on — it costs you nothing and keeps you compliant. (This isn't legal advice; check your local requirements.)
When videos refuse to embed
Creators can disable embedding in YouTube Studio, and some music videos are restricted by rights holders. If a video won't embed, that's the owner's choice — respect it and link to the video instead. Never try to circumvent embedding restrictions.
Start times for tutorials
If you're embedding a long tutorial but only need one section, set a start time so the video opens at the relevant moment. It's a small courtesy that dramatically improves the experience for your readers. For building full chapter lists instead, use our Timestamp Link Generator.
Frequently asked questions
+Why won't a YouTube video embed on my site?
The most common reason is that the creator disabled embedding in YouTube Studio, or the video has copyright restrictions (common with music content). Some videos are also region-restricted. If embedding is blocked, link to the video instead — don't try to work around the restriction.
+How do I make a YouTube embed responsive?
Wrap the iframe in a container with aspect-ratio: 16 / 9 and set the iframe to width: 100% and height: 100%. This makes the video scale to any screen size while keeping its 16:9 shape, instead of overflowing on mobile.
+Why doesn't autoplay work with sound?
All major browsers block autoplay with sound to protect users from unexpected audio. A video will only autoplay if it starts muted (mute=1) or if the visitor has previously interacted with your site. This is a browser policy, not something embed code can override.
+What's the difference between youtube.com and youtube-nocookie.com embeds?
The standard youtube.com embed sets tracking cookies as soon as the page loads. The youtube-nocookie.com (privacy-enhanced) version doesn't store cookies until the visitor presses play. Functionally the player is identical; the nocookie version is the safer choice for privacy regulations like GDPR.
+Does embedding someone's video hurt the creator?
No — it helps them. Embedded views count toward the video's total view count, and the creator still earns ad revenue from ads shown in the embedded player. Embedding is free distribution for creators, which is why most leave it enabled.
Written by
Hussnain
Founder of UtubeHelpers · Pakistan
Hussnain founded UtubeHelpers in 2026 to give creators free, no-signup tools and practical, hype-free growth guides — honest numbers, no guru hype.
More about Hussnain →