My Tool Studio
YouTube

YouTube Embed Code Generator

This YouTube embed code generator builds ready-to-paste player code from a video, Shorts, playlist or channel link, with a live preview. Set a start and end time, pick an aspect ratio such as 16:9 or 9:16 for Shorts, and choose from more than a dozen player options, including autoplay, mute, loop, controls, captions, player language and privacy-enhanced mode. Output comes in six forms: a responsive iframe, a click-to-load version that keeps pages fast, WordPress, React, Markdown and the bare player URL. Bloggers use it to embed a YouTube video in HTML on builders that strip the share code. Developers use it for responsive YouTube embed code without writing a CSS wrapper by hand. Every option maps to a standard YouTube player parameter, so nothing is hidden.

Always freeNo sign upRuns in your browser

Video, youtu.be, Shorts, live and playlist links work. A UC channel ID embeds that channel's uploads.

How to use

01

Paste a link

Enter a watch, youtu.be, Shorts, live or playlist link, a video ID, or a UC channel ID. A t= time in the link fills Start at, and Shorts links switch the player to 9:16.

02

Set size, times and options

Choose Aspect ratio, Max width and Sizing, type Start at and End at as 1:30 or seconds, then tick the Player options you want. The preview reloads with each change.

03

Copy the format you need

Pick HTML, Click to load, WordPress, React / JSX, Markdown or Player URL, then press Copy. Download .html saves a test page with the player on it.

Why YouTube Embed Code Generator

YouTube embed parameters reference

Every option is a query parameter on the player's src URL. The tool sets these for you and shows the finished URL on the Player URL tab, so you can check exactly what was added.

ParameterWhat it doesIn this tool
autoplay=1Starts playing on load (muted only, in most browsers)Autoplay
mute=1Starts with the sound offStart muted
start=90, end=120Plays from 1:30 and stops at 2:00Start at, End at
loop=1 and playlist=IDReplays the video when it endsLoop sets both
controls=0Hides the player controlsShow player controls
rel=0Related videos at the end come from the same channelRelated videos checkbox
cc_load_policy=1, cc_lang_pref=enShows captions, in a chosen languageCaptions on, Captions language
hl=frSets the player's menu languagePlayer language
playsinline=1Plays inline on iPhone instead of going fullscreenPlay inline on iPhone
disablekb=1, fs=0Turns off keyboard shortcuts or the fullscreen buttonTwo checkboxes
iv_load_policy=3, color=whiteHides annotations, makes the progress bar whiteTwo checkboxes
enablejsapi=1Lets your own script control the playerEnable JavaScript API

Embedding in WordPress, Blogger, React and plain HTML

The same player works anywhere that accepts raw HTML. What changes is where you paste it and which output tab you copy.

  • WordPress block editor: copy the WordPress tab and paste it in the code editor, or paste the HTML tab into a Custom HTML block.
  • Blogger: switch the post editor to HTML view and paste the HTML or Click to load tab.
  • Plain HTML: paste the iframe where the player should appear. The click-to-load version needs its script too.
  • React and Next.js: the React / JSX tab uses allowFullScreen, referrerPolicy and a style object, so it compiles as is.
  • READMEs and docs: Markdown cannot hold an iframe, so the Markdown tab gives a clickable thumbnail instead.
  • If the video looks tiny or stretched, check Sizing is responsive and that no theme CSS sets a fixed iframe height.

Keeping pages fast with several videos

Each YouTube iframe pulls in the player's scripts, styles and fonts, even if nobody presses play. One video rarely matters, but a tutorial page with five embeds can feel slow on a phone.

Two options in this tool help. Lazy-load, on by default, adds loading="lazy" so browsers wait until the player scrolls near the screen. Click to load goes further: it shows the thumbnail and a play button, and only builds the real player after a click, at which point it starts playing straight away.

Common questions

Why does autoplay not work in my YouTube embed?
Browsers block autoplay with sound, so tick both Autoplay and Start muted. Chrome, Safari and Firefox will start a muted video on their own, and the viewer can unmute it. The tool warns you when Autoplay is on without mute.
How do I make a YouTube embed responsive?
Leave Sizing on Responsive (CSS aspect-ratio). The iframe gets width 100% and an aspect ratio, so it shrinks on phones and stops growing at your max width. If you support very old browsers, choose the padding wrapper option, which uses the classic padding-bottom trick instead.
What does privacy-enhanced mode change in the YouTube embed code?
It swaps www.youtube.com for www.youtube-nocookie.com in the player URL. YouTube says this mode limits the information it stores about visitors until they play the video. The other options keep working the same way.
Can a YouTube embed start and stop at set times?
Yes. Type Start at and End at as seconds, 1:30 or 1m30s. The tool adds start= and end= in seconds, and warns if the end is before the start. Paste a link with t= in it and the start time is filled in for you.
What is the click-to-load YouTube embed and why use it?
It shows the video's thumbnail with a play button and only loads YouTube's player when someone clicks. A normal iframe loads YouTube's player scripts as soon as the page opens, so the click-to-load version helps page speed on posts with several videos. Paste the whole block, including the short script at the end.
How do I embed a YouTube playlist or a whole channel?
Paste a playlist link or its PL ID and the tool uses the videoseries player. For a channel, paste its UC channel ID or /channel/ link and the tool embeds the channel's uploads playlist, which starts with UU. If you only have an @handle, find the UC ID first with the YouTube Channel ID Finder.
What does the Loop option add to the YouTube embed URL?
For a single video, YouTube's loop only works with a playlist parameter holding the same video ID, so the tool adds both loop=1 and playlist=VIDEO_ID. For a playlist, loop=1 alone repeats the whole list.
How do I embed a YouTube video in WordPress with these options?
Copy the WordPress output and paste it into the block editor's code view, or add a Custom HTML block and paste the iframe. The standard YouTube embed block ignores most of these options, which is why the raw iframe is useful. In the classic editor, switch to the Text tab first.
Why do I see 'playback on other websites has been disabled'?
The uploader has turned off embedding for that video, and no embed code can override it. The video will only play on youtube.com, so link to the watch page instead or pick another video.
Should I hide the controls on an embedded YouTube video?
Unticking Show player controls adds controls=0, which suits short background-style clips. For anything people actually watch, keep controls on, because removing play, seek and volume makes the video harder to use and less accessible.

More YouTube tools

View all