YouTube Embed Generator
Introduction
The Toollect YouTube Embed Generator turns any YouTube video URL or bare video ID into ready-to-paste iframe code in one click. Paste a link, choose how the player should behave, generate, preview, copy, paste – the whole cycle takes seconds, and every option maps to a real, currently-supported YouTube parameter.
The problem it removes is the fiddly one. The official Share dialog hands you a single fixed iframe with no control over size, ratio, or behavior, and every "how do I embed YouTube" tutorial sends you to a list of parameters you have to splice into the URL by hand. This tool does that splicing for you: pick an aspect ratio and the counterpart dimension is calculated automatically, toggle privacy mode, loop, controls, and clip a video to a start and end time without ever opening an editor.
The generator is deliberately a single-video tool. It accepts the full grammar of real-world YouTube links – watch URLs, youtu.be short links, Shorts, live streams, even a bare video ID – and normalizes them all to one canonical embed URL. Everything runs in your browser: no API key, no account, and nothing about your link leaves your device. The only network request is the honest one – the live preview, which loads a real player iframe so you can verify the result before you copy it.
Use Cases
Embedding YouTube video shows up in more places than a blog post, and the options matter differently in each context.
- Blog and article pages. The default 16:9 ratio at 560×315 matches what most CMS themes expect, and the privacy-enhanced domain keeps the embed GDPR-friendly by default.
- Course and documentation pages.
startandendlet you point students at a precise section of a long lecture, and the generated code works in any learning platform that accepts raw HTML. - Shorts and vertical content. The 9:16 preset produces a phone-shaped 360×640 player for vertical videos, which most other embed generators do not offer at all.
- Kiosk and signage screens. Turn off player controls for a clean, distraction-free playback surface, optionally with the loop toggle for continuous exhibition.
- Design mockups. Drop a video into a Figma or HTML prototype at an exact pixel size – the custom ratio mode accepts any width and height between 144 and 3840 pixels.
- Privacy-conscious sites. The nocookie domain is the default here, whereas the official dialog always generates a
www.youtube.comURL unless you know to switch it manually.
How It Works
The generator is a two-stage pipeline, both stages running entirely in your browser.
Stage 1 – ID extraction. The URL parser recognizes every common YouTube link shape and pulls out the 11-character video ID. The same ID is the only thing YouTube's embed player needs. A bare ID is accepted too, so you can also paste an ID copied from the address bar or a database.
Stage 2 – Code assembly. The ID is placed into the embed URL template, and each enabled option appends a query parameter:
https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?autoplay=1&start=30
The iframe tag is then assembled with explicit width and height attributes, the accessibility title, the standard allow permission list, and allowfullscreen. One YouTube quirk is handled automatically: a looped single video must be presented as a one-item playlist, so enabling loop adds both loop=1 and playlist=VIDEO_ID together. Without the second parameter, YouTube silently ignores the loop.
The preview is the same iframe that the generated code contains – the tool renders the actual player, not a mock. What you see in the preview is exactly what your visitors will see, including how YouTube itself reports a deleted, private, or unavailable video.
Supported URL Formats
The parser accepts every form that identifies a single video, and rejects every form that does not.
Accepted
| URL form | Example |
|---|---|
| Watch URL | https://www.youtube.com/watch?v=dQw4w9WgXcQ |
| Short link | https://youtu.be/dQw4w9WgXcQ |
| Embed URL | https://www.youtube.com/embed/dQw4w9WgXcQ |
| Shorts URL | https://www.youtube.com/shorts/dQw4w9WgXcQ |
| Live URL | https://www.youtube.com/live/dQw4w9WgXcQ |
| /v/ URL | https://www.youtube.com/v/dQw4w9WgXcQ |
| Nocookie domain | https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ |
| Bare video ID | dQw4w9WgXcQ |
Watch URLs with extra query parameters, such as &t=42s or &list=PL..., are parsed correctly – the generator extracts the ID and ignores the rest, because the embed parameters are rebuilt from your settings instead of copied from the link.
Rejected
| URL form | Why it is rejected |
|---|---|
| Playlist link | youtube.com/playlist?list=PL... identifies a playlist, not a single video |
| Channel page | youtube.com/@channel has no video ID |
| Search URL | youtube.com/results?search_query=... has no video ID |
| User page | youtube.com/user/name has no video ID |
| Shorts without ID | youtube.com/shorts/ is an index page, not a video |
Anatomy of the Embed Code
The generated iframe is compact, and every part has a job. This is what the default 16:9 output looks like:
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
| Attribute | Meaning |
|---|---|
width / height |
The player size in pixels. Height is computed from the chosen aspect ratio when you edit width, and vice versa. |
src |
The embed URL. The default host is www.youtube-nocookie.com; disabling privacy mode switches it to www.youtube.com. Query parameters carry the player options. |
title |
The accessible name screen readers announce for the frame. It keeps YouTube's official default so the generated code matches what YouTube itself publishes. |
frameborder |
Legacy attribute kept for compatibility with old HTML validators; it has no visual effect in modern browsers. |
allow |
The permission policy for the embedded player – fullscreen-friendly and autoplay-capable, matching YouTube's official embed. |
referrerpolicy |
Tells the browser what to send in the Referer header. strict-origin-when-cross-origin is the modern default that only leaks the origin, never the full page URL. |
allowfullscreen |
Enables the fullscreen button in the player. |
The src query parameters are the part you can configure. autoplay=1, loop=1&playlist=ID, controls=0, start=SECONDS and end=SECONDS appear only when you enable the corresponding option, so a minimal embed carries no parameters at all.
Embed Options
Every option in the settings panel maps to a parameter in the final URL.
| Setting | Parameter | Default | Notes |
|---|---|---|---|
| Aspect ratio | – | 16:9 | Presets are 16:9, 4:3, 3:4, 9:16 and 1:1, plus custom. Choosing a preset fills the canonical size for that ratio – 16:9 becomes 560×315, 9:16 becomes 360×640. |
| Width / Height | – | 560×315 | Editing one field recomputes the other from the active ratio. Custom ratio mode disables the computation and keeps the two values independent. Range 144–3840 px. |
| Privacy-enhanced mode | host switch | on | Uses www.youtube-nocookie.com, where YouTube does not store visitor information unless the video is played. |
| Autoplay | autoplay=1 |
off | Note that browsers still block autoplay with sound; see the FAQ. |
| Loop | loop=1&playlist=ID |
off | The playlist parameter is added automatically – without it YouTube ignores loop. |
| Show player controls | controls=0 when off |
on | Off hides the control bar, giving a clean playback surface. |
| Start at | start=SECONDS |
off | Hours, minutes and seconds fields; the value is converted to seconds in the URL. |
| End at | end=SECONDS |
off | Stops playback at the given time, letting you clip a section without editing the source video. |
The width and height auto-computation rounds to whole pixels and clamps to the 144–3840 range. Because the presets are exact ratios, canonical pairs like 560×315 and 360×640 are pixel-perfect – no rounding drift to fight when you need a precise size.
Parameter Reference: What Still Works
YouTube has deprecated more embed parameters than most sites realize, and old tutorials keep recommending dead ones. This is the 2026 status of the parameters you will meet on the internet, checked against the official player documentation.
Still functional
| Parameter | Effect in 2026 |
|---|---|
autoplay |
Starts playback, subject to browser muting policy |
loop + playlist |
Loops the video; the pair must travel together |
controls |
0 hides the control bar; 2 additionally hides the fullscreen button |
start / end |
Jump-in and cut-off points in seconds |
cc_load_policy |
1 forces captions on |
cc_lang_pref |
Sets the caption language |
hl |
Sets the player interface language |
color |
color=white switches the progress bar to white (only with controls visible) |
fs |
0 hides the fullscreen button |
disablekb |
1 disables keyboard control of the player |
rel |
0 restricts related videos to the same channel – it cannot remove them entirely |
Deprecated and no longer functional
| Parameter | What happened |
|---|---|
modestbranding |
Deprecated August 2023; the logo is always shown now |
showinfo |
Deprecated September 2018; titles are always shown |
autohide |
Deprecated; the parameter is ignored |
theme |
Deprecated; only the dark player exists |
vq |
Dead for years; initial quality can no longer be forced |
iv_load_policy |
Annotations were removed from YouTube, so the parameter has nothing left to control |
The generator deliberately exposes only the parameters that still work and that most embedders actually need. The functional-but-niche set – fs, hl, color, disablekb, cc_load_policy – stays out of the UI on purpose: the output is a plain URL, so anyone can append &fs=0 or &cc_load_policy=1 by hand without breaking anything the generator produced.
Usage
- Paste a YouTube video URL or a bare video ID into the input field and press Generate, or press Enter.
- The embed code appears in the output area and the live preview opens automatically below it.
- Adjust the options – ratio, width or height, privacy mode, autoplay, loop, controls, start and end time. The code and the preview update instantly as you change each one.
- Check the preview. It is the real player, so you can press play, scrub, and verify the start and end points visually.
- Click Copy and paste the iframe into your page, CMS, or HTML block.
If the URL does not contain a video ID, a red error message explains what was expected. Clear resets the input, the code, and the preview in one step.
Tutorial
Example 1 – a lecture segment with a clip and a loop. A course page needs a 12-minute lesson, but the source video is 40 minutes and the relevant part runs from 3:05 to 12:30, looped for students who want to re-watch.
- Paste the watch URL into the input and press Generate.
- The 16:9 ratio and 560 width are already correct, so leave them.
- Enter 3 in the start minutes field, 5 in the start seconds field.
- Enter 12 in the end minutes field, 30 in the end seconds field.
- Tick Loop.
- The code now contains
start=185&end=750&loop=1&playlist=VIDEO_ID. - Copy and paste the iframe into the course page.
Example 2 – a Shorts video in vertical format. A mobile-friendly article embeds a 9:16 Short.
- Paste the Shorts URL –
https://www.youtube.com/shorts/...is recognized like any other link. - Choose the 9:16 ratio. The width becomes 360 and the height 640 automatically.
- Leave autoplay off – mobile browsers would block it anyway.
- Generate, preview, copy. The iframe is phone-shaped and fits content columns built for portrait media.
Pro Tips
- Clip without editing.
startandendcreate a section clip with no re-encoding, no re-upload, and no loss of quality – the player simply skips to the in point and stops at the out point. - Keep the privacy host for EU traffic.
youtube-nocookie.comdoes not store visitor information unless the video is played, which makes consent paperwork simpler than with the plain domain. - Pair autoplay with mute manually. If you truly need autoplay, append
&mute=1to the generatedsrc– browsers allow silent autoplay, and visitors can unmute with one tap. - Use the preview as the QA step. Since the preview is the actual player, a deleted or private video shows YouTube's own error message there instead of silently shipping a dead iframe to production.
- Tiny embeds for cards and lists. The 144 px minimum supports thumbnail-sized players for hover-preview cards, where a larger player would break the layout.
- Custom ratio for unusual layouts. Sidebars, vertical article columns, and social proof sections often need non-standard sizes – custom mode keeps width and height independent.
- Batch generating. Keep the URL in the field and toggle options – every change regenerates instantly, so producing a looped, clipped, and plain variant takes seconds, not minutes.
Alternatives
| Alternative | Strength | Trade-off |
|---|---|---|
| YouTube's official Share dialog | Official, always current | Fixed 16:9 size, no ratio presets, no start/end fields, always the www.youtube.com host |
| YouTube oEmbed | Returns an iframe with the video title automatically | Needs a server or a fetch, no parameter controls, requires JavaScript plumbing |
| Copying the URL by hand | Nothing to learn | Every option is a manual URL edit, error-prone, and the dead parameters tempt you in |
| This generator | One click, ratio presets, nocookie default, start/end fields, instant preview | Single-video only by design; no playlist embeds |
vs. YouTube's Share Dialog
YouTube's own "Share → Embed" flow is fine when you want exactly one fixed iframe. The dialog hands you a 560×315 player, lets you toggle one checkbox, and gives you a URL on www.youtube.com. That is the whole feature set.
The generator covers the cases the dialog simply does not address: a 9:16 Shorts player, a 3:4 or 1:1 tile, a precise pixel size, a privacy-enhanced host by default, a start and end clip without hand-editing the URL, and a loop that actually works because the playlist parameter is added for you. Everything the dialog produces, the generator produces too – plus the live preview, which the dialog does not offer.
Embed Generator vs. Embed Checker
The site also hosts the YouTube Embed Checker, and the two tools are complementary rather than competing.
| Question | Embed Checker | Embed Generator |
|---|---|---|
| Can this video be embedded at all? | Answers with a verdict – oEmbed, player, and playback probes | Assumes yes and produces the code |
| What is the video's title, author, duration? | Shows them | Does not fetch metadata by design |
| Give me the embed code | No – diagnostics only | Yes, with full option control |
| Check a suspicious link first? | Yes, that is its job | Paste the result straight back in if you like |
Run a link through the checker when you need certainty about embeddability, then through the generator when you need the code. They share the same URL parser, so anything the checker accepts, the generator will parse too.
What It Doesn't Do
- Fetch metadata. The generator never calls the YouTube API, so it cannot pre-fill a title or author. It is a code tool, not an info tool – the checker is the sibling for that.
- Embed playlists. A playlist link is rejected. Playlist embedding is a different feature with its own parameter set, deliberately out of scope for a single-video tool.
- Edit the iframe title. The
titleattribute stays at YouTube's official "YouTube video player". Screen readers get a consistent label, and the output matches what YouTube itself publishes. - Remove related videos. No parameter can do that anymore; see the FAQ.
- Force autoplay to work. Browsers block it, and the tool will not silently add mute to your embed.
- Upload or store anything. Generation is 100% local; see the next section.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| Preview shows YouTube's "video unavailable" message | The video is deleted, private, or region-restricted | The embed will fail on your site exactly the same way – choose another video |
| Autoplay does not start | Browsers block autoplay with sound | Append &mute=1 to the generated src |
| The video plays once and stops | loop=1 lost its playlist partner during hand-editing |
Keep loop=1&playlist=VIDEO_ID together, or regenerate |
| Start or end time is ignored | The end is before the start, or the clip is longer than the video | Check the order of your times and the video duration |
| The player does not render on my site | Your site's Content-Security-Policy blocks iframes | Add frame-src https://www.youtube-nocookie.com https://www.youtube.com to your CSP |
| The player renders but controls are missing | The controls toggle is off | Re-enable "Show player controls" and regenerate |
| Nothing happens when I press Generate | The URL has no video ID | Use one of the accepted formats from the table above |
Privacy & Data Handling
The tool sits in the cleanest category of the site's privacy spectrum: zero requests during generation.
- Generation is fully local. The URL is parsed and the iframe assembled in your browser. No request is sent to any Toollect server, and nothing is logged.
- The preview loads a real player. While the preview is open, your browser talks to YouTube's embed domain exactly as it would on any page that embeds the video.
- The default host is privacy-enhanced. Generated code uses
www.youtube-nocookie.com, where YouTube does not store information about visitors unless they play the video. Disabling the privacy option switches towww.youtube.com– the same player, with the standard tracking behavior – which is what the official dialog always produces.
Technical Specs
- Input formats – watch, embed, shorts, live,
/v/andyoutu.beURLs, nocookie-domain URLs, bare 11-character video IDs. - Output – a single
<iframe>tag with explicit dimensions, accessibility title, permission policy, andallowfullscreen. - Supported parameters –
autoplay,loop+playlist,controls,start,end, plus the host switch for privacy mode. - Aspect ratios – 16:9, 4:3, 3:4, 9:16, 1:1 presets and a free custom mode; counterpart dimension computed with pixel rounding.
- Dimension range – 144 to 3840 pixels, both axes.
- Processing – entirely client-side, no network requests during generation.
- Browser support – any modern browser; the generated code itself works in every browser that renders iframes, which is all of them.
Features
- Generate YouTube iframe embed code from any video URL or bare video ID with one click
- Aspect ratio presets – 16:9, 4:3, 3:4, 9:16 for Shorts, 1:1 and custom – with the counterpart dimension calculated automatically
- Privacy-enhanced youtube-nocookie.com embed domain by default
- Clip a video without editing it – start and end times in hours:minutes:seconds
- Autoplay, loop and player-controls toggles, plus a live iframe preview before you copy
- 100% client-side generation – no API key, no account, nothing uploaded