YouTube Embed Code Generator
The iframe, with the options that actually matter: start, end, privacy mode, and responsive by default.
Embedding on your own site?
Views from an embed count, and a video that already performs is the only one worth pushing. Both pages say what the product does and what it does not.
Responsive is on by default, and here is why
The code YouTube gives you has width="560" height="315" baked in. On a phone that iframe hangs off the side of the page, and it is one of the most common ways a perfectly good site fails on mobile.
The default here wraps the iframe in a box with a 16:9 ratio, so it fills whatever width you give it and keeps the right shape at any size. If you genuinely need fixed pixels, turn it off.
Privacy mode is not a nicety
With privacy mode on, the embed points at youtube-nocookie.com, which limits how an embedded view is used for personalization and holds back tracking cookies until somebody actually plays the video. If your site has visitors in the EU or UK, it reduces what you have to account for. It does not decide the question for you.
⚠️ It is not full anonymity, and nobody should sell it as such: YouTube still receives the request and the IP address when the player loads. It does not make the player anonymous and it does not automatically make your page compliant with EU or UK consent rules — that is your call and your lawyer's, not a checkbox on this page.
The options, and what they cost you
- Start and end put the player on the part you care about. End times only work in an embed, which is the one thing an embed can do that a link cannot.
- Autoplay is forced to muted, because every browser blocks unmuted autoplay and an embed that does not play is worse than one that waits. Even muted, it is worth asking whether the visitor wanted it.
- Loop needs the video listed as its own playlist, which is a YouTube quirk rather than a mistake. The code above already does that.
- Hide controls looks clean and takes away the scrub bar. On anything longer than a few seconds, people resent it.
⭐ The preview only loads when you press the button
Every other generator drops a live player into the page as soon as you paste a link, which quietly sends your visit to YouTube before you have decided anything. This page loads nothing external until you ask for it.
That is also the only external request this entire site makes, on any page, and it seemed wrong to break that rule without telling you.
Before you embed it
Questions
How do I make a YouTube embed responsive?
Wrap the iframe in a container with a 16:9 padding ratio and give the iframe 100% width and height. That is what the default code above does, and it replaces the fixed 560x315 that breaks on phones.
What is youtube-nocookie.com?
YouTube’s privacy-enhanced embed domain. It limits personalization from embedded views and avoids writing tracking cookies until the visitor actually starts the video. It is not a substitute for your own consent and privacy compliance, and it does not hide the request itself.
Can I make an embed start and stop at set times?
Yes, both. The end parameter only works inside an embed, which is the main thing an embed can do that an ordinary link cannot.
Why does autoplay not work?
Because browsers block autoplay with sound. The code above adds mute alongside autoplay, which is the only combination that plays reliably.
How do I loop a YouTube embed?
Loop needs the video to also be listed as a one-video playlist. It looks odd but it is how YouTube built it, and the generated code handles it.
Do embedded views count?
Yes, views from embeds count towards the video, as long as the player is visible and actually played. Autoplaying a hidden player does not, and trying is a good way to have views removed.