YouTube Embed Code Generator
Generate custom YouTube embed codes with responsive layouts, autoplay, loop, start/end time, privacy mode, and Shorts support. Updated for 2026.
Supports: youtube.com/watch, youtu.be, youtube.com/shorts, youtube.com/playlist, or a video ID
Preview will appear here
A YouTube embed code is a snippet of HTML that displays a YouTube video player on any website. This free generator creates custom embed codes with responsive sizing, autoplay, loop, privacy-enhanced mode, start/end timestamps, and support for Shorts and playlists. Paste any YouTube URL, customize the player options, and copy the code. No signup required.
How to Embed a YouTube Video on Your Website
Paste Your URL
Copy the URL of any YouTube video, Shorts, or playlist and paste it into the input field above.
Customize Options
Choose responsive sizing, autoplay, loop, privacy mode, start/end time, and more. See a live preview instantly.
Copy and Paste
Click "Copy Code" and paste the HTML into your website, blog, WordPress, or any CMS. Done.
What is a YouTube Embed Code?
A YouTube embed code is an HTML <iframe> element that loads the YouTube video player inside your web page. When a visitor views the page, the embedded player loads the video directly from YouTube's servers, so you do not need to host the video file yourself.
The embed code format uses YouTube's IFrame Player API, which supports dozens of parameters for customizing playback behavior, appearance, and privacy settings. Our generator handles all of these parameters visually.
Why Responsive Embeds Matter
A standard YouTube iframe has fixed pixel dimensions. On a mobile phone or tablet, this can cause the video to overflow the screen. A responsive embed wraps the iframe in a container that scales proportionally to any screen width.
Our generator uses a CSS padding-bottom technique that maintains the 16:9 aspect ratio (or 9:16 for Shorts) regardless of screen size.
Privacy-Enhanced Mode and GDPR Compliance
When you enable privacy-enhanced mode, the embed code uses youtube-nocookie.com instead of youtube.com. YouTube does not store tracking cookies on your visitor's browser until they actually click play.
How Autoplay Works in 2026
Modern browsers block autoplay for videos with audio. For autoplay to work reliably, the video must also be muted. Our generator automatically enables mute when you toggle autoplay.
YouTube Embed Parameters Reference
| Parameter | Values | Description |
|---|---|---|
autoplay | 0 or 1 | Automatically start playing the video |
mute | 0 or 1 | Mute the video (required for autoplay) |
loop | 0 or 1 | Replay the video when it ends |
controls | 0 or 1 | Show or hide player controls |
modestbranding | 0 or 1 | Hide the YouTube logo in the control bar |
rel | 0 or 1 | Show related videos from same channel (0) or all (1) |
start | seconds | Start playback at a specific time |
end | seconds | Stop playback at a specific time |
color | red or white | Progress bar color |
disablekb | 0 or 1 | Disable keyboard shortcuts |
cc_load_policy | 0 or 1 | Show closed captions by default |
playsinline | 0 or 1 | Play inline on iOS instead of fullscreen |
Embedding YouTube Shorts
YouTube Shorts use a vertical 9:16 aspect ratio. When you paste a Shorts URL, the generator automatically adjusts the embed dimensions to display the Short correctly with a vertical player.
Embedding YouTube Playlists
You can embed an entire YouTube playlist by pasting a playlist URL. The embedded player will display the first video and include navigation controls for browsing all videos.
Frequently Asked Questions
How do I embed a YouTube video on my website?
Paste your YouTube video URL into the generator above and customize the options. Click "Copy Code" and paste the generated HTML iframe code into your website.
What is the YouTube embed code format?
YouTube embed codes use an HTML iframe element: <iframe src="https://www.youtube.com/embed/VIDEO_ID"></iframe>. Our generator adds responsive wrappers and parameters.
How do I make a YouTube embed autoplay?
Toggle the "Autoplay" option. This adds autoplay=1 to the embed URL. Most browsers require the video to also be muted.
How do I embed a YouTube video at a specific start time?
Use the "Start Time" field to set where the video should begin. You can also set an "End Time" to stop playback at a specific point.
What is YouTube privacy-enhanced mode?
Privacy-enhanced mode uses youtube-nocookie.com instead of youtube.com. YouTube will not store cookies unless the visitor plays the video. This helps with GDPR compliance.
Can I embed YouTube Shorts?
Yes. Paste any Shorts URL and the generator automatically detects the format and generates a vertical embed with the correct 9:16 aspect ratio.
How do I make a YouTube embed responsive?
Toggle the "Responsive" option. This wraps the iframe in a container that scales to fit any screen width while maintaining the correct aspect ratio.
Can I embed a YouTube playlist?
Yes. Paste a playlist URL and the generator creates embed code that plays through all videos with next/previous controls.
More Free YouTube Tools
YouTube Money Calculator
Estimate how much money you can earn on YouTube by views, niche, and country.
YouTube Tag Generator
Generate SEO-optimized tags using real YouTube search data, organized by category.
Hashtag Generator
Generate trending, niche, and long-tail hashtags for videos and Shorts.
Subscribe Link Generator
Create direct subscribe links, embed buttons, QR codes, and tracked sharing links.
Timestamp Link Generator
Create shareable YouTube links that start at a specific time with chapters export.
QR Code Generator
Create custom QR codes for videos, channels, playlists, and Shorts.
Thumbnail Previewer
See how your thumbnail looks in Search, Home Feed, Sidebar, and Shorts before publishing.