YouTube Embed Code Generator

Create custom responsive embed codes for any video instantly. Boost your website engagement for free. Try it now for free!

Default: 560

Default: 315

Most people copy the embed code from YouTube's share menu, paste it into their site, and wonder why it looks wrong or why it's not doing what they need it to do. The default YouTube embed is fine for basic use, but it doesn't give you any real control over how the video looks or behaves.

That's where a YouTube embed code generator saves you a lot of time and frustration.

What You'll Learn in This Post

1What a YouTube embed code actually is and how it works
2Why the default YouTube embed often isn't enough
3How to generate a fully customised embed code in seconds
4The embed parameters most people don't know about (but really should)
5How to embed YouTube videos into WordPress, Squarespace, Wix, and plain HTML

What Is a YouTube Embed Code?

When you embed a YouTube video on a website, you're not uploading the video to your site you're borrowing it from YouTube. The embed code is a small piece of HTML that tells your website to load and display a specific YouTube video inside an inline frame (called an iframe) on your page.

Every part of that code does something. The width and height set the player size. The src URL points to your video. And the allow attributes control what the player is permitted to do things like autoplay or going fullscreen. Change any of those values, and you change how the video behaves on your site.

<iframe width="560" height="315"
  src="https://www.youtube.com/embed/VIDEO_ID"
  frameborder="0"
  allow="accelerometer; autoplay; clipboard-write;
         encrypted-media; gyroscope; picture-in-picture"
  allowfullscreen>
</iframe>

How to Use a YouTube Embed Code Generator - Step by Step

Using the generator takes about 20 seconds. Here's how it works:

Play (Space)
Previous 10 seconds (J)
Next 10 seconds (L)
Mute (M)
0:00 / 0:00
Picture in Picture (P)
Settings
More Options
Fullscreen (F)

Step 1: Grab your YouTube video URL

Go to the YouTube video you want to embed and copy the URL from the browser address bar it'll look like https://www.youtube.com/watch?v=dQw4w9WgXcQ. Shortened youtu.be links work too.

Step 2: Paste the URL into the generator

Drop your URL into the input field. The tool automatically pulls the video ID from whatever URL format you've pasted.

Step 3: Choose your embed settings

Set your width and height, toggle autoplay on or off, choose whether to start muted, set a start time if needed, and decide whether to show or hide player controls.

Step 4: Copy your embed code

Click generate, and your customised embed code is ready to copy. Paste it wherever you need it directly into your HTML into your CMS's custom code block or into a page builder widget.

Why Not Just Use YouTube's Built-In Share Button?

You can. And for a quick, no-fuss embed, it works fine. But YouTube's default share embed gives you almost no control. You get a fixed size, no option to remove related videos at the end, no autoplay toggle, and no way to set a start time without manually editing the URL.

If you're embedding videos professionally on a business site, a course platform, a portfolio, or a blog you probably want more than the default gives you.

Here's what a YouTube embed code generator lets you control that YouTube's own tool doesn't:

Custom dimensions

Set the exact width and height to fit your layout - not just YouTube's default 560×315.

Autoplay

Have the video start playing as soon as the page loads - useful for landing pages and hero sections.

Muted start

Autoplay only works in browsers when the video starts muted - this matters more than most people realise.

Loop

Make the video repeat automatically - great for background videos or product demos.

Start time

Link directly to a specific moment in the video - perfect for long interviews or tutorials.

Hide controls

Remove the playback bar for a cleaner visual element without the timeline, volume button, or YouTube branding.

Disable related videos

Stop YouTube from showing competitor content at the end of your video.

Responsive sizing

Make the embed automatically resize on mobile so it never looks broken on small screens.

The YouTube Embed Parameters You Actually Need to Know

Here's a plain-English breakdown of the most useful YouTube embed parameters the values you can add to the embed URL to control how the player behaves.

autoplay=1

Starts the video automatically when the page loads. Note: browsers block autoplay with sound by default, so you'll almost always need to pair this with mute=1 for it to work reliably.

mute=1

Starts the video without sound. Essential for autoplay embeds. Also useful for background video sections where you want visual movement without noise.

loop=1

Makes the video repeat indefinitely. You need to also add playlist=VIDEO_ID (using the same video ID) for the loop to work properly.

start=30

Skips to a specific point in the video in this case, 30 seconds in. Great for long videos where you want to highlight a specific section.

controls=0

Hides the YouTube player controls entirely. Useful if you want the video to play as a clean visual element without the timeline, volume button, and YouTube branding.

rel=0

Stops YouTube from showing related videos from other channels at the end of your video. Since 2018, this shows related videos from your own channel instead still much better than sending viewers to competitors.

modestbranding=1

Removes the YouTube logo from the control bar. The YouTube watermark in the corner can't be fully removed, but this reduces visible branding while the video is playing.

fs=0

Disables the fullscreen button. Most people leave this enabled, but if you're building a tightly controlled UI, you might want to prevent fullscreen.

How to Make Your YouTube Embed Responsive

