YouTube Embed Code Generator

Generate custom HTML iframe embed code for any YouTube video — with autoplay, loop, start time, responsive mode, privacy settings, and more.

Please enter a valid YouTube video URL or ID.
Playback
Autoplay
Start playing automatically
Loop
Repeat video infinitely
Mute
Start with sound off
Appearance & Layout
Responsive
Auto-resize for any screen
Hide Controls
Remove the player controls bar
Modest Branding
Reduce YouTube logo visibility
Hide Fullscreen
Remove fullscreen button
Privacy & Content
Privacy Mode
No-cookie domain (GDPR-friendly)
Hide Related Videos
No unrelated suggestions at end
Show Captions
Force captions on by default
Hide Annotations
Remove on-video pop-ups
Dimensions & Timing

Live Preview

How your embed will look

Output


                

                

                

Related Tools

YouTube Playlist Length Calculator
YouTube Timestamp Link Generator
YouTube Topic Finder
YouTube Channel Name Generator

YouTube Embed Code Generator — User Guide

What Does This Tool Do?

The YouTube Embed Code Generator creates custom HTML <iframe> code for embedding YouTube videos on your website, blog, or landing page. Unlike YouTube's built-in share button, this tool gives you full control over player behavior — autoplay, loop, start/end times, privacy mode, related videos, annotations, responsive sizing, and more.

How to Use

1
Copy any YouTube video URL from your browser's address bar or the Share button on YouTube.
2
Paste it into the input field above. The tool accepts full URLs, short youtu.be links, Shorts URLs, or just the bare 11-character video ID.
3
Toggle the options you want across the three setting groups — Playback, Appearance, and Privacy & Content.
4
Click Generate to see a live preview and copy-ready code across three tabs: full embed, raw iframe, and direct URL.

Tips

Responsive mode: Always enable for blogs and CMS pages. It uses a CSS padding trick to maintain 16:9 ratio on all screens. When on, width/height inputs are ignored.

Privacy mode: Loads from youtube-nocookie.com — recommended for GDPR compliance. No tracking cookies until the user interacts.

Autoplay + Mute: Browsers block autoplay with sound. Enable Mute alongside Autoplay — the tool warns you if you forget.

Hide Related Videos: On by default via rel=0. Keeps suggestions limited to the same channel at the end.

Loop warning: Loop requires autoplay to work reliably in most browsers. The tool will warn you if loop is on without autoplay.

End time: YouTube's end= parameter is not strictly enforced in all players — treat it as a soft stop.

Troubleshooting

Video not loading in preview
Some videos are restricted by the uploader and cannot be embedded. If the preview shows "Video unavailable", the video owner has disabled embedding.

Autoplay not working
Chrome, Safari, and Firefox all block autoplay with sound. Enable Mute alongside Autoplay for reliable auto-playback.

Loop not working
Loop works most reliably with Autoplay also enabled. The tool sets the required playlist parameter automatically.

Embed looks too small
Enable Responsive mode so it fills its container, or disable it and set a custom width/height.

Frequently Asked Questions

Paste the YouTube video URL into the input field, adjust your settings, and click Generate. You get a live preview plus three output tabs: the full embed code (with responsive wrapper if enabled), a raw <iframe> only, and the direct embed URL.
Yes. The Responsive toggle is on by default. It wraps the iframe in a container div using padding-bottom:56.25% to maintain 16:9 on any screen. When responsive is on, the width/height fields are disabled.
Enable the Hide Related Videos toggle (on by default). This adds rel=0 to the embed URL so YouTube only shows videos from the same channel instead of unrelated recommendations.
Privacy-enhanced mode uses youtube-nocookie.com instead of youtube.com. YouTube won't set tracking cookies until the user actually clicks play. Recommended for GDPR compliance.
Modern browsers block autoplay with sound. Enable both Autoplay and Mute — the tool warns you if you enable autoplay without mute.
Three tabs: Embed Code — full HTML with responsive wrapper when enabled. Raw iframe — just the <iframe> tag, useful for Webflow, Squarespace, or Notion. Direct URL — the bare embed URL for page builders.
Yes. Enter a start time in seconds to skip an intro (e.g. 90 for 1:30). You can also set an end time, though YouTube's end= parameter is not strictly enforced — treat it as a soft stop.
Full URLs (youtube.com/watch?v=xxxxx), short URLs (youtu.be/xxxxx), Shorts URLs (youtube.com/shorts/xxxxx), embed URLs, and bare 11-character video IDs — all detected automatically.
100% free — no signup, no account, no hidden costs. Generate as many embed codes as you need.