YouTube Embed Code Generator

Responsive YouTube embed code with start times, autoplay, looping and privacy mode.

  • SEO Tools
  • Free, no sign-up
  • Runs in your browser

YouTube Embed Code Generator tool

Embed code
The preview loads from YouTube when you press Load preview.

About the YouTube Embed Code Generator

Embedding a video on a website should not mean wrestling with iframe settings or a player that breaks on phones. This YouTube embed code generator turns a normal, short, Shorts, live or playlist link into clean responsive embed code that keeps the video's shape on every screen, with options for start and end times, autoplay, looping, captions and the privacy-enhanced mode that limits tracking until a visitor plays the video. Paste the code into your page or CMS.

Set the options YouTube supports: start and end times to play just one part of a video, autoplay (which browsers only allow when the video is muted), looping, hiding the player controls, turning captions on by default and limiting suggested videos at the end to your own channel. A start time in the link you paste, such as ?t=1m30s, is picked up automatically.

Privacy-enhanced mode is on by default: the video loads from youtube-nocookie.com, which does not store cookies for personalisation until someone presses play, a good choice for cookie-consent rules. Lazy loading keeps pages fast by loading the player only when it scrolls into view. The tool runs in your browser; the preview only contacts YouTube when you ask for it.

To link to a moment instead of embedding, use the YouTube timestamp link generator. To share the video on social networks, try the social share link generator, and for maps, the Google Maps embed generator.

How to use the YouTube Embed Code Generator

  1. Paste the YouTube linkPaste a video, Shorts, live or playlist link. The video ID is found automatically.
  2. Choose the optionsSet start and end times, autoplay, loop, controls, captions and privacy mode.
  3. Pick the sizeKeep it responsive, or set a fixed width and height.
  4. Copy the codeCopy the embed code into your page, or load the preview to check it first.

YouTube Embed Code Generator features

  • Works with watch, youtu.be, Shorts, live and playlist links
  • Responsive 16:9 embeds or fixed sizes
  • Start and end times
  • Autoplay with mute, loop and hidden controls
  • Captions on by default
  • Privacy-enhanced youtube-nocookie.com mode
  • Lazy loading for faster pages
  • Preview on request

Common uses

  • Adding videos to blog posts and landing pages
  • Playing a single clip from a long video
  • Background or looping product videos
  • Embedding playlists in course pages
  • Cookie-friendly embeds for privacy-conscious sites

Embedding YouTube videos in practice: a recipe video on a blog, accessible frames, faster pages with facades, captions, video SEO and Shorts

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

Embedding a video keeps visitors on your page while they watch, and a good embed is responsive, accessible and does not slow the page down. This guide embeds a recipe video in a blog post and covers accessible iframe titles, loading videos only when needed, captions, helping search engines find the video, vertical Shorts and visitor privacy.

A worked example: a recipe video

A food blogger embeds their chicken karahi video in the matching recipe post. The iframe sits inside a container styled with aspect-ratio: 16 / 9; width: 100%; so it fills the column on any screen. It uses the privacy-enhanced youtube-nocookie.com address and a title attribute, Video: Chicken karahi recipe, and it starts at the moment cooking begins, skipping the introduction for readers who have already read the story.

Accessible frames

Screen readers announce an iframe by its title. Without one, users hear only frame, with no idea what it contains. A short, descriptive title such as Video: How to apply for a passport online tells them what the embedded content is before they decide to enter it.

Faster pages with facades

A standard YouTube embed loads a substantial amount of script before anyone presses play, slowing the page, especially on mobile data. A common technique shows the video's thumbnail with a play button and loads the real player only when clicked. Where a facade is not possible, adding loading="lazy" to the iframe delays loading until it is near the screen.

Captions

Captions help viewers watching without sound, people with hearing loss and those following a language they speak less fluently. Uploading accurate captions on YouTube, including Urdu captions for Urdu videos, and enabling them by default with the cc_load_policy parameter where appropriate, makes embedded videos far more accessible.

Helping search engines find the video