One of the most common problems with YouTube embeds is that they're fixed-size by default. Set the width to 560px and it'll be 560px on every screen including a 375px wide phone where it'll be cut off or broken.

Making an embed responsive means it resizes automatically to fit the screen it's being viewed on. The most reliable approach is the CSS wrapper method:

CSS wrapper

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

HTML structure

<div class="video-container">
  <!-- your iframe
       embed code here -->
</div>

The 56.25% padding = 16:9 ratio (9 ÷ 16 × 100). Use 75% for 4:3 video.

How to Embed YouTube Videos on Different Platforms

W

WordPress

  • 1.In the Gutenberg block editor, paste the YouTube URL directly into a paragraph block and press Enter WordPress auto-converts it to an embed.
  • 2.For customised embeds (autoplay, no related videos, start time), use a Custom HTML block and paste your generated embed code directly.
  • 3.In the Classic Editor, switch to Text view and paste your embed code where you want the video to appear.
  • 4.In page builders like Elementor or Divi, use an HTML or Custom Code widget.
S

Squarespace

  • 1.For basic embeds, use a Video Block just paste your YouTube URL and it handles the rest.
  • 2.For customised embeds, use a Code Block instead go to Edit, add a new block, search for 'Code', and paste your generated embed code into the code editor.
  • 3.Make sure 'Display Source' is turned off in the Code Block settings.
  • 4.Note: Code Blocks are only available on Business plans and above Personal plans are limited to the standard Video Block.
X

Wix

  • 1.Wix has a built-in YouTube widget, but it has limited customisation options.
  • 2.For fully customised embeds, use the Embed HTML element: go to Add → Embed → Embed a Widget.
  • 3.Paste your generated code into the HTML editor and resize the element on the canvas to match your video's dimensions.
  • 4.Note: iframes inside Embed HTML are sandboxed, so some features like autoplay may behave differently. Test on both desktop and mobile before publishing.

YouTube Embed vs YouTube Link: What's the Difference?

A YouTube link takes someone away from your website to watch the video on YouTube.com. That's traffic you're losing and on YouTube they'll immediately get served suggestions for other videos, other channels, and potentially your competitors.

An embed keeps the visitor on your page. The video plays directly within your site. You control the experience around it the context, the call to action, the next step you want them to take. According to data from Wistia, videos embedded directly on landing pages can increase conversion rates by up to 86% compared to driving people to a separate video platform.

For most marketing use cases product pages, blog posts, course content, testimonials embedding is almost always the right call. Keeping people on your page matters.

Common YouTube Embed Problems (and How to Fix Them)

The video shows a black box or doesn't load

Usually a private or age-restricted video. YouTube only allows embedding of public videos. Check the video's privacy settings and make sure embedding is enabled under the video's advanced settings.

Autoplay isn't working

This is a browser restriction, not a YouTube problem. Chrome, Firefox, Safari, and Edge all block autoplay with sound. Add mute=1 to your embed URL alongside autoplay=1 and it'll work.

The embed looks tiny on mobile

You have a fixed width. Use the CSS wrapper method or set width="100%" to make it responsive.

Related videos are showing at the end

Add rel=0 to your embed URL. Since 2018, this shows related videos from your own channel rather than hiding them entirely still much better than showing competitors.

The video is cropped or has black bars

Your iframe dimensions don't match the video's aspect ratio. Most YouTube videos are 16:9 use dimensions like 560×315, 640×360, or 1280×720.

Make the Most of Your Embedded Videos

Embedding the video is just step one. If you're using YouTube as part of a broader content or marketing strategy, there are a few other things worth doing alongside it.

Check your YouTube video stats to understand how a video is performing before featuring it prominently on your site view count, engagement, and likes all signal how much confidence you can have in a video resonating with your audience.

Use the YouTube video description generator to make sure every video you publish has an optimised description that drives people back to your site. And if you want to see how your thumbnails look in context before a video goes live, the YouTube thumbnail preview tool shows you exactly how your thumbnail will appear in search results and recommended feeds.

Frequently Asked Questions













More Free YouTube Creator Tools

YouTube Channel Stats

Check subscriber counts, views, and upload frequency for any channel to ensure you're featuring content with real reach.

Try Tool

YouTube Tag Generator

Generate SEO tags for your own videos, so the content you're embedding gets found in search results more easily.

Try Tool

Transcript Generator

Extract the full transcript from any YouTube video, useful for repurposing content alongside embedding it on your site.

Try Tool

YouTube Video Stats

Check views, likes, and engagement on any video before deciding it's worth embedding on your site.

Try Tool

Thumbnail Downloader

Download the thumbnail from any video, useful for creating a custom preview image alongside your embed.

Try Tool

YouTube Thumbnail Preview

See how a video's thumbnail and title look in search results, a quick way to judge quality before embedding.

Try Tool

Grow Your Channel with Premium Tools

Unlock AI-powered similar thumbnail search, outlier finder, content generator, and more. Everything you need to rank higher, get more clicks, and build an audience that sticks.