Skip to main content

YouTube Embed

Generate customizable YouTube video embed code from URLs

Embed YouTube videos with privacy-enhanced mode and custom parameters. Control autoplay, loop, annotations, and minimal branding for professional sites.

Video Options

Enter a YouTube URL to see preview


How to generate a YouTube embed?

Generating a YouTube embed takes just a few steps: Copy the YouTube video URL from your browser — it looks like https://www.youtube.com/watch?v=VIDEO_ID or the shortened https://youtu.be/VIDEO_ID format. Paste the URL into the input box on our tool. Choose your customization options: enable autoplay to start playback automatically (browsers require muted autoplay), toggle loop for continuous replay, set a start time in seconds to skip intros, and enable privacy-enhanced mode which uses youtube-nocookie.com instead of youtube.com. Click Generate to produce the embed code. The iframe HTML appears in the output box — copy it and paste directly into your webpage's HTML source.

Related Tools

You May Also Need

YouTube embed parameters that power users need

YouTube's embed URL supports many parameters beyond the basics. The rel=0 parameter prevents showing unrelated videos after playback ends — instead, YouTube shows videos from the same channel. The modestbranding=1 removes the YouTube logo from the control bar during playback. The start and end parameters let you define a specific segment (e.g., start=30&end=90 plays only seconds 30-90). The cc_load_policy=1 forces closed captions to load by default, important for accessibility compliance. The disablekb=1 disables keyboard controls, useful when embedding multiple players on one page to prevent key conflicts. The playlist parameter enables auto-playlist mode — when combined with video ID, it creates a sequential playlist starting from your chosen video. These parameters go after ? in the embed URL separated by ampersands.

Privacy-enhanced mode and GDPR considerations

YouTube's privacy-enhanced mode (youtube-nocookie.com domain) changes how data is collected. When using standard youtube.com embeds, YouTube sets cookies as soon as the page loads, even before the user clicks play. This triggers GDPR consent requirements in the EU. With youtube-nocookie.com, no cookies are set until the user interacts with the player. However, Google Analytics and other third-party scripts on your page may still set cookies independently. For full GDPR compliance, implement a cookie consent banner that blocks YouTube embeds until consent is given, then dynamically inject the iframe. Tools like Cookiebot and Osano provide JavaScript-based lazy loading solutions that only load YouTube iframes after explicit user consent. Even with privacy-enhanced mode, YouTube can still collect IP addresses and viewing data through their CDN infrastructure.

Frequently Asked Questions (FAQs)

What's the difference between youtube.com and youtube-nocookie.com?

youtube-nocookie.com doesn't set cookies until the user interacts with the player, reducing GDPR compliance burden. Both domains serve identical video content and player functionality. The nocookie domain is recommended for European audiences.

How do I make YouTube embeds responsive?

Wrap the iframe in a container div with position: relative and padding-bottom: 56.25% (for 16:9 aspect ratio). Set the iframe to position: absolute with width: 100% and height: 100%. This technique maintains aspect ratio across all screen sizes without JavaScript.

Can I remove the YouTube logo from embeds?

Use modestbranding=1 to hide the YouTube wordmark from the control bar. The YouTube logo still appears briefly at startup. Complete removal violates YouTube's Terms of Service.

Why does my YouTube embed show related videos at the end?

Add rel=0 to the embed URL parameters. This limits suggested videos to the same channel. Note that YouTube may still show some unrelated videos depending on content context.

Can I autoplay YouTube videos?

Autoplay requires mute=1 due to browser policies. Add autoplay=1&mute=1 to your embed URL. Most modern browsers block unmuted autoplay entirely. iOS Safari requires user interaction before any media plays.

How do I embed a YouTube playlist?

Use the playlist parameter with a list ID (found in the playlist URL). Format: https://www.youtube.com/embed?playlist=LIST_ID&autoplay=1. The first video in the playlist plays automatically, and subsequent videos play sequentially.

Recently Used Tools