How to generate YouTube embed code
- Paste the video link. Shorts, youtu.be and playlist links all work.
- Set a start or end time and pick the options you want. The preview updates as you go.
- Press Copy code and paste it into your page's HTML.
Embed parameters
| Parameter | What it does |
|---|---|
start / end | Play from and to a time, in seconds |
autoplay=1 | Start playing on load (browsers require mute=1 too) |
loop=1 + playlist=ID | Repeat the video (loop needs the playlist parameter) |
controls=0 | Hide the player controls |
cc_load_policy=1 | Turn captions on by default |
rel=0 | Show related videos from the same channel only |
loading="lazy" | Load the player only when it scrolls into view |
The responsive code uses CSS aspect-ratio, so the video fills the width of its container at 16:9 on every screen. Want to see the video without the rest of YouTube? Try the distraction-free player.
Frequently asked questions
Paste the video link, choose your options, and press Copy code. Paste the code into your page's HTML where you want the video. In WordPress, use a Custom HTML block; in Wix, Squarespace or Shopify, use their Embed or Code block.
Type the start time (like 1:30) in Start at. The code adds start=90 so the video begins 90 seconds in. You can set an end time the same way.
Browsers block videos that autoplay with sound. Turn on Mute together with Autoplay and the video will start on its own; viewers can unmute it.
It uses youtube-nocookie.com, so YouTube doesn't set cookies for a visitor until they play the video. It's a good default for sites that need to respect cookie consent rules like GDPR.
The uploader has turned off embedding, the video is private, or it's blocked in the viewer's country. Check it with the private video checker.