YouTube Embed Code Generator
Build clean, responsive YouTube embed code. Toggle start and end time, autoplay, mute, loop, controls, and privacy-enhanced (nocookie) mode, then copy the iframe with a live preview.
Why creators choose YouTube (YT) Toolkit over VidIQ & TubeBuddy
- 100% free - no subscription tiers or hidden usage limits on core tools.
- No login / no account - paste a URL and run instantly.
- No browser extension - full web app on mobile, tablet, and desktop.
What is a YouTube embed code generator?
This tool builds the <iframe> code you paste into a web page to display a YouTube video. Instead of memorizing player parameters, you toggle options — responsive sizing, start and end time, autoplay, mute, loop, controls, privacy mode — and copy ready-to-use code with a live preview.
The default output is responsive and privacy-friendly: it scales to any screen and uses the youtube-nocookie.com domain so tracking cookies are not set until a visitor plays the video.
How to generate YouTube embed code
- Paste the video URL — Any watch,
youtu.be, or shorts link. - Pick your options — Responsive or fixed size, start/end time, autoplay, mute, loop, controls, privacy mode, and whether to hide related videos.
- Preview and copy — Confirm the player looks right in the live preview, then copy the iframe or download it as an HTML snippet.
Embed options explained
- Responsive — Wraps the player in a 16:9 container so it fills its parent width on every device.
- Privacy (nocookie) — Uses
youtube-nocookie.comto defer cookies until playback, useful for consent and GDPR. - Start / end time — Adds
start=andend=in seconds to play only a segment. - Autoplay & mute — Autoplay is paired with mute automatically because browsers block unmuted autoplay.
- Loop — Restarts the video using the required
loop=1plusplaylist=VIDEOIDcombination. - Controls & related — Hide the control bar or reduce related-video suggestions with
rel=0.
Tips for embedding responsibly
Use privacy mode on sites that show a cookie banner. Avoid autoplay with sound — it frustrates visitors and hurts engagement. For a segment rather than the whole video, set a start and end time; if you only need to link (not embed) to a moment, use the Timestamp Link Generator instead.
Related tools
Combine this with the Timestamp Link Generator for shareable jump links, the Thumbnail Downloader to grab the poster image, and Video Statistics to check a video before you feature it.
Frequently asked questions
How do I embed a YouTube video on my website?
Paste the video URL above, choose your options, and copy the generated iframe code. Paste that code into your page’s HTML where you want the player to appear. The responsive option keeps the video sized correctly on phones, tablets, and desktops without extra CSS.
What is youtube-nocookie.com and should I use it?
youtube-nocookie.com is YouTube’s privacy-enhanced embed domain. It delays setting tracking cookies until the visitor actually plays the video, which helps with privacy and consent requirements such as GDPR. The tool enables it by default; you can turn it off if you specifically need standard youtube.com embeds.
How do I make a YouTube embed responsive?
Keep the Responsive option on. It wraps the iframe in a container with a 56.25% bottom padding (the 16:9 aspect ratio) and absolutely positions the player to fill it. The video then scales to the width of its parent element on any screen size.
Can I set a start and end time for the embedded video?
Yes. Enter a start time and optional end time in seconds. The tool adds start= and end= parameters to the embed URL, so the player begins and stops at those points.
Why does autoplay only work when the video is muted?
Most browsers block autoplay with sound to protect users. When you enable autoplay, the tool automatically adds mute=1 so the video can start on load. Viewers can unmute manually.
How do I loop a YouTube embed?
Turn on Loop. For a single video, YouTube requires both loop=1 and playlist=VIDEOID, which the tool adds for you automatically so the video restarts when it ends.
More product questions are answered on the home FAQ. For privacy or advertising topics, see our Privacy Policy.