🧩 YouTube Embed Code Generator
Build clean, responsive 16:9 embed code for any public YouTube video with only the player parameters YouTube currently supports.
✅ Free · No sign-up
Embed code
Live preview
How to use the YouTube Embed Code Generator
- Paste the video link.
- Choose start/end times and player options. The code and preview update instantly.
- Copy the HTML into your site builder’s HTML/embed block, or download it as a snippet file.
Example
- Input
- https://youtu.be/dQw4w9WgXcQ, start 0:30, privacy mode
- Output
- <iframe src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?start=30&rel=0" …>
Why creators use it
- Embed your latest video on a blog post without layout shift on mobile.
- Use privacy-enhanced mode for sites that care about cookie consent.
- Clip a segment of a long video for a course page using start and end times.
Good to know
- Browsers block autoplay with sound, so autoplay is always combined with mute.
- Loop needs the playlist parameter; the generator adds it automatically.
- The rel=0 option no longer hides related videos completely; YouTube shows related videos from the same channel.
- Privacy-enhanced mode reduces, but does not remove, data YouTube collects once a viewer presses play.
Frequently asked questions
Is the generated code valid HTML?
Yes. The generator checks the iframe has a valid embed URL, a title for screen readers and the allow/referrerpolicy attributes YouTube recommends.
Can I embed private videos?
No. Private videos cannot be embedded. Unlisted videos can, and owners can disable embedding for any video.
What does privacy-enhanced mode do?
It uses the youtube-nocookie.com domain, which does not store cookies on your visitors’ devices until they interact with the player.