A YouTube embed code generator creates customized iframe codes to embed videos on any website. You can control dimensions, autoplay behavior, start and end times, privacy settings, and whether related videos show — all without manually editing URL parameters. The generated code works on any website or CMS.
Accepts watch?v=, youtu.be/, /embed/, /shorts/ formats
Live Preview
Embed Code (iframe)
Responsive Wrapper
How to Use the YouTube Embed Code Generator
Embedding YouTube videos on your website allows you to showcase content without hosting video files yourself. A basic YouTube embed is a one-line iframe, but customizing autoplay, loop, privacy mode, and start times requires knowing the exact URL parameters. This YouTube embed code generator handles all of that visually.
Step 1: Paste Your Video URL
Copy any YouTube video URL and paste it in the URL field. The generator accepts all standard formats: the full watch?v= URL, shortened youtu.be/ links, existing embed URLs, and YouTube Shorts URLs. The video ID is extracted automatically.
Step 2: Configure Your Options
Set the dimensions (default 560×315, the standard YouTube size), enable or disable autoplay, loop, controls, and related videos. If you need the video to start at a specific point, enter the timestamp in seconds. Enable Privacy Enhanced Mode to use youtube-nocookie.com for GDPR-compliant embedding.
Step 3: Preview and Copy
Click Generate to see a live preview of your embedded video and generate the code. Copy either the basic iframe code or the responsive wrapper version. The responsive wrapper maintains the 16:9 aspect ratio at any screen width — essential for mobile-friendly websites. Paste the code into your HTML editor, CMS, or website builder.
Privacy Enhanced Mode Explained
Standard YouTube embeds load tracking cookies even when visitors haven't clicked play. Privacy Enhanced Mode switches the domain to youtube-nocookie.com, which prevents YouTube from collecting visitor data unless they interact with the video. For EU websites and GDPR compliance, this is the recommended approach and is enabled by default in this generator.
FAQ
Is this YouTube embed code generator free?
Yes, the YouTube Embed Code Generator is completely free. Generate unlimited embed codes with any combination of settings. No account, no signup required — everything runs in your browser.
Is my data safe and private?
Yes, all processing happens in your browser. Your video URL and settings are never sent to any server. The generated embed code uses standard YouTube iframe parameters.
What is YouTube Privacy Enhanced Mode?
Privacy Enhanced Mode uses youtube-nocookie.com instead of youtube.com in the embed URL. This prevents YouTube from storing information about the viewer unless they click play. It is recommended for websites where GDPR or privacy compliance is important. The embedded video works identically but without tracking inactive visitors.
How do I embed a YouTube video that starts at a specific time?
Enter the start time in seconds in the Start Time field. For example, to start at 1 minute 30 seconds, enter 90. The generator adds ?start=90 to the embed URL automatically. You can combine this with an end time to show only a specific segment of the video.
How do I make a YouTube embed responsive?
The tool generates a responsive CSS wrapper using the padding-top trick for a 16:9 aspect ratio. Wrap the iframe in a div with position:relative and padding-top:56.25%, then set the iframe to position:absolute with full width and height. This maintains the aspect ratio at any screen size. The generated code includes this wrapper automatically.
Can embedded YouTube videos autoplay?
Yes, but autoplay only works reliably when the video is also muted (due to browser autoplay policies that block unmuted media). The generator automatically adds mute=1 when autoplay is enabled. This is the standard approach for autoplay embed videos in modern browsers.