YouTube Embed Generator

Responsive, privacy-enhanced YouTube embed code with start time and options.

About this tool

Paste a YouTube link (watch, youtu.be, Shorts or live), give the video a title for accessibility, and choose start and end times and options. Copy the iframe code with an optional responsive 16:9 wrapper and the thumbnail URL.

Better YouTube embeds

The default embed code from YouTube is a fixed-size iframe that loads a heavy player immediately and sets cookies before anyone presses play. This generator improves on it. Privacy-enhanced mode (youtube-nocookie.com) avoids cookies until the visitor plays the video, which helps with GDPR and cookie consent. Lazy loading (loading="lazy") defers the player until it scrolls near the viewport, improving page speed and Core Web Vitals. A responsive wrapper uses CSS aspect-ratio to keep 16:9 at any width. A descriptive title lets screen-reader users know what the frame contains. Parameters cover the rest: start and end (from 1:30, 90 or the link's ?t=), autoplay (browsers only allow it muted, so mute=1 is added), loop (which needs the playlist parameter set to the video ID), captions on, controls off and inline playback on iPhones. Honest limits: since 2018, rel=0 only restricts related videos to the same channel rather than hiding them. Some owners disable embedding. Privacy-enhanced mode still contacts YouTube when the video plays, and a click-to-load facade (a thumbnail that loads the player on click) is the most private option. The YouTube description generator, the image srcset generator and the meta tag generator are related.

Frequently asked questions

How do I make a YouTube embed responsive?

Wrap the iframe in a container with aspect-ratio:16/9 and make the iframe fill it. The generator does this.

How do I start a YouTube embed at a specific time?

Add ?start=SECONDS to the embed URL. Enter 1:30 or 90 here.

Why won't my YouTube embed autoplay?

Browsers only allow autoplay with sound muted, so add mute=1, which the generator does for you.

Is anything uploaded or fetched?

No. What you paste is processed in your browser, and nothing is fetched, stored or sent.