UPDATED AUGUST 2026 · VERIFIED DATA

YouTube Embed Guide: Complete 2026 Setup & Parameters

Getting the embed code takes ten seconds. Getting it right takes knowing which parameters actually still work, and that the default embed can quietly cost your page 2MB and a worse Core Web Vitals score before anyone even presses play.

By Fawad Ullah Aug 2026 11 min read YouTube developer docs, 2026

Most YouTube embed tutorials teach the same three clicks — Share, Embed, Copy — and stop there. That part hasn't changed in years. What has changed, repeatedly and quietly, is which of the parameters people still copy-paste from 2019-era blog posts actually do anything anymore.

This covers the current embed process, exactly which parameters still function in 2026 versus which ones are dead weight in your URL, how to make the embed responsive, and the one performance issue almost no basic guide mentions: a standard YouTube embed can meaningfully hurt your Core Web Vitals score before a single visitor clicks play.

Quick Answer

To embed a YouTube video: open it, click Share → Embed → Copy, then paste the iframe code into your page. Two commonly recommended parameters are dead — modestbranding was deprecated in August 2023 and does nothing, and rel=0 has only limited related videos to the same channel since September 2018, not removed them. For performance, standard embeds can add 1.3–2.6 MB and 20+ requests before playback even starts, which hurts LCP and INP — the fix is a click-to-play "facade" placeholder that loads the real player only when clicked.

Basic Embed Steps

1

Get the embed code

Open the video on YouTube, click Share below the player, select Embed from the options, then click Copy to save the HTML iframe code.

2

Paste it into your site

Drop the copied iframe directly into your HTML source, a CMS embed block, or a WordPress custom HTML block, then save and publish.

3

Confirm embedding is allowed

If the embed shows an error, check the video's Advanced Settings in YouTube Studio to confirm "Allow embedding" is turned on — most videos have it on by default unless the uploader specifically disabled it.

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

Parameters That Actually Work in 2026

Append these to the embed URL after a ?, joining multiple with &. All of these are confirmed current in YouTube's own IFrame Player API reference.

ParameterWhat it doesExample
autoplayStarts playback automatically (needs mute=1 in most browsers)autoplay=1
muteStarts the video mutedmute=1
controlsShows or hides player controlscontrols=0
start / endSets playback start and stop time in secondsstart=15&end=90
loop + playlistLoops a single video (needs playlist set to the same ID)loop=1&playlist=VIDEO_ID
playsinlinePlays inline instead of fullscreen on iOSplaysinline=1
hlSets the player interface languagehl=es
cc_load_policyShows captions by defaultcc_load_policy=1
enablejsapiRequired before any JavaScript player API calls will workenablejsapi=1
list + listTypeEmbeds a full playlist instead of one videolistType=playlist&list=PLAYLIST_ID

Parameters That Stopped Working (But Are Still Everywhere)

This is the part most embed guides skip, and it's why so many sites still carry parameters doing absolutely nothing.

modestbranding=1 — dead since August 15, 2023

Per Google's own IFrame Player API reference, this parameter is officially deprecated and has no effect. The player now decides its own branding based on size and other signals. If a tutorial tells you this removes the YouTube logo, it hasn't been updated in three years.

rel=0 — only partially works since September 2018

Before 2018, rel=0 removed related videos entirely. Today it only restricts suggestions to videos from the same channel as the one just played. There is no current parameter that hides end-of-video suggestions completely.

showinfo, theme, autohide — all deprecated

showinfo stopped hiding the video title back in 2018. theme and autohide are both ignored entirely on the current HTML5 player. Delete all three if you find them in older embed code — they're pure noise in the URL.

Making the Embed Responsive

A fixed-width iframe breaks on mobile. The classic fix uses a padding trick to force a 16:9 ratio at any screen size — modern CSS offers a simpler one-line alternative too.

.video-wrap { position: relative; width: 100%; padding-top: 56.25%; /* 16:9 ratio */ } .video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; } /* Modern alternative — current browsers only */ .video-wrap-modern { aspect-ratio: 16 / 9; width: 100%; } .video-wrap-modern iframe { width: 100%; height: 100%; border: 0; }
Note: The padding-hack method has near-universal browser support and is the safer default. The aspect-ratio property is cleaner code but only works in modern browsers — check your site's actual visitor base before relying on it alone.

Privacy-Enhanced Mode

Standard YouTube embeds set tracking cookies the moment the page loads, which can be a compliance problem under GDPR-style cookie-consent rules for sites with EU visitors.

Swap the domain, not the code

Replace youtube.com with youtube-nocookie.com in the embed's src URL. This prevents YouTube from storing cookies on a visitor's browser until they actually press play — everything else about the embed works exactly the same.

The Performance Problem (And the Fix)

This is the part almost no basic embed tutorial covers, and it's the single biggest information gap for anyone embedding video on a content-heavy or commercial page.

Standard embed cost

Page weight added1.3 – 2.6 MB
HTTP requests20+
Main-thread JS time~480ms (mobile)
Cost paidEven if never played

loading="lazy" alone

Fixes upfront weight?No — only delays it
Cost when scrolled into viewFull weight still loads
Best forBelow-the-fold embeds only
The real fix: the facade pattern

