YouTube Embed Code Generator

51 tools

Build an iframe with start time, autoplay and responsive sizing.

Free to use with no account. JSON, password and 2FA tools run entirely in your browser.

YouTube Embed Code Generator

Build an iframe with start time, autoplay and responsive sizing.

Free

About

Paste a video link, tick the options you want, and copy an iframe that already carries the right parameters. The code is assembled in your browser from the link you typed, with no account, API key or server call involved. A live preview under the code shows the player the snippet will produce on your page.

How to use

Paste the video URL or ID. Enter a start time if you want one, or leave it blank to reuse the t= value from a link like youtu.be/ID?t=90. Keep Responsive width on for a player that fills its container, or turn it off and set a fixed width and height, which start at 560 by 315. Tick autoplay, mute or loop, or untick Show controls, check the preview, and press Copy code.

Start time formats it accepts

The start field takes plain seconds (90), clock notation (1:30 or 1:02:03) and YouTube's own style (1m30s or 1h2m3s). All of them become a start= parameter counted in seconds. If you paste a link that already carries t= or start= and leave the field empty, that value is used, which saves working out again the moment you copied the link at.

Why autoplay also mutes

Browsers block videos that start playing with sound before the visitor has done anything on the page. An embed with autoplay=1 and no mute will usually sit still, which looks like broken code. Ticking autoplay therefore adds mute=1 as well. The preview on this page leaves autoplay out, so the player stays quiet while you are still adjusting options.

Loop needs a playlist parameter

YouTube's player ignores loop=1 on a single video unless it is also given a playlist containing that video. The generator adds playlist= with the same ID whenever loop is ticked. Hand-written embed codes miss this step more than any other, and it is the reason a looping embed so often plays once and stops.

Responsive wrapper or fixed size

A fixed iframe at 560 by 315 overflows a narrow phone screen. The responsive option wraps the iframe in a div with aspect-ratio 16/9 and positions the iframe to fill it, so the player takes the full width of whatever column it lands in and keeps its shape. Use fixed dimensions only when the layout around the player is fixed too, such as a sidebar of known width.

The youtube-nocookie domain

Privacy-enhanced mode, on by default here, points the iframe at www.youtube-nocookie.com instead of www.youtube.com. YouTube runs that domain itself for sites that want the player to keep less about their visitors. The video, the controls and every parameter on this page behave the same way on either domain.

FAQ

How do I embed a YouTube video so it starts at a specific time?

Type the time in the start field as 90, 1:30 or 1m30s. The embed URL in the code gets start=90 added to it.

Why won't my embedded YouTube video autoplay?

Most likely it is not muted. Browsers refuse autoplay with sound, so the generator pairs autoplay with mute automatically.

How do I make a YouTube embed responsive?

Leave Responsive width ticked. The output is a div with a 16:9 aspect ratio holding an iframe set to fill it, so the player scales with its column on any screen.

Can I hide the controls on an embedded YouTube player?

Untick Show controls and the code gains controls=0, which removes the control bar along the bottom of the player.

Related tools