YouTube Embed Code Generator
Create responsive YouTube iframe embed code with autoplay, mute, loop, start time and privacy-enhanced mode. Live preview and one-click copy. Free.
About the YouTube Embed Code Generator
Paste any YouTube URL — a normal watch link, youtu.be short link, Shorts or live URL — and this tool generates clean iframe embed code with the options YouTube's own share dialog hides. The responsive wrapper keeps the player at a perfect 16:9 on every screen size, which is what most website builders and CMSs need.
Toggle autoplay (with the required mute), loop, hidden controls and a custom start time in seconds. The privacy-enhanced mode switches the embed to youtube-nocookie.com so YouTube sets no tracking cookies until the visitor actually plays the video — a sensible default for GDPR-conscious sites and a common requirement for EU clients.
A live preview renders the exact embed before you copy it, and everything is generated locally in your browser.
How to Use the YouTube Embed Code Generator
- 1Paste the YouTube URL or the 11-character video ID.
- 2Choose options: responsive wrapper, privacy mode, autoplay, mute, loop, controls, start time.
- 3Check the live preview.
- 4Copy the embed code and paste it into your website's HTML.
Frequently Asked Questions
How do I make a YouTube embed responsive?
Wrap the iframe in a container with padding-bottom: 56.25% (the 16:9 ratio) and position the iframe absolutely to fill it — exactly the code this generator outputs when Responsive is ticked. The video then scales fluidly to any screen width.
Why doesn't autoplay work in my embed?
All modern browsers block autoplay with sound. Autoplay only works when the video is muted, which is why this tool adds mute=1 automatically whenever you enable autoplay.
What is privacy-enhanced (nocookie) mode?
It serves the player from youtube-nocookie.com, which delays YouTube's tracking cookies until the visitor plays the video. Functionality is identical; it simply reduces tracking for visitors who never press play.
How do I loop a YouTube embed?
YouTube requires loop=1 together with playlist=VIDEO_ID for single videos — an odd but documented quirk. Tick Loop here and both parameters are added correctly.
Can I start the video at a specific time?
Yes — enter the start time in seconds (e.g. 90 for 1:30) and the tool adds start=90 to the embed URL. For share links with timestamps, see our YouTube Timestamp Link tool.