Show a lightweight static thumbnail image styled to look like the video player, with a play button overlay. Only load the actual iframe when a visitor clicks it. This means near-zero cost for visitors who never press play, and full playback for those who do — the open-source lite-youtube-embed component implements this in a few lines and is roughly 224x lighter than a standard embed until clicked.

<div class="yt-facade" data-id="VIDEO_ID" style="background-image:url('https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg')"> <button class="yt-play-btn" aria-label="Play video"></button> </div> <script> document.querySelector('.yt-facade').addEventListener('click', function() { const id = this.dataset.id; this.innerHTML = '<iframe src="https://www.youtube-nocookie.com/embed/' + id + '?autoplay=1" allow="autoplay; encrypted-media" allowfullscreen></iframe>'; }); </script>
Illustrative example
Note: Figures below are a composite, illustrative comparison based on the performance data above, not a verified single-site case study.

Facade pattern vs. standard embed

~2.0MBStandard embed, page load
~9KBFacade thumbnail, page load
0Requests until visitor clicks play

The video still plays exactly the same once clicked — the difference is entirely in what loads before anyone asks for it.

Troubleshooting Common Errors

  • "Video unavailable" or blank player: the uploader has disabled embedding in YouTube Studio's Advanced Settings for that specific video
  • Age-restricted videos: cannot be embedded on external websites at all — this is a hard platform restriction, not a settings toggle
  • Works in some countries, not others: the uploader or a rights holder has applied a regional block that also affects embeds in those regions
  • Autoplay silently fails: almost always a missing mute=1 alongside autoplay=1 — browsers block unmuted autoplay by default
  • API calls not firing: check that enablejsapi=1 is present in the embed URL before any JavaScript player control will work

Need the video ID or a thumbnail image first?

Grab the exact video ID or download a clean thumbnail image for your facade placeholder in seconds.

Frequently Asked Questions

How do I get the embed code for a YouTube video?
Open the video on YouTube, click Share below the player, select Embed from the list of options, then click Copy to save the HTML iframe code to your clipboard. Paste that code directly into your site's HTML or embed block.
Does modestbranding=1 still hide the YouTube logo?
No. According to Google's own IFrame Player API reference, modestbranding was deprecated on August 15, 2023, and has no effect. The player now decides its own branding based on size and other factors. Any tutorial still recommending this parameter to remove the logo has not been updated since 2023.
Does rel=0 hide related videos at the end of an embed?
Not fully. Before September 2018, rel=0 removed related videos entirely. Since that update, rel=0 only limits suggested videos to ones from the same channel as the video that just played. There is no current parameter that removes end-of-video suggestions completely.
Why does autoplay not work on my embedded YouTube video?
Every major browser blocks autoplay with sound by default. Add both autoplay=1 and mute=1 to the embed URL together — muted autoplay is permitted, autoplay with sound generally is not.
How do I make a YouTube embed responsive?
Wrap the iframe in a container with position: relative and padding-top: 56.25% (for 16:9 video), then set the iframe itself to position: absolute with width and height at 100%. Modern CSS can also use aspect-ratio: 16 / 9 on the container as a simpler alternative in current browsers.
What is YouTube's privacy-enhanced mode?
Privacy-enhanced mode uses youtube-nocookie.com instead of youtube.com in the embed URL. It prevents YouTube from storing cookies on a visitor's browser until they actually press play, which helps with cookie-consent compliance on sites serving EU visitors.
Do YouTube embeds actually slow down my website?
Yes, measurably. Independent testing found a single standard YouTube iframe can add roughly 1.3 to 2.6 MB of page weight and over 20 HTTP requests before a visitor ever presses play, which directly affects Largest Contentful Paint and Interaction to Next Paint scores.
How do I embed YouTube without hurting Core Web Vitals?
Use the facade pattern: show a lightweight clickable thumbnail image in place of the real iframe, and only load the actual YouTube player when a visitor clicks it. Native loading="lazy" alone only delays the cost until the iframe scrolls into view — it does not eliminate it. The open-source lite-youtube-embed component implements this pattern in a few lines of code.
Why does my embedded video say "video unavailable"?
The most common cause is the video owner has disabled embedding in YouTube Studio under the video's advanced settings. Age-restricted videos also cannot be embedded on external sites at all, and some videos are blocked in specific countries by the uploader or a rights holder, which will show as unavailable for visitors in those regions.
Can I embed a full YouTube playlist instead of a single video?
Yes. Replace the video ID in the embed URL with the list and listType parameters instead — for example, using listType=playlist and list=PLAYLIST_ID. This loads the entire playlist in the embedded player rather than a single video.

The embed code itself was never the hard part — three clicks gets you there. What actually separates a clean implementation from a sluggish, cookie-firing, half-broken one is knowing which parameters quietly stopped working years ago, and treating the iframe's page-weight cost as a real design decision rather than something YouTube handles for you.

FU
Written by
Fawad Ullah
Founder, YT Money Calculator — Content Researcher & Educator

Fawad is an educator and researcher who built YT Money Calculator to give YouTube creators — especially in Pakistan and South Asia — accurate, honest earnings data. He has spent significant time studying CPM rates, RPM benchmarks, and the YouTube Partner Program to create tools that reflect real-world creator economics, not inflated estimates. More about Fawad →