A YouTube embed generator creates the HTML embed code to display YouTube videos on your website — with options for custom start time, autoplay, loop, muted start, and privacy-enhanced mode (no cookies).
Generate YouTube Embed Code
Paste a YouTube URL, customize options, and copy responsive embed code.
YouTube Embed Basics
Standard Embed Code
<iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>| Parameter | What It Does | Example |
|---|---|---|
| autoplay=1 | Auto-start video | ?autoplay=1&mute=1 |
| start=90 | Start at 1:30 | ?start=90 |
| loop=1 | Loop video | ?loop=1&playlist=VIDEO_ID |
| controls=0 | Hide player controls | ?controls=0 |
| rel=0 | No related videos at end | ?rel=0 |
Modern browsers block autoplay with sound. Use autoplay=1&mute=1 for auto-starting videos.
Making Embeds Responsive
.video-container {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
overflow: hidden;
}
.video-container iframe {
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
}Or use modern CSS: aspect-ratio: 16/9; width: 100%;
padding-bottom: 56.25% creates a 16:9 aspect ratio container. The iframe fills it responsively on any screen size.
Privacy-Enhanced Mode (No Cookies)
Replace youtube.com with youtube-nocookie.com in the embed URL:
src="https://www.youtube-nocookie.com/embed/VIDEO_ID"This prevents YouTube from setting cookies until the viewer clicks play. Required for GDPR compliance in the EU and recommended for privacy-conscious Indian websites.
Embed Performance Tips
- Lazy load — Add loading="lazy" to the iframe. Video loads only when scrolled into view.
- Lite YouTube Embed — Use the lite-youtube-embed web component for 10x faster initial page load (loads a thumbnail, YouTube player only on click).
- Limit embeds per page — Each YouTube embed adds ~500KB. More than 3-4 on one page significantly slows load time.
How to Use the Tool (Step by Step)
- 1
Enter YouTube URL
Paste any YouTube video URL.
- 2
Customize Options
Set start time, autoplay, loop, controls, privacy mode.
- 3
Choose Size
Select responsive, fixed size, or custom dimensions.
- 4
Copy Embed Code
Copy the generated HTML to paste into your website.
Frequently Asked Questions
How do I embed a YouTube video on my website?+−
Copy the embed code from this tool and paste it into your HTML. The code is an iframe that loads the YouTube player.
How do I start a video at a specific time?+−
Use the start parameter: add ?start=90 for 1 minute 30 seconds. The tool lets you set this visually.
Can I autoplay embedded videos?+−
Yes, but modern browsers require the video to be muted: autoplay=1&mute=1. Videos with sound cannot autoplay without user interaction.
What is privacy-enhanced mode?+−
Using youtube-nocookie.com instead of youtube.com prevents YouTube from setting cookies until the viewer clicks play. Recommended for GDPR/privacy compliance.
How do I make the embed responsive?+−
Wrap the iframe in a container with padding-bottom: 56.25% (16:9 ratio). Or use CSS aspect-ratio: 16/9 on the iframe directly.
Is this generator free and private?+−
Yes. Code generation happens in your browser. No data sent anywhere.
Generate YouTube Embed Code
Paste a YouTube URL, customize options, and copy responsive embed code.
Open YouTube Embed Generator ->Related Guides
YouTube Title Generator Guide
Generate YouTube titles that rank and get clicks — power words, numbers, keywords, proven formulas.
YouTube Description Generator Guide
Generate descriptions with keywords, timestamps, links, hashtags, CTAs for better rankings.
Aspect Ratio Calculator Guide
Learn how to calculate, maintain, and convert aspect ratios for images, videos, and screens without distortion.