YouTube Embed Code Generator
Paste a YouTube link in any format, choose start and end times, autoplay, loop, captions and privacy-enhanced mode, and copy clean, responsive iframe code for your website. The preview only loads YouTube when you click it.
Live preview
How to use the YouTube Embed Code Generator
- Paste the YouTube link (or just the 11-character video ID). Shorts are detected and switched to a 9:16 frame.
- Set start and end times if you only want part of the video, for example 1:30 to 2:45.
- Choose playback options such as autoplay, loop, captions or hidden controls.
- Pick a size: Responsive fills the width of its container at the chosen aspect ratio; Fixed size uses exact pixels.
- Press Copy Code and paste it into your HTML, WordPress Custom HTML block or page builder. Click Load Preview to check it first.
YouTube links this tool understands
| Link format | Example |
|---|---|
| Watch page | https://www.youtube.com/watch?v=VIDEO_ID&t=90s |
| Short link | https://youtu.be/VIDEO_ID?t=1m30s |
| Shorts | https://www.youtube.com/shorts/VIDEO_ID |
| Live | https://www.youtube.com/live/VIDEO_ID |
| Existing embed | https://www.youtube.com/embed/VIDEO_ID?start=30 |
| Playlist | https://www.youtube.com/playlist?list=PL… |
| Mobile / Music | m.youtube.com, music.youtube.com |
| Bare ID | 11 characters of letters, digits, - and _ |
YouTube embed parameters reference
| Parameter | Value | Effect |
|---|---|---|
start | seconds | Begin playback at this second (1:30 = 90). |
end | seconds | Stop playback at this second. |
autoplay | 1 | Start playing automatically (needs mute=1 in most browsers). |
mute | 1 | Start muted. |
loop + playlist | 1 + video ID | Repeat the video; a single video must be listed as its own playlist. |
controls | 0 | Hide the player controls. |
cc_load_policy | 1 | Show captions by default. |
cc_lang_pref | language code | Preferred caption language, e.g. en or es. |
rel | 0 | Related videos at the end come from the same channel. |
playsinline | 1 | Play inside the page on iPhone instead of fullscreen. |
fs | 0 | Hide the fullscreen button. |
Responsive embed: how the padding trick works
An iframe has no natural aspect ratio, so the responsive code wraps it in a div with height:0 and a bottom padding equal to height ÷ width × 100. Percentage padding is measured against the container's width, so the box always keeps the right shape, and the iframe is stretched to fill it with absolute positioning.
| Aspect ratio | Padding-bottom | Typical use |
|---|---|---|
| 16:9 | 9 ÷ 16 = 56.25% | Standard YouTube videos |
| 9:16 | 16 ÷ 9 = 177.7778% | YouTube Shorts |
| 4:3 | 3 ÷ 4 = 75% | Older recordings, presentations |
| 1:1 | 100% | Square social clips |
Frequently asked questions
How do I embed a YouTube video on my website?
Paste the video link above, copy the generated code and paste it into your page's HTML where the video should appear. In WordPress use a Custom HTML block; in most site builders use an Embed or HTML element.
How do I make a YouTube embed start at a specific time?
Enter the time in the Start at field, for example 1:30. The tool adds start=90 to the embed URL. If your link already contains ?t=90 or ?t=1m30s, the start time is filled in automatically. Use End at to stop playback at a given second.
Why doesn't my embedded YouTube video autoplay?
Browsers only allow autoplay when the video is muted, so the tool switches on Start muted when you tick Autoplay. Data-saver modes and some mobile browsers may still block autoplay entirely.
How do I loop a YouTube embed?
Tick Loop. For a single video YouTube also requires a playlist parameter containing the same video ID, which the generator adds for you (loop=1&playlist=VIDEO_ID).
What is privacy-enhanced mode?
Embeds from youtube-nocookie.com do not store YouTube cookies or personalise ads for visitors until they play the video. It is the recommended option for GDPR-conscious sites and works the same for viewers.
How do I make a YouTube embed responsive?
Use the Responsive option. The iframe is placed inside a wrapper with a percentage padding (56.25% for 16:9) so it scales with the width of the page while keeping its shape. Set a max width if it should not grow beyond a certain size.
Can I embed YouTube Shorts?
Yes. Paste the youtube.com/shorts/ link; the generator converts it to a normal embed URL and selects a vertical 9:16 frame.