Skip to content
T
Tools.Town
Free Online Tools for Everyone
<iframe>

YouTube Embed Code Generator

100% Free

Generate responsive YouTube embed code with autoplay, mute, loop, start time, and privacy-enhanced mode — copy-paste ready iframe HTML.

No Sign Up
100% Free
Easy to Use
Mobile Responsive

1. Video & embed options

Paste any YouTube video URL (watch?v=…, youtu.be/…, shorts/, or embed/).

2. Your embed code

<div style="position:relative;padding-top:56.25%;height:0;overflow:hidden">
  <iframe style="position:absolute;inset:0;width:100%;height:100%;border:0"
    src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ"
    title="YouTube video player"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
    referrerpolicy="strict-origin-when-cross-origin"
    allowfullscreen></iframe>
</div>

Live preview

Embed This Tool

Easy to Embed

Add YouTube Embed Code Generator to your website or blog in seconds.

  • Responsive design
  • Lightweight & fast
  • No backend required
  • Always up-to-date
<iframe
  src="https://tools.town/embed/youtube-embed-generator/"
  width="100%"
  height="600"
  style="border:none; border-radius:12px;"
  loading="lazy"
  title="YouTube Embed Code Generator">
</iframe>

Share This Tool

Share Instantly

Share YouTube Embed Code Generator with anyone — no login required.

  • Shareable link
  • No login required
  • Works on any device
  • No account needed

Share via

Advertisement

How to Use

  1. 1 Paste the YouTube video URL into the input field
  2. 2 Toggle options — responsive wrapper, autoplay, mute, loop, start time
  3. 3 Copy the generated iframe HTML or WordPress-style shortcode
  4. 4 Paste the code into your site, CMS, or HTML file
  5. 5 Use Live Preview to confirm the player looks right

Features

  • Responsive 16:9 wrapper that scales on mobile
  • Autoplay, mute, loop, and start-at-time parameters
  • Privacy-enhanced youtube-nocookie.com domain
  • Fixed width/height mode when you need pixel control
  • Live embed preview before you copy
  • 100% client-side — your URL never leaves the browser

Why it Matters

Embedding a YouTube video should not mean fighting iframe attributes or broken mobile layouts. A good generator turns a pasted URL into clean, standards-compliant HTML with the exact player behaviour you want — autoplay for hero sections, nocookie for GDPR-friendly pages, or a responsive wrapper so the video never overflows on phones.

★★★★★

Use Cases

Bloggers

Drop responsive embeds into posts without a plugin

Educators

Embed lessons with start times and controls disabled

E-commerce

Add product demos with autoplay-muted hero players

Developers

Prototype landing pages with copy-paste iframe snippets

Generate the iframe embed code for any YouTube video — responsive, with the options you need.

Common embed parameters

ParameterEffect
autoplay=1Start playing on load (requires mute=1 in modern browsers)
mute=1Start muted
start=90Begin at 90 seconds
loop=1&playlist=VIDEO_IDLoop the video
controls=0Hide player controls
rel=0Limit related videos to the same channel

Append them to the embed URL with ? and join multiple with &.

Privacy note

When Privacy-enhanced mode is enabled, the iframe loads from youtube-nocookie.com, which delays cookies until the viewer interacts with the player — a common choice for GDPR-conscious sites.

Frequently Asked Questions

How do I get the embed code for a YouTube video?
Paste the video URL into this tool. It extracts the video ID and builds an iframe pointing at youtube.com/embed/VIDEO_ID (or youtube-nocookie.com when privacy mode is on). Copy the HTML and paste it into your page.
How do I make a YouTube embed responsive?
Enable the Responsive option. The tool wraps the iframe in a 16:9 container (padding-top: 56.25%) so the player scales with your layout instead of using fixed pixel dimensions.
Can I autoplay or start a YouTube embed at a specific time?
Yes. Turn on Autoplay (mute is added automatically because browsers require it), and set Start time as mm:ss or raw seconds. The generator appends ?autoplay=1&mute=1&start=90 to the embed URL.
Can I embed private YouTube videos?
No. Only public videos (or unlisted videos you have access to while logged into YouTube) can be embedded. The embed code will not work for private uploads.
Is the generated code free to use?
Yes. The HTML is yours to paste anywhere. No account or API key is required.

Related Tools You Might Like

Browse more free tools