Videoyoutube.com/watch

Can you embed YouTube in an iframe?

Yes, with the embed URL from Share, Embed. YouTube documents the youtube.com/embed/{video-id} URL for iframes, not the watch page.

Checked Test again

Live check

Two links, two results

Result of
Watch pageEmbeddable
www.youtube.com/watch?v=jNQXAC9IVRw
X-Frame-Options
Not sent
CSP frame-ancestors
Not sent
Response
429 Too Many Requests · 341 ms · HTTPS
Embed URLEmbeddable
www.youtube.com/embed/jNQXAC9IVRw
X-Frame-Options
Not sent
CSP frame-ancestors
Not sent
Response
200 OK · 131 ms · HTTPS

Steps

How to embed YouTube

  1. Open the video or playlist on YouTube.
  2. ClickSharethenEmbed
  3. Copy the HTML code from the box.
  4. Paste the code into the HTML of your page.

Embed code

Paste this into your page

HTML
<iframe
  width="560"
  height="315"
  src="https://www.youtube.com/embed/{video-id}"
  title="{video title}"
  frameborder="0"
  allow="autoplay; encrypted-media"
  allowfullscreen>
</iframe>

For privacy-enhanced mode, change the host to www.youtube-nocookie.com. The rest of the URL stays the same.

URL patterns

Swap the link you have for the embed URL

  • You haveyoutube.com/watch?v={video-id}Use in the iframeyoutube.com/embed/{video-id}
  • You haveyoutube.com/playlist?list={playlist-id}Use in the iframeyoutube.com/embed?listType=playlist&list={playlist-id}

Add player parameters to the embed URL as a query string. For example, ?start=90 starts the video at 1:30.

Good to know

  • The owner can turn off "Allow embedding" in YouTube Studio. Then the video does not play in a frame.
  • Age-restricted videos cannot play on most other websites.
  • Error 153 means the request has no HTTP Referer header. Do not set referrerpolicy="no-referrer" on the iframe.
  • The player must be at least 200 by 200 pixels. YouTube recommends 480 by 270 pixels or more for 16:9.
  • Embedded videos that play automatically do not count as views.

Sources

Profile updated

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.