Free tool — runs in your browser

YouTube embed code generator

Generate a YouTube iframe with the options that matter: start time, autoplay, mute, loop and privacy-enhanced mode, then copy the HTML into your page.

Video

Options

Browsers only allow this when the player is muted, so mute is forced on.

Adds the playlist parameter too — loop does nothing without it.

Serves from youtube-nocookie.com, which delays cookies until playback.

How to generate and place the embed

An embed is one iframe element whose behaviour is configured entirely through the query string on its src. Get the src right and the rest is ordinary HTML.

  1. Paste the video URL. Only the id is used, so it does not matter which link form you copied.
  2. Set a start time if you want the player to open partway in, and an end time if you only want a section.
  3. Turn on the options you need. Autoplay, mute and loop interact with each other, so the tool adjusts the others when you change one.
  4. Switch on privacy-enhanced mode if the page has a consent banner, then copy the HTML.
  5. Paste it into your page inside a container that controls the width, rather than leaving the fixed pixel dimensions in place.
  6. Load the page on a phone as well as a desktop, and check the player is not overflowing its column.

The attributes and parameters that matter

Parameters go on the src URL; attributes go on the iframe element. Mixing the two up produces markup that looks right and quietly does nothing.

  • The player URL is youtube.com/embed/VIDEO_ID, and the privacy form is youtube-nocookie.com/embed/VIDEO_ID. Everything else hangs off that as a query string.
  • start and end take whole seconds, counted from the beginning of the video.
  • autoplay=1, mute=1 and controls=0 are each on or off, expressed as 1 or 0.
  • loop=1 needs playlist set to the same video id beside it, which is why the generated code carries the id twice.
  • allowfullscreen on the iframe is what gives the viewer the fullscreen button; without it the control is missing.
  • A title attribute on the iframe is what a screen reader announces. An untitled frame is a straightforward accessibility failure and a common audit finding.
  • loading="lazy" defers the player until it is near the viewport, which is usually the single biggest win available on a page with an embed below the fold.

What goes wrong

Embed snippets get copied between projects for years, so most broken embeds are carrying parameters that stopped doing anything long ago.

  • showinfo=0 has done nothing since 2018. It is still pasted around constantly because it used to hide the title bar.
  • modestbranding is no longer honoured either, so a snippet promising a logo-free player is out of date.
  • Leaving width="560" height="315" in place. Those numbers are from the copy-paste snippet and they overflow a narrow column; a 16:9 wrapper with a percentage width is the fix.
  • Autoplaying with sound and wondering why nothing starts. The browser is refusing, silently, and there is no error to find.
  • Putting an embed above the fold on a page whose performance matters. The player pulls a lot of script before anyone has decided to watch.

When an iframe is the wrong shape

An embed is a whole third-party application dropped into your page. That is a fair trade for a page whose point is the video, and a poor one everywhere else.

  • On a page with several videos, embed a facade instead: show the thumbnail, and swap in the iframe on click. The thumbnail downloader gives you the image URL to do it with.
  • If the video is incidental to the page, a link with a timestamp is lighter and often more useful than a player nobody presses.
  • If you need the video to be part of a product experience rather than a page, the IFrame Player API gives you playback control that query parameters cannot.
  • If you are self-hosting for control over branding or data, none of this applies and a native video element is the starting point.
The rest of the job

You just fixed one post. Now do the month.

The youtube embed code generator solves one piece of one post. OctoSpark plans, writes and schedules the whole calendar across every network you use, publishes it for you, and reports what actually performed.

  • One calendar for every network
  • Schedule once, publish everywhere
  • Drafts written in your own voice
  • See what actually performed
Open the full sign-up page

No card needed. These tools stay free either way.

Frequently asked questions

How this tool works, what it cannot do, and what happens to what you put into it.

  • Why does autoplay need mute?

    Every modern browser blocks autoplaying video with sound, because it is hostile to the person reading the page. Setting mute=1 is the only way an autoplay embed reliably starts; the viewer can unmute it themselves.
  • Why does loop need a playlist parameter?

    loop=1 on its own does nothing for a single video. YouTube implements looping as "replay the playlist", so you have to pass playlist set to the same video id to give it a one-item playlist to repeat. This tool adds it automatically when you turn loop on.
  • What does privacy-enhanced mode change?

    It serves the player from youtube-nocookie.com, which holds off on storing cookies until the visitor actually plays the video. It reduces what is set on page load, which matters for consent banners, but it is not full anonymity, because playback is still a request to Google.
  • Why does my embed show related videos from other channels?

    YouTube removed the option to switch related videos off. rel=0 no longer hides them; it only narrows suggestions to the same channel where possible. Any tool promising to remove them entirely is out of date.
  • Is my data private?

    Yes. This tool does its work in your browser, so whatever you type, paste or upload stays on your device. Nothing is sent to our servers, which is also why it keeps working if you go offline after the page has loaded.
  • Is this really free?

    Yes. Every tool here is free with no account, no credit card and no usage cap. They exist so that the people who need our scheduling product find us, which only works if the tools are genuinely useful on their own.
  • Do I need an account?

    No. Open the page and use it. An account is only for OctoSpark itself, where you plan, schedule and publish a whole calendar rather than fixing one post at a time.
  • Can I use the output commercially?

    Yes. Anything you produce here is yours, including for client and commercial work. We claim no rights over it and we do not watermark it.