YouTube Embed Code Generator

Create the embed code of a YouTube video with your own settings

Options

Paste a video URL, choose your options and click Generate. You get the HTML code to paste into your website and a live preview of the player.

How to use the YouTube Embed Code Generator

  1. Paste the URL of the video.
  2. Set a width and height, or leave them empty to use the default 560 × 315.
  3. Optional: set a start time and an end time in minutes and seconds.
  4. Tick the options you need.
  5. Click Generate, check the preview, then click Copy the code.

What each option does

  • Loop video – the video restarts when it ends.
  • Autoplay (muted) – playback starts when the page loads. Browsers only allow autoplay without sound, so the code also mutes the video.
  • Hide Full-screen button – removes the full-screen icon from the player.
  • Hide player controls – hides the control bar.
  • Privacy enhanced – loads the player from youtube-nocookie.com, so cookies are only set once the visitor starts the video.
  • Responsive – the player scales to the width of its container and keeps its proportions on phones.

Where to paste the code

Paste it wherever your site accepts HTML: a Custom HTML block in WordPress, an HTML or embed element in page builders such as Wix or Squarespace, or directly in your template.

Good to know

  • Choose Responsive if your visitors use phones. A fixed 560-pixel player overflows on small screens.
  • In the EU and UK, the privacy-enhanced mode makes cookie consent easier to handle.
  • Some uploaders disable embedding. If the preview shows “Video unavailable”, the owner has blocked playback on other sites.
  • Views from embedded players count as views when a person starts the video.

Frequently asked questions

Can I embed any YouTube video?

Any public or unlisted video whose owner allows embedding. Private videos cannot be embedded.

Does embedding a video slow down my page?

The player loads extra scripts. Add loading="lazy" to the iframe if the video is far down the page.

Can I start the video at a precise moment?

Yes. Fill in the start time; the generated code includes it.

Related tools