Free YouTube Embed Code Generator

Generate fully customized YouTube embed code. Control autoplay, loop, start time, end time, custom dimensions, privacy mode and more. Preview live then copy and paste.

📐 Aspect Ratio Presets

🎮 Playback Options

📋 Generated Embed Code
👁️ Live Preview
▶️

Paste a YouTube URL above to see a live preview

📖 How to Use the Embed Code Generator

1

Paste the YouTube URL

Copy any YouTube video URL and paste it into the input field. The embed code generates automatically as you type.

2

Customize the Settings

Choose an aspect ratio preset or enter custom dimensions. Toggle autoplay, loop, privacy mode, controls, and more to match your website's needs.

3

Preview and Copy

See a live preview of how the embedded video will look. Click Copy Code and paste the HTML into your website.

❓ Frequently Asked Questions

What is YouTube privacy-enhanced mode?+
Privacy-enhanced mode uses youtube-nocookie.com instead of youtube.com for the embed URL. This means YouTube does not set cookies or track your website visitors until they click to play the video. This is recommended for GDPR compliance in Europe.
Why doesn't autoplay work on my website?+
Most modern browsers (Chrome, Firefox, Safari) block autoplay of videos with sound. Autoplay typically only works if the video is also muted. Enable both the Autoplay and Mute options together for reliable autoplay behavior across all browsers.
How do I make the YouTube embed responsive?+
Click the 100% Responsive preset button. This generates a percentage-based width that scales with the container. For full CSS responsiveness, wrap the iframe in a div with position:relative; padding-bottom:56.25%; and set the iframe to position:absolute; width:100%; height:100%;.
How do I set a start time for the video?+
Enter the start time in seconds in the Start Time field. For example, to start the video at 1 minute 30 seconds, enter 90. The player will automatically begin playing from that point in the video.