Search engines index videos best when the video is the main content of the page, not a decoration beside unrelated text. A clear title, a description and a written summary or transcript on the page, plus VideoObject structured data, help the video appear in video results and give text-based readers the same information.

Vertical Shorts

YouTube Shorts are vertical, so an embed with a 16 by 9 container shows them small with wide black bars. Use a 9 by 16 container for Shorts, limit its width on desktop so it does not tower over the page, and use the standard embed address with the Short's video ID.

Visitor privacy

Privacy-enhanced mode reduces the cookies YouTube sets until a visitor plays the video. Sites serving visitors in regions with strict consent rules may still need consent before loading embeds. A facade showing a thumbnail and a short note before loading the player can satisfy both privacy and performance goals.

Several videos on one page

Pages with many embedded videos, such as course pages, quickly become heavy. Facades matter even more here, or link to videos with thumbnails and load a single player when one is chosen. Visitors rarely watch more than one or two videos per visit.

Common mistakes

  • Embedding videos without an iframe title.
  • Loading several full players on one page.
  • Using 16 by 9 containers for vertical Shorts.
  • Publishing videos without captions or a text summary.

Related tools

To link to specific moments, use YouTube Timestamp Link Generator. To embed a location map in the same way, try Google Maps Embed Generator, and to add video structured data, Schema Markup Generator.

Related videos at the end

When an embedded video finishes, YouTube shows suggestions. Since 2018 the rel parameter can no longer switch them off completely; set to zero, it limits suggestions to videos from the same channel. That keeps viewers with your own content rather than a competitor's.

Clips with start and end times

The start and end parameters play just a section of a longer video, such as a two-minute demonstration within a long lecture. Embedding focused clips beside the relevant text gives readers exactly what the article discusses, without asking them to find the moment themselves.

Embedding other people's videos

Embedding a creator's video through YouTube's player is generally allowed when they have enabled embedding, and views still count for them. Credit the creator in your text, avoid embedding pirated uploads and never download and re-upload someone else's video to your own channel.

Placement in the article

Place the video near the text it supports, often after a short introduction explaining what viewers will see. Readers who prefer text can continue reading, while those who prefer watching find the video exactly where it is most useful.

Mind mobile data

Many visitors watch on mobile data, where long videos use a lot of their allowance. Mention the video's length near the player, and make sure the article stands on its own for readers who choose not to watch, so nobody is forced to stream to get the information.

Privacy

Embed code is generated in your browser. Your video link is not sent anywhere or stored.

Frequently asked questions

How do I embed a YouTube video on my website?

Paste the video link here, choose your options and copy the generated iframe code. Paste it into your page's HTML, or into an HTML or custom code block in your website builder or content management system.

How do I make a YouTube embed responsive?

Keep Responsive selected. The iframe gets a width of 100% and an aspect ratio of 16:9, so it scales with its container on every screen without black bars or fixed pixel sizes.

Why doesn't autoplay work?

Browsers block videos that autoplay with sound. Autoplay only works when the video starts muted, so the tool adds mute automatically when you turn autoplay on. Visitors can unmute it themselves.

How do I start a video at a certain time?

Enter the start time as minutes and seconds, such as 1:30, or paste a link that already contains ?t=90. You can also set an end time so only one section of the video plays.

What is privacy-enhanced mode?

It serves the player from youtube-nocookie.com, which YouTube says does not store information about visitors for personalisation until they play the video. It helps with privacy rules and cookie consent, and works like a normal embed.

How do I loop a single video?

Turn on Loop. YouTube only loops embedded videos that are part of a playlist, so the tool adds the video's own ID as a one-video playlist, which is the standard way to make a single video repeat.

Is my link sent anywhere?

No. The code is generated in this page on your device. YouTube is only contacted if you press Load preview or when visitors view the embed on your site.

Can I embed a YouTube playlist?

Yes. Paste a link that contains list= and the tool embeds the playlist, starting with the video in the link or with the first video of the list. Visitors can then move through the playlist inside the player.