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 does not write tracking cookies until somebody actually plays the video. If your site has visitors in the EU or UK, that is the difference between an embed you can serve before consent and one you cannot.

⚠️ 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 reduces what is stored, it does not make the embed invisible.

The options, and what they cost you

⭐ 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 avoids writing tracking cookies until the visitor actually starts the video, which matters for consent rules in the EU and UK. 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.