Tools
PDF Tools 34
Image Tools 5
AI Writing 13
Text Tools 13
SEO and websites 22
YouTube and video 13
Calculators and converters 17
Developer Tools 13
Other tools 2
Scanner Blog
Language

YouTube Embed Code Generator

Create responsive iframe embed code with start-time controls.

Related tools

All tools in this group
Illustration of a YouTube video turned into HTML embed code

A YouTube video in your page, at the right size

YouTube's "Share" then "Embed" button gives you iframe code with a fixed width of 560 and height of 315, so the video looks small on a computer or spills past a phone screen. Jood's YouTube Embed Code Generator gives you responsive code that fills the width of wherever you put it and keeps the video's proportions, with the playback options you need.

How to use it

  1. Paste the link in the "YouTube Video URL" box. Normal links, short links and Shorts links all work.
  2. To start at a given moment, fill in "Start Time (Seconds)", and if needed "End time (in seconds, optional)". Two and a half minutes is 150 seconds.
  3. Pick the "Aspect Ratio": 16:9 for a regular video, 9:16 for Shorts, or 4:3 and 1:1.
  4. Tick the options you want and click "Start Now". A preview of the video appears with the code below it; copy it with the "Copy Result" button.

What the options do

  • Show player controls: ticked by default. Untick it and the playback bar disappears, which suits a short background clip better than a tutorial.
  • Autoplay: browsers block video with sound until the visitor clicks, so the tool mutes the video with this option; otherwise it would not start.
  • Mute: the video starts silent and the visitor turns the sound up.
  • Loop the video: it starts over when it ends. YouTube needs a playlist for this, so the tool adds the video itself as a one-item playlist.
  • Privacy mode: uses the youtube-nocookie.com domain. According to YouTube, the embedded video is not used to personalise the visitor's recommendations, and no cookies are stored until they press play. Handy if your site asks visitors to consent to cookies.

Why the code works anywhere

The code puts the iframe in a box that is 100% wide, with its proportions fixed by the CSS property aspect-ratio. No library or stylesheet is needed, so it works in a WordPress Custom HTML block, in Blogger or in a page you write by hand. A 9:16 video stays at most 360 pixels wide and centred, so it does not take over the height of a computer screen. The iframe only loads when the visitor gets close to it, so it does not slow down the first view of the page. That also means an autoplay video near the bottom of a page starts when the visitor reaches it.

Before you publish

  • The video's owner can switch off embedding, in which case an error message shows instead of the video. Check the preview before publishing.
  • Embedding does not copy the video to your server: it stays on YouTube and the views count for the owner's channel.

To get its thumbnail, use the YouTube Thumbnail Downloader, and for its numbers, YouTube Video Statistics.