The minimal embed
Every YouTube embed is an iframe pointing at:
https://www.youtube.com/embed/VIDEO_ID
Replace VIDEO_ID with the part after watch?v= or youtu.be/. Add title, allowfullscreen, and an allow attribute for modern permissions.
Make it responsive
Fixed width and height break on mobile. Wrap the iframe in a 16:9 box:
<div style="position:relative;padding-top:56.25%;height:0;overflow:hidden">
<iframe style="position:absolute;inset:0;width:100%;height:100%;border:0"
src="https://www.youtube.com/embed/VIDEO_ID"
title="YouTube video player" allowfullscreen></iframe>
</div>
The 56.25% padding is 9÷16 — the widescreen aspect ratio.
Useful query parameters
| Parameter | Purpose |
|---|---|
autoplay=1 | Auto-start (needs mute=1) |
mute=1 | Start muted |
start=90 | Begin at 90 seconds |
loop=1&playlist=VIDEO_ID | Loop single video |
controls=0 | Hide controls |
rel=0 | Fewer off-channel suggestions |
Join parameters with & after ?.
Generate code in one click
The YouTube Embed Code Generator parses your URL, applies toggles, and outputs copy-paste HTML with a live preview — all client-side.
SEO note
Embedded videos can increase time-on-page when the content matches search intent. They do not replace good titles, descriptions, or canonical URLs on your own page — see the Canonical Tag Generator if you syndicate content across domains.