YouTube Embed Code Generator

Paste a video URL, customise playback options, and get ready-to-use embed HTML for your website.

Advertisement
Advertisement

Standard vs Privacy-Enhanced Embed

YouTube offers two embed domains. The standard domain (youtube.com) sets tracking cookies as soon as the embedded player loads, even before the visitor clicks play. The privacy-enhanced domain (youtube-nocookie.com) does not set any cookies until the visitor actually starts playing the video. Many websites now default to the privacy-enhanced mode to reduce third-party cookie usage and simplify GDPR/cookie-consent compliance — this tool defaults to it as well.

Embed Parameters Explained

Autoplay: Modern browsers only allow autoplay if the video starts muted — this tool automatically adds the mute parameter alongside autoplay, since autoplay without mute is blocked by Chrome, Firefox, and Safari.

Loop: Requires the playlist parameter to be set to the same video ID — this is a YouTube API quirk, not a bug. Without it, loop has no effect on a single video.

Hide Controls: Removes the play/pause bar, but the video can still be controlled via keyboard or by clicking the video itself. This does not remove the YouTube logo or "Watch on YouTube" link, which YouTube's terms of service do not allow you to hide.

Responsive Embedding

A fixed-pixel iframe (e.g., 560×315) will overflow on mobile screens narrower than 560px. The responsive option uses the CSS "padding-bottom hack" — a widely used technique that maintains a 16:9 aspect ratio while scaling to 100% of the parent container's width. This ensures the embedded video resizes correctly across desktop, tablet, and mobile viewports.