YouTube embed code generator: iframe code with the options you need
Paste a YouTube video or playlist link, pick the player options, and copy the iframe code. It handles start and end times, autoplay, looping a single video, captions on by default, hidden controls, privacy-enhanced mode on youtube-nocookie.com and a responsive 16:9 player that fills its container. The code is built in your browser from YouTube's documented player parameters.
How YouTube embed code works
An embedded YouTube video is an iframe whose address is https://www.youtube.com/embed/ followed by the video ID. Everything else you can change is a parameter added to that address: ?start=90 to begin at a minute and a half, &autoplay=1 to play on load, &cc_load_policy=1 to show captions. YouTube's own Share and Embed button gives you the basic iframe; this generator adds the options YouTube documents but does not offer in that box.
The generator accepts every common link format: watch links, youtu.be short links, Shorts, live and embed links, or a bare 11-character video ID. If the link carries a timestamp, such as t=1m30s, it becomes the start time. If it carries a playlist, you can embed the whole playlist instead of the single video.
What each option does
Start and end set the part of the video that plays, in seconds from the beginning of the video. YouTube notes that the player seeks to the nearest keyframe, so playback can begin up to about two seconds early. Autoplay starts the video when the page loads; YouTube's help page says autoplayed embeds do not increment the video's view count, and browsers often block autoplay with sound, so test it on your own page before relying on it. Loop replays the video at the end; for a single video YouTube requires the playlist parameter to be set to the same video ID, which the generator does for you.
Captions on forces closed captions to show even if the viewer has turned them off, and a caption language picks the track. Hiding controls removes the play bar, which suits a background clip but makes the video hard to pause, so use it sparingly. The rel option no longer hides related videos: since September 2018, rel=0 only limits them to the same channel. The old modestbranding parameter was deprecated in August 2023 and has no effect, so the generator leaves it out.
Privacy-enhanced mode and responsive sizing
Privacy-enhanced mode swaps www.youtube.com for www.youtube-nocookie.com. According to YouTube, a view in that player is not used to personalise the viewer's YouTube experience or the ads they see elsewhere, and any ads shown on the video are non-personalised. It is a sensible default for blogs, documentation and any site that has to think about consent banners.
A fixed 560 by 315 iframe overflows a phone screen. The responsive option sets the iframe to the full width of its container and keeps a 16:9 shape with the CSS aspect-ratio property, so it fits any column. YouTube asks for a player of at least 200 by 200 pixels and recommends at least 480 by 270 for 16:9 players, so do not squeeze it into a narrow sidebar.
When an embed will not play
Three things stop embeds most often. The owner can untick Allow embedding in YouTube Studio, and then no code will work. Age-restricted videos cannot be watched on most third-party sites and send the viewer back to YouTube. And YouTube now requires embedding pages to send an HTTP Referer header; without it the player shows error 153. The generated code includes referrerpolicy="strict-origin-when-cross-origin" so the browser sends your site's origin, but a server or plugin that strips the header will still cause the error.
If your site is aimed at children, YouTube requires you to self-designate it as child-directed even when you use privacy-enhanced mode. And if you are embedding your own videos to grow a channel, the same long-form documentaries and explainers Cliptude makes for YouTube embed like any other video.
Frequently asked questions
How do I get the embed code for a YouTube video?
Paste the video link into the generator and copy the iframe code. On YouTube itself, click Share, then Embed, and copy the code from the box.
How do I make an embedded YouTube video start at a certain time?
Add ?start= followed by the time in seconds to the embed address, for example ?start=90 for 1:30. The generator does this from a start time or from a t= timestamp in the link.
How do I loop an embedded YouTube video?
Add loop=1 and set the playlist parameter to the same video ID, as YouTube's player documentation requires for a single video.
Can I hide related videos at the end?
No. Since September 2018, rel=0 only limits related videos to the same channel; they cannot be turned off.
What is privacy-enhanced mode?
An embed served from youtube-nocookie.com. YouTube says views in it are not used to personalise the viewer's YouTube experience or ads.
Why does my embedded video show error 153?
The page did not send an HTTP Referer header, which YouTube requires for embedded playback. Make sure nothing on your site strips it.
Sources checked 22 October 2026: YouTube Help: Embed videos & playlists · YouTube IFrame Player API: Embedded players and player parameters
Related: YouTube thumbnail downloader · YouTube transcript generator
Make the video, not just the plan
Cliptude turns a topic or script into a finished 16:9 faceless YouTube video, up to an hour long, with voiceover, footage, animated maps and charts. It is a paid product with no free plan; watch the sample videos to judge the output first.
Free creator tools
YouTube money calculator · Channel name generator · Tags generator · Script length calculator · RPM calculator · Shorts money calculator · TikTok money calculator · Instagram money calculator · Engagement rate calculator · YouTube engagement rate calculator · Speech time calculator · Script timer · Thumbnail tester and preview · Title checker · Handle checker · Embed code generator · Thumbnail downloader · Long-form AI video generator · YouTube inauthentic content policy · All tools