YouTube Embed Code Generator
Generate custom YouTube iframe embed code with autoplay, start time, mute, size, and privacy-enhanced options.
How to use the Embed Code Generator
- 1Paste the video URL
Enter the YouTube video you want to embed.
- 2Configure the player
Choose size (or responsive), toggle autoplay, mute, start time, controls, and privacy-enhanced mode. The live preview updates instantly.
- 3Copy the code
Click Copy Code and paste the iframe HTML into your website, blog post, or CMS.
About this tool
YouTube's default Share → Embed option gives you a basic iframe with no customization. This generator builds the exact embed code you need: custom dimensions or responsive sizing, autoplay, muted start, a specific start time, hidden controls, and YouTube's privacy-enhanced no-cookie mode - all with a live preview so you see exactly what visitors will get.
The privacy-enhanced mode (youtube-nocookie.com) is particularly important for GDPR compliance: it prevents YouTube from setting tracking cookies unless the visitor actually plays the video. Many European sites are required to use it, and it's a one-click toggle here.
The responsive option wraps the iframe in a modern aspect-ratio container so the video scales perfectly on mobile - the single most common embed mistake on websites is a fixed-width iframe that overflows small screens.
Features
- ✓Live preview of the exact embed configuration
- ✓Responsive (mobile-friendly) or fixed-size output
- ✓Autoplay + mute combo (required by browsers for autoplay to work)
- ✓Custom start time in seconds or h/m/s
- ✓Privacy-enhanced youtube-nocookie.com mode for GDPR
- ✓Clean, copy-ready iframe HTML
Frequently asked questions
Why doesn't autoplay work in my embed?
All modern browsers block autoplay with sound. For autoplay to work, the video must also be muted - this generator automatically enables mute when you turn on autoplay, which is the browser-compliant combination.
What is privacy-enhanced (nocookie) mode?
Embedding from youtube-nocookie.com instead of youtube.com prevents YouTube from storing tracking cookies on your visitors' browsers unless they play the video. It's the GDPR-friendly option required by many European privacy policies, with zero difference in playback functionality.
How do I make the embed responsive on mobile?
Select the Responsive option - it wraps the iframe in a container using the modern CSS aspect-ratio property, so the video scales fluidly to any screen width while keeping its 16:9 shape.
Does embedding a video affect the creator's views?
Yes, positively - embedded views count toward the video's total view count (as long as the viewer actually plays it), and the creator earns ad revenue from embedded playback the same as on YouTube.
Can I embed a video that has embedding disabled?
No - if a creator disables embedding in their video settings, the iframe shows 'Video unavailable'. This is the creator's choice and no embed generator can bypass it.
Related free tools
Need more than a embed code generator?
UpTube's AI analyzes your whole channel, finds content gaps in your niche, and writes video scripts in your exact voice - free to try.
Analyze my channel free →