What YouTube video embed code looks like
YouTube video embed code is an HTML iframe that loads YouTube's player on your page. Vimeo's works the same way. This is the code the tool writes, with a placeholder for the video:
<iframe src="https://www.youtube-nocookie.com/embed/VIDEO_ID" title="YouTube video player" style="display:block;width:100%;aspect-ratio:16/9;border:0" loading="lazy" referrerpolicy="strict-origin-when-cross-origin" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
srcis the player's address. The video ID and the player's options go here.titlelabels the frame for screen readers.stylemakes it responsive: the full width of its container, at a fixed shape, with no extra CSS or script.loading="lazy"waits until the player nears the screen, so a page with a video further down loads faster.referrerpolicysets the policy YouTube recommends. YouTube blocks playback with error 153 when the request has no Referer.allowgives the player permission for features such as autoplay and picture-in-picture. This is the list YouTube's own embed code uses, and Vimeo's code has its own.allowfullscreenlets the full screen button work. Vimeo's code listsfullscreeninallowinstead.
Which options actually work
Checked on November 4, 2026 against YouTube's player parameters, YouTube's embed help, Vimeo's player parameters and Vimeo's embed options.
| Option | YouTube | Vimeo | What to expect |
|---|---|---|---|
| Start time | start=90, whole seconds | #t=1m30s, after the address | Works on both. |
| Autoplay | autoplay=1 | autoplay=1 | Chrome and other browsers block autoplay with sound until the visitor has interacted with your site, so it needs mute. Vimeo says it might not work on all devices. YouTube says autoplayed embeds do not add to view counts. |
| Mute | mute=1. Not on YouTube's parameter list. It worked in our Chrome test on November 4, 2026, but YouTube does not promise it. | muted=1 | Chrome says muted autoplay is always allowed. Vimeo says some browsers need muted for autoplay. |
| Loop | loop=1&playlist=VIDEO_ID | loop=1 | YouTube calls loop support in iframes limited, and needs the video's own ID in playlist. The tool adds it. In our Chrome test both players looped, and each pass restarted from the very beginning, not from the start time. |
| Hide controls | controls=0 | controls=0, on Creator, Core, Professional, Studio or Enterprise accounts | On Vimeo this also hides play and pause, so pair it with autoplay. Keyboard controls stay on. |
| Privacy | www.youtube-nocookie.com | dnt=1 | YouTube says views will not shape the viewer's YouTube experience and ads will not be personalized. It does not say that no cookies are set. Vimeo says dnt stops session tracking and also blocks your video stats, and some essential cookies stay active. |
| Lazy loading | loading="lazy", a browser feature, the same on both | The browser waits until the player nears the screen. It only defers when JavaScript is on. | |
| Aspect ratio | CSS aspect-ratio, the same on both | This sets the shape of the frame, not the video. If the two differ, the player adds black bars. | |
What does not work
- Autoplay with sound. Expect browsers to block it on a visitor's first visit. In our Chrome test, a YouTube embed with
autoplay=1and no mute did not start, and a Vimeo embed started muted by itself. That is why this tool only offers it muted. modestbranding=1. YouTube has deprecated it, and it has no effect. The player decides its own branding.showinfo=0. YouTube ignores it, so it cannot hide the title.rel=0. It no longer turns off related videos. It only limits them to the same channel.- A form or banner on top of a YouTube player. YouTube's embedded player rules do not allow overlays in front of the player. The same rules set a minimum player size of 200 by 200 pixels, recommend 480 by 270 or more for 16:9, and ask that a page run one autoplaying player at a time, starting it only once more than half of the player is on screen.
VideoObject JSON-LD: what a generator can and cannot do
VideoObject JSON-LD describes a video to Google in a block of code on your page. Google requires three fields: name, thumbnailUrl and uploadDate. It recommends others, including description, duration, and contentUrl or embedUrl.
A generator cannot get the thumbnail or upload date for you unless you enter them. They live with YouTube or Vimeo, and reading them would mean calling a remote API, which this page does not do. The rest of the markup is only as true as what you type.
- Put it on a watch page. Google says to create a dedicated watch page for each video where that makes sense, and that a blog post reviewing an embedded video is not one.
- Add a time zone to the upload date. Without one, Google uses Googlebot's.
- Use a stable thumbnail address. Googlebot must be able to fetch it. Google accepts BMP, GIF, JPEG, PNG, WebP, SVG and AVIF.
- Keep it consistent with the video. Google asks that the markup match the actual video.
- Do not expect a guarantee. Valid markup makes a video eligible for video features, but it does not promise them.
Frequently Asked Questions
How do I get the embed code for a YouTube video?
Paste the video's address into the generator above and copy the code. You can also use Share, then Embed, on YouTube itself. Both give you an iframe. This tool also makes it responsive and can add lazy loading, muted autoplay and loop.
Why does my embedded video not autoplay?
Browsers block autoplay with sound until the visitor has interacted with your site. Muted autoplay is allowed, so this tool adds mute whenever autoplay is on. Vimeo also says autoplay might not work on all devices, and YouTube says autoplayed embeds do not add to view counts.
How do I make a YouTube embed responsive?
Set the iframe to width:100% and give it a CSS aspect-ratio, such as 16/9. It then fills its container and keeps its shape on any screen. The code this tool writes does that in one inline style, with no extra CSS or script.
How do I start an embedded video at a certain time?
On YouTube, add start= with the time in whole seconds, so start=90 begins at 1:30. On Vimeo, add #t=1m30s after the address. Type the time above as 90, 1:30 or 1m30s and the tool writes the right form for each player.
How do I loop a YouTube embed?
To loop one video, YouTube says to add loop=1 and set playlist to the same video ID. The tool adds both when you turn on Loop. YouTube calls loop support in iframes limited, so test it on your page. In our test, each pass restarted from the very beginning, not from the start time.
What does youtube-nocookie.com do?
It turns on YouTube's privacy-enhanced mode. YouTube says views of the embed will not shape the viewer's experience on YouTube, and that ads shown in this mode are not personalized. YouTube's page does not say that no cookies are set, so include it in your own privacy review.
Why does my YouTube embed show error 153?
YouTube blocks playback when the request has no HTTP Referer header, and viewers see error 153. We saw it in two cases: on a page with a no-referrer policy, and when an HTML file was opened directly from a computer instead of a web server. The code here sets referrerpolicy to strict-origin-when-cross-origin, the policy YouTube recommends, which fixed the first case. For the second, test on a web server.
Can this tool get the thumbnail and upload date for me?
No. A generator cannot get the thumbnail or upload date for you unless you enter them. This page calls no remote API, so it reads nothing from YouTube or Vimeo. Copy both from your video's page or your own records.
What fields does Google require in VideoObject JSON-LD?
Google requires name, thumbnailUrl and uploadDate. It recommends others, including description, duration, and contentUrl or embedUrl. The upload date should include a time zone, or Google uses Googlebot's. Valid markup makes a video eligible for video features, but it does not guarantee them.
Is anything I paste sent to OTTEngine?
No. JavaScript in your browser builds the code, and this page calls no API. The preview is the real player, so once you enter a YouTube or Vimeo address your browser loads it from them, as it would on your own page. Any other address loads only if you press Load preview.