YouTube Embed Code Generator
Paste a video, Short, or playlist link, pick your options, and copy clean embed code — with start and end times, privacy-enhanced mode, and a responsive size. Runs entirely in your browser.
This YouTube embed code generator builds the HTML to put a YouTube video, Short, or playlist on your website — with options YouTube’s own Share → Embed box doesn’t offer. Set a start and end time, autoplay (including muted autoplay that browsers allow), looping, captions, privacy-enhanced mode, and a responsive size that fits any screen, then copy the code and paste it into your page. A live preview shows the player as you go. Everything happens in your browser: nothing is sent to Marqly, and every option maps to a parameter documented in YouTube’s official player reference.
How to embed a YouTube video on your website
- Copy the video’s link from YouTube — a watch page, Short, live stream, youtu.be link, or a playlist link containing
list=. - Paste it above. If the link includes a timestamp such as
?t=90, the start time is filled in. - Choose your options. The code and preview update instantly.
- Press Copy code and paste it into your page’s HTML — in WordPress, use a Custom HTML block; in most site builders, an Embed or HTML element.
Every option, and the parameter behind it
| Option | Parameter | What it does |
|---|---|---|
| Start at | start | Starts playback this many seconds into the video. The player seeks to the nearest keyframe, which can be up to about two seconds earlier. |
| End at | end | Stops playback at this time, counted from the start of the video — not from your start time. |
| Autoplay | autoplay=1 | Starts the video when the player loads. YouTube notes that playback data collection then happens on page load. |
| Loop | loop=1 | Repeats a playlist; for a single video YouTube also needs playlist set to the same video ID, which the generator adds. |
| Show player controls | controls=0 when off | Hides the control bar. |
| Fullscreen button | fs=0 when off | Hides the fullscreen button. |
| Captions on by default | cc_load_policy=1 | Shows captions by default, where the video has them. |
| Same-channel suggestions | rel=0 | Limits the related videos shown at the end to the same channel. |
| Play inline on iPhone | playsinline=1 | Plays inside the page on iOS instead of jumping to fullscreen. |
| Disable keyboard controls | disablekb=1 | Turns off shortcuts such as k to pause and j/l to skip 10 seconds. |
| White progress bar | color=white | Colors the watched part of the progress bar white instead of red. |
| Privacy-enhanced mode | youtube-nocookie.com | Uses YouTube’s privacy-enhanced embed domain (see below). |
Start and end times
YouTube’s player takes start and end times as whole seconds, so the generator converts whatever you type — 90, 1:30, 1:02:03, or 1h2m3s — into seconds. Both are measured from the very beginning of the video: to play the clip from 1:30 to 2:00, enter start 1:30 and end 2:00, not end 0:30. To share a moment as a link rather than an embed, use theYouTube timestamp link generator.
Why embedded videos don’t autoplay — and the fix
Browsers decide whether a video may start on its own. YouTube’s IFrame API documentation lists unmuted playback without user interaction among the cases browsers block, so autoplay=1on its own often does nothing. The reliable approach is to start muted: chooseMuted autoplay (JavaScript API) and the generator produces an embed plus a short script that loads YouTube’s official IFrame Player API, mutes the player when it’s ready, and starts playback. Visitors can unmute with one click.
YouTube’s rules for API clients add two conditions worth respecting: a player must not start playing automatically until more than half of it is visible on screen, and a page must not have more than one YouTube player autoplaying at the same time. A hero video at the top of a page is fine; an autoplaying video far down a page is not.
Privacy-enhanced mode (youtube-nocookie.com)
Privacy-enhanced mode replaces www.youtube.com with www.youtube-nocookie.comin the embed URL. YouTube’s help center says it prevents views of the embedded video from influencing the viewer’s YouTube browsing experience, shows non-personalized ads, and keeps those views from personalizing ads shown to the viewer outside your site. It’s on by default here because it costs nothing. What it isn’t: a promise that the embed sets no cookies or does no tracking, and it doesn’t by itself make an embed compliant with any privacy law — list YouTube in your privacy policy and consent setup either way.
Responsive YouTube embeds, including Shorts
The default iframe has a fixed 560 × 315 size that overflows on phones. With Responsiveon, the code sets the player to 100% of its container’s width and uses the CSSaspect-ratio property to keep its shape — no padding-bottom wrapper needed in any current browser. Pick 9:16 for Shorts so the vertical video isn’t letterboxed; the width field then caps how wide it can grow. YouTube requires embedded players to be at least 200 × 200 pixels and recommends at least 480 × 270 for 16:9 players, so the generator won’t go below 200 pixels wide.
Click-to-load embeds for faster pages
A YouTube iframe loads the full player as soon as the page does, which is heavy for a page that has a video most visitors never play. The Click-to-load output shows the video’s thumbnail with a play button and only swaps in the real player when someone clicks it (or presses Enter on it), then starts playback. Page speed improves, and nothing is requested from the player until the visitor chooses to watch. It works for single videos; playlists use the standard iframe.
Parameters that no longer work
modestbrandingis deprecated and has no effect; YouTube now decides branding from the player’s size and other signals. Generators that still offer it are out of date.showinfowas deprecated in 2018 and removed from the documentation.rel=0can’t switch related videos off since September 25, 2018 — it only keeps them to the same channel.controls=2is deprecated; use 0 or 1.
Troubleshooting a broken embed
- Error 153 or a blank player. YouTube requires embeds to identify the site they’re on through the HTTP Referer header and recommends the
strict-origin-when-cross-originreferrer policy. The generated code sets that policy; if your site sendsno-referrerglobally, the player can fail. - “Video unavailable.” The owner may have turned off embedding for that video, or it’s private, deleted, or blocked in the visitor’s country. Only the owner can change that.
- The player is cut off or tiny. A parent element with a fixed height or
overflow: hiddenis clipping it; with Responsive on, give the container a width and let the height follow. - Loop doesn’t repeat. For a single video, the URL must include
playlist=with the same video ID — copy the generated code rather than addingloop=1by hand.
Related YouTube tools
Find the right moment to start from with the YouTube transcript tool, add chapters for long embeds with the chapter generator, or download a custom poster image with thethumbnail downloader. Embedding a whole course? Theplaylist length calculator tells visitors how long it runs.
Frequently asked questions
How do I embed a YouTube video that starts at a specific time?
Enter the start time in the generator — as seconds, M:SS, H:MM:SS, or 1m30s — and copy the code. It adds the start parameter to the embed URL in seconds, which is the format YouTube’s player expects. If the link you paste already has a t= timestamp, the start time is filled in for you.
Why doesn’t my embedded YouTube video autoplay?
Most browsers block video that plays with sound before the visitor interacts with the page. YouTube’s developer documentation lists unmuted playback without user interaction as one of the cases browsers block. Use the Muted autoplay (JavaScript API) output, which starts the player muted.
How do I make a YouTube embed responsive?
Leave Responsive switched on. The code sets the player to the full width of its container and uses the CSS aspect-ratio property to keep 16:9 — or 9:16 for Shorts — so it scales on every screen without a wrapper hack.
What does privacy-enhanced mode do?
It switches the embed to the youtube-nocookie.com domain. According to YouTube’s help center, views of the embedded video then don’t influence the viewer’s YouTube browsing experience or personalize ads shown outside your site. It doesn’t make the embed tracking-free, so keep it in your privacy policy.
How do I loop a single YouTube video?
Tick Loop. For a single video YouTube requires the playlist parameter set to the same video ID as well as loop=1; the generator adds both for you.
Can I hide related videos at the end?
Not completely. Since September 2018, rel=0 no longer hides related videos — it limits them to videos from the same channel. The generator’s Same-channel suggestions option sets that.
Can I embed a playlist?
Yes. Paste a playlist link (it contains list=). The generator builds a playlist embed, and if your link also points to a specific video, the player starts there.





