YouTube Embed Code Generator

Paste any YouTube video URL and instantly get a ready-to-use iframe embed code. Customize size, autoplay, controls, loop, and privacy settings in one click.

Video Size

× px

Playback Options

Start Time

seconds (0 = play from beginning)

Preview

🔗
All URL Formats
Accepts youtube.com/watch, youtu.be, /embed/, and YouTube Shorts links
🎥
Live Preview
See exactly how the embedded video will appear before you paste the code
🔒
Privacy Mode
Use youtube-nocookie.com to prevent YouTube from setting tracking cookies
🌏
Full Control
Set size, autoplay, loop, start time, and controls with one click

Generated Code Examples

Basic embed (560x315, controls visible):
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Autoplay + muted + loop:
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&mute=1&loop=1&playlist=dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="autoplay; accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Privacy-enhanced mode (youtube-nocookie.com):
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Embed YouTube Videos on Any Website

Embedding a YouTube video on a webpage should take seconds, but tracking down the right iframe syntax and remembering all the available query parameters is slower than it looks. This generator takes any YouTube URL and produces a complete, copy-paste-ready iframe tag. It handles all common URL formats including youtube.com/watch, the short youtu.be links, and YouTube Shorts, so you never have to manually extract a video ID or look up the embed endpoint.

The options panel covers everything YouTube's embed API supports: video dimensions (four standard presets or fully custom), autoplay, show or hide the player controls, loop playback, start the video muted, allow fullscreen, and enable privacy-enhanced mode. When privacy mode is on, the embed uses youtube-nocookie.com instead of youtube.com, which means YouTube will not set cookies on your visitors until they actually play the video. This is useful for GDPR compliance and reducing third-party cookie warnings.

After clicking Generate, a live preview lets you see the embedded player exactly as it will appear on your page before you copy the code. The start time field lets you specify a point in the video to begin from, in seconds, which is useful when you want to link a viewer to a specific segment rather than the beginning of a long video.

How to Embed a YouTube Video

  1. Copy the video URL: Open the YouTube video you want to embed. Copy the URL from the address bar, or right-click the video player and choose Copy video URL.
  2. Paste it into the tool: Paste the URL into the input field. The tool accepts youtube.com/watch, youtu.be, /embed/, and Shorts links.
  3. Choose your size: Pick one of the four standard aspect-ratio sizes (560x315 is the most common for blog posts), or select Custom and enter your own width and height in pixels.
  4. Set playback options: Toggle autoplay, loop, muted start, or privacy mode depending on your use case. Autoplay requires Muted to be checked in most browsers.
  5. Set a start time (optional): Enter a number of seconds to start the video partway through. Leave it at 0 to play from the beginning.
  6. Generate and copy: Click Generate Embed Code, then use the Copy Code button or click Preview to see it rendered before using it on your page.