YouTube Embed Code Generator
Create YouTube embed code for your website with a live preview. Make the player responsive, set start and end times, autoplay, loop and more.
Embed code
Preview
How to embed a YouTube video
- Paste the video or playlist link into the generator.
- Choose your options. Responsive size is best for most websites because the player fills its container on any screen.
- Copy the code and paste it into your page's HTML, or into an "HTML" or "Custom code" block in WordPress, Wix, Squarespace, Webflow or Shopify.
What each option does
| Option | Parameter | What it does |
|---|---|---|
| Responsive | CSS | Keeps the player at 16:9 and scales it to fit any screen width. |
| Start / end | start, end | Plays only part of the video, in seconds. |
| Autoplay | autoplay=1 | Starts playing on load. Browsers only allow this when the video is muted, so the generator adds mute=1. |
| Loop | loop=1 | Replays when finished. For a single video this also needs playlist=VIDEO_ID, which is added for you. |
| Controls | controls=0 | Hides the player's control bar. |
| Captions | cc_load_policy=1 | Turns captions on by default, where available. |
| Privacy-enhanced | youtube-nocookie.com | YouTube doesn't store viewing information about visitors unless they play the video. Recommended for GDPR-conscious sites. |
| Lazy load | loading="lazy" | Delays loading the player until it's near the screen, which makes your page faster. |
Frequently asked questions
How do I make a YouTube embed responsive?
Select "Responsive" in the generator. It wraps the iframe in a container with a 16:9 aspect ratio and sets the player to 100% width, so it resizes with the page.
Why doesn't autoplay work?
Browsers block autoplay with sound. Autoplaying embeds must be muted. The generator adds mute=1 automatically when you tick Autoplay.
Can I embed a YouTube playlist?
Yes. Paste a link that contains list= (a playlist page or a video inside a playlist) and the generator creates a playlist embed.
Why does my embed say "Video unavailable"?
The uploader may have disabled embedding, or the video is private, age-restricted or blocked in your region. Only the uploader can change these settings.
Can I hide related videos at the end?
Not completely. Since 2018 YouTube always shows related videos when an embed finishes. It limits them to the same channel if you add rel=0, which the generator includes by default.
More free YouTube tools
- Shorts Thumbnail DownloaderSave Shorts covers in vertical 1080×1920.
- Channel Banner DownloaderGet any channel's banner in 2560×1440.
- Profile Picture DownloaderView and save full-size channel icons.
- Tag ExtractorSee the hidden tags on any video.
- Thumbnail PreviewTest your thumbnail and title before publishing.
- Timestamp Link GeneratorShare a video from a specific moment.
- Embed Code GeneratorResponsive embed code with a live preview.
- Thumbnail Size GuideEvery YouTube image size in one place.