Responsive YouTube Embed Code Generator
Make a YouTube embed code with start time, loop and autoplay options.
YouTube Video URL, Short, or Video ID
Privacy & Playback
Live preview and code
<!-- Responsive YouTube Video Wrapper (Universal CSS) -->
<style>
.yt-embed-container {
position: relative;
width: 100%;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
border-radius: 12px; overflow: hidden; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.yt-embed-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
</style>
<div class="yt-embed-container">
<iframe width="100%" height="100%" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?rel=0&modestbranding=1" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen loading="lazy"></iframe>
</div>How to use it
- Paste a video link
A YouTube URL, a Shorts link or the 11-character video ID all work.
- Pick the player options
Privacy mode, autoplay, loop, controls, start time and aspect ratio.
- Copy the code
Choose responsive CSS, Tailwind, React, a plain iframe or the URL, then copy it.
Create clean, fluid, and privacy-first iframe embeds in seconds. Fine-tune start timestamps, loop repeats, autoplay policies, and copy production-ready HTML, responsive CSS wrappers, or React components.
Frequently Asked Questions
What is privacy-enhanced mode (youtube-nocookie.com)?
YouTube privacy-enhanced mode replaces the standard youtube.com domain with youtube-nocookie.com. This prevents YouTube from storing tracking cookies on your visitors' browsers unless they actually click to play the video. It is essential for compliance with European GDPR, ePrivacy directives, and California CCPA privacy standards.
Why does my embed autoplay without sound?
Modern web browsers (including Google Chrome, Safari, Firefox, and Edge) enforce strict autoplay policies that block autoplaying video unless the audio is muted. When you toggle "Autoplay" in this tool, the mute flag (mute=1) is automatically applied to ensure guaranteed autoplay without browser blocks.
How do I make a YouTube embed truly responsive on mobile devices?
By default, YouTube provides fixed 560x315 pixel iframes that break mobile layouts. Our generator provides both universal CSS aspect-ratio wrappers and Tailwind CSS classes (aspect-video) that automatically scale the video to 100% of any smartphone, tablet, or desktop container.
Can I loop a single YouTube video continuously?
Yes! YouTube requires both loop=1 and the playlist parameter set to the identical Video ID for a single video to repeat endlessly. Our generator automatically writes the correct dual parameter syntax into the iframe code.
Can I remove recommended videos from other channels at the end?
Setting rel=0 in modern YouTube iframe embeds restricts recommendations exclusively to other videos from your own channel, preventing competitor videos from appearing when your video concludes.
More free tools
Encode text to Base64 or decode it back. Works with emoji and any language.
Runs in your browserDownload the thumbnail of any YouTube video in the largest size available.
Runs in your browserGenerate HTML meta tags with live Google SERP snippet and social media share card previews.
Runs in your browserCrop images with preset aspect ratios (16:9, 1:1, 4:3, 9:16) or freeform selection boxes.
Runs in your browser