Tools/Links & utilities

YouTube Embed Code Generator

Paste a video URL and the options you want, and get the exact iframe embed code back, plus a responsive wrapper, with a warning if autoplay is on but mute is off.

Input
s

Seconds into the video. Leave at 0 to start from the beginning.

Autoplay
Mute
Loop
Show player controls
Privacy-enhanced mode (youtube-nocookie.com)
Embed
Embed code
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
Responsive wrapper
<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
  <iframe style="position:absolute;top:0;left:0;width:100%;height:100%;" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>

Autoplay only works in most browsers when the video is muted too, so turn on Mute alongside it.

  • Free · no signup
  • Runs in your browser
  • Shows the working
What this does

Paste a video URL and set the options you want, start time, autoplay, mute, loop, controls, privacy mode, and we return the exact iframe embed code, plus a responsive wrapper for a fluid layout.

If autoplay is on but mute is off, we flag it: most browsers block unmuted autoplay, so the video would just sit paused until clicked.

Use cases
  1. 01Get embed code right the first time instead of debugging a broken autoplay setting.
  2. 02Drop a responsive player into a page without writing the wrapper CSS by hand.
  3. 03Use privacy-enhanced mode to embed without YouTube setting cookies until playback starts.
FAQ

Questions, answered.

Why won't my autoplay video actually play?

Most browsers block autoplay with sound. Turn on Mute alongside Autoplay and it will play automatically.

Do I need an account?

No.

What's the difference with privacy-enhanced mode?

It serves the player from youtube-nocookie.com, which avoids setting tracking cookies on your page until someone actually presses play.

From the notebook
Related tools