All Tools490+

YouTube Embed Code Generator – Responsive Iframe Code in 3 Easy Steps

YouTube Embed Code Generator

Free YouTube embed code generator – customize your YouTube player settings and generate perfectly formatted iframe codes for your website.

Video & Sizing Settings

Advanced Player Parameters

Generated HTML Code

Live Preview

Enter a YouTube URL and click Generate to see the preview.

YouTube Iframe Parameters & Best Practices

Important Browser Rules

  • Autoplay Restrictions: Modern browsers (Chrome, Safari) will block autoplaying videos that contain sound. To guarantee autoplay works, you must enable the "Mute Video" option.
  • Responsive Embeds: When the responsive option is checked, we wrap the iframe in a <div> with inline CSS to maintain a perfect 16:9 aspect ratio across all screen sizes.

Parameter Quirk Reference

  • Looping: To loop a single video, the YouTube API requires the playlist parameter to be set to the same video ID. Our generator handles this automatically.
  • Related Videos: YouTube removed the ability to hide related videos completely. Unchecking "Show Related" now restricts related videos to only those from the same channel.
Copied to clipboard! ✓

Use this free YouTube embed code generator to create clean, responsive iframe code for any YouTube video in seconds.

Quick answer

Paste a YouTube link (watch, youtu.be, Shorts, live or embed URL), choose your options and click Generate Embed Code. This YouTube embed code generator builds an <iframe> with parameters such as autoplay=1, mute=1, loop=1&playlist=ID, controls=0, rel=0 and start=30. Tick Make Responsive for a 16:9 player that fits every screen. Note: autoplay only works reliably when the video is muted.

YouTube’s own Share → Embed button gives you a basic fixed-size iframe. As soon as you want the video to start at a certain second, loop, play muted in the background or scale nicely on phones, you have to edit the code by hand.

Our free YouTube embed code generator does that for you. Choose the settings with checkboxes, see a live preview and copy ready-to-paste HTML for WordPress, Shopify, Wix, Webflow or any website.

YouTube Embed Parameters Explained

OptionParameterWhat it does
Autoplayautoplay=1Starts playing on page load (needs mute in most browsers)
Mutemute=1Starts with sound off
Looploop=1&playlist=VIDEO_IDRepeats the video – the playlist value is required
Hide controlscontrols=0Removes the player control bar
Related videosrel=0Limits suggestions to your own channel
Start timestart=30Begins at 30 seconds
End timeend=90Stops at 90 seconds
  • youtube.com/watch?v=VIDEO_ID
  • youtu.be/VIDEO_ID
  • youtube.com/shorts/VIDEO_ID
  • youtube.com/live/VIDEO_ID
  • youtube.com/embed/VIDEO_ID
  • Or just the 11-character video ID

How to Use the YouTube Embed Code Generator

Create your embed code in three steps.

Step 1: Paste the Video and Pick Your Settings

Paste the video link into YouTube Video URL. Keep Make Responsive ticked for a 16:9 player, or untick it to set width and height in pixels. Add a start or end time if needed, then choose Autoplay, Mute, Loop, Show Player Controls and Show Related Videos.

Step 1 paste a YouTube video URL and choose player settings in the YouTube embed code generator

Step 2: Generate and Copy the Code

Click Generate Embed Code. The Generated HTML Code box shows the iframe (wrapped in a responsive container if selected) and the live preview loads below. Click Copy HTML Code.

Step 2 generated responsive YouTube iframe embed code ready to copy

Step 3: Paste It Into Your Website

In WordPress, add a Custom HTML block and paste the code. On Shopify or Wix, use the HTML / embed element. Check the parameters and best practices section if autoplay or looping does not behave as expected.

YouTube iframe parameters, autoplay rules and best practices

Tips for Embedding YouTube Videos

  • Use responsive mode so videos do not overflow on mobile.
  • Autoplay + mute for background or hero videos; browsers block autoplay with sound.
  • Lazy loading: add loading="lazy" to the iframe on long pages to keep them fast.
  • Start at the key moment with a start time instead of making visitors scrub.
  • Check embedding permissions – some videos have embedding disabled by the owner.

Is Embedding YouTube Videos Good for SEO?

Embedding a relevant video can keep visitors on your page longer and make content more helpful. Add a short summary or transcript around the video so search engines understand the topic, and avoid loading many videos at the top of one page, which can slow it down.

Need a link that jumps to a moment instead? Use the YouTube Timestamp Link Maker.

Frequently Asked Questions

How do I embed a YouTube video on my website?

Paste the video link into the generator, choose your settings, copy the HTML code and paste it into an HTML block on your site.

Why does my embedded video not autoplay?

Browsers block autoplay with sound. Enable both Autoplay and Mute and it will usually start automatically.

How do I make a YouTube video loop?

Use loop=1 together with playlist set to the same video ID. The generator adds both automatically.

Can I hide related videos completely?

No. rel=0 now only limits suggestions to videos from the same channel.

Does it work with YouTube Shorts and youtu.be links?

Yes. Watch, youtu.be, Shorts, live and embed links, or a plain 11-character video ID, are all supported.

Is the YouTube embed code generator free?

Yes. It is free, runs in your browser and needs no sign-up.

MH

Written and tested by Muhammad Hasnain

Founder of VectraTools. Behaviour described here was checked against the tool’s own output. Last reviewed: October 2026.