YouTube Embed Code Generator

Convert any YouTube video, Shorts, playlist, or channel URL into a responsive HTML <iframe>, GDPR-safe youtube-nocookie player, or high-speed Core Web Vitals facade.

Developer & Creator Reference

How to Generate Responsive YouTube Embed Codes for Videos, Shorts & Channels

Master official YouTube IFrame Player API parameters, GDPR privacy mode, and zero-lag click-to-play facades.

How to Generate Embed Code for YouTube Videos, Shorts & Channels

To generate a custom YouTube embed code, paste any YouTube video URL, Shorts link, playlist URL, or channel @handle into our YouTube Embed Code Generator above, choose Responsive (Fluid) or a fixed pixel size, toggle player options like Autoplay, Loop, or Privacy-Enhanced Mode, and click Copy Code.

While YouTube's default Share → Embed popup only hands you a rigid 560×315 pixel snippet that overflows smartphone screens and lacks loop, end-time, or Shorts formatting, our advanced generator builds standards-compliant HTML, React JSX, direct embed URLs, and Core Web Vitals facades in real time.

  1. Choose your source mode & paste the link: Select Video / Shorts, Playlist Embed, or Channel Uploads Embed and paste your link—vertical /shorts/ links automatically switch the player to a 9:16 aspect ratio.
  2. Configure layout, timing & controls: Set optional Start and End timestamps, enable youtube-nocookie.com privacy mode, and customize autoplay, mute, loop, and same-channel recommendations (rel=0).
  3. Test live & copy your preferred snippet: Preview the interactive player right on the page, then copy the HTML Iframe, CWV Speed Facade, Embed Link Only, or React / JSX code.

Responsive YouTube Embed Code (16:9 & 9:16 Shorts) vs. Fixed Pixels

A standard YouTube iframe uses hard-coded width="560" height="315" attributes. On a 375-pixel mobile viewport, that fixed player breaks your layout unless you wrap it in a responsive container:

  • Modern CSS aspect-ratio (Recommended): Our responsive generator uses native CSS aspect-ratio: 16 / 9 (or 9 / 16 for YouTube Shorts) with width: 100%. Every modern browser reserves the exact vertical height before the iframe loads—eliminating Cumulative Layout Shift (CLS) without messy padding-bottom: 56.25% hacks.
  • Vertical YouTube Shorts embeds (9:16): Standard youtube.com/shorts/VIDEO_ID URLs cannot be placed directly inside an <iframe src="..."> because YouTube blocks framing on the /shorts/ route. Our tool converts Shorts links to the official /embed/VIDEO_ID endpoint and applies a centered 9:16 vertical frame.
  • Fixed pixel presets: Working inside an email template, legacy CMS widget, or fixed-width desktop sidebar? Switch to Fixed Pixels (px) for instant 560×315, 640×360, 853×480, 1280×720, or 1920×1080 dimensions.

Advanced YouTube Embed Parameters Reference Table

Every checkbox in our advanced YouTube embed code generator maps to a supported query parameter in Google's official IFrame Player API (note that legacy parameters like showinfo=0 and autohide=1 were deprecated by YouTube):

ParameterValuesWhat It Controls & Browser Rules
autoplay & muteautoplay=1&mute=1Starts playback automatically on load. Chrome, Safari, and iOS require mute=1 for unprompted autoplay.
loop & playlistloop=1&playlist=VIDEO_IDRepeats a single video infinitely. YouTube requires passing the video's own 11-character ID in playlist= for single-video looping to work.
start & endPositive integers (seconds)Begins playback at start seconds and stops automatically at end seconds—ideal for highlighting a specific chapter or clip.
rel0 or 1Setting rel=0 restricts pause and end-screen suggested videos strictly to the same YouTube channel instead of competitors.
controls0 or 1Setting controls=0 hides the bottom timeline scrubber and control bar for clean background or hero videos.
cc_load_policy1Forces closed captions / subtitles to appear automatically even if the viewer has captions turned off by default.
disablekb & colordisablekb=1, color=whiteDisables keyboard shortcuts (Space, arrow keys) or switches the scrubber bar from red to minimalist white.

How to Embed a YouTube Channel's Latest Uploads or Playlist

Want your homepage or press kit to always display your newest upload without editing HTML every week? Use our YouTube channel embed code generator mode:

  • How the UC → UU Uploads Playlist trick works: Every YouTube channel has a permanent 24-character ID starting with UC (such as UCX6OQ3DkcsbYNE6H8uQQuVA). Replacing the leading UC with UU (UUX6OQ3DkcsbYNE6H8uQQuVA) points to that channel's public Uploads playlist.
  • Automatic @handle resolution: When you select Channel Uploads Embed above and enter any @handle or channel URL, our tool resolves the UC... ID automatically and builds the /embed/videoseries?listType=playlist&list=UU... player.
  • Standard playlists (PL...): Switch to Playlist Embed and paste any course, podcast, or music playlist link (?list=PL...) to embed a multi-video player with an interactive playlist drawer in the top-right corner.

GDPR Privacy Mode (youtube-nocookie.com) & Core Web Vitals Speed Facades

Standard YouTube embeds hurt both privacy audits and Google PageSpeed Insights scores unless you optimize how they load:

  • Privacy-Enhanced Mode (GDPR & CCPA): Enabling youtube-nocookie.com prevents Google from setting marketing and analytics cookies on your webpage until a visitor explicitly clicks Play.
  • The 900 KB iframe performance tax: A single standard <iframe> downloads roughly 800 KB–1.2 MB of third-party JavaScript (base.js) before the visitor even scrolls to the player, increasing Total Blocking Time (TBT) and slowing down mobile pages.
  • Zero-JS Click-to-Play Facade: Select the CWV Speed Facade tab above to get a self-contained HTML snippet that loads only the lightweight 1280×720 thumbnail from i.ytimg.com and swaps in the live autoplaying iframe on click—keeping Lighthouse Performance at 99–100.

Embedding on WordPress, Webflow, Notion & Connected YouTube Tools

  • WordPress (Gutenberg, Elementor & Classic): Add a Custom HTML block and paste either the HTML Iframe or CWV Speed Facade code. Using a standard Embed URL block? Copy the Embed Link Only tab instead.
  • Webflow, Framer, Ghost & Shopify: Drop an Embed element onto your canvas and paste the responsive 16:9 or 9:16 snippet, or copy the React / JSX tab directly into Next.js, Remix, and Astro components.
  • Complete your YouTube web workflow: Need a custom high-CTR poster image for your click-to-play facade? Download the native 1280×720 cover in WebP or PNG with our YouTube Thumbnail Downloader and test how it looks in dark and light feeds with the YouTube Thumbnail Previewer. You can also create direct chapter share links using the YouTube Timestamp Link Generator, place a high-converting ?sub_confirmation=1 button below your embedded player with the YouTube Subscribe Link Generator, extract full video bios and chapters via the YouTube Description Extractor, inspect competitor keywords with our YouTube Tag Extractor, look up permanent UC... IDs in the YouTube Channel ID Finder, and estimate ad revenue using the YouTube Money Calculator.

Creator Toolkit

Explore More Free Tools

Browse our complete suite of YouTube creator utilities by workflow category. View full directory →

FAQ

Frequently Asked Questions

Select Responsive (Fluid) in our generator above. It wraps the YouTube iframe in a container with modern CSS aspect-ratio: 16 / 9 (or 9 / 16 for Shorts) and width: 100%, allowing the video player to scale smoothly across smartphones, tablets, and 4K monitors without black bars or horizontal scrollbars.

Modern web browsers—including Google Chrome, Safari, Edge, and iOS/Android mobile browsers—block unmuted videos from autoplaying without prior user interaction. Enabling both autoplay=1 and mute=1 guarantees your embedded video starts playing immediately upon page load.

Switch to the Channel Uploads Embed tab above and enter any @handle, channel URL, or 24-character UC... Channel ID. Our tool converts the channel ID prefix from UC to UU (YouTube’s built-in Uploads Playlist ID) and generates an embed/videoseries?list=UU... player that updates automatically whenever the creator publishes a new video.

Since September 2018, YouTube no longer allows third-party embeds to disable end-screen suggestions completely. However, enabling rel=0 (checked by default in our generator) restricts pause and end-screen recommendations strictly to videos from the same YouTube channel rather than competitor channels.

When Privacy-Enhanced Mode (youtube-nocookie.com) is enabled, YouTube does not store tracking or personalization cookies in your visitor’s browser unless they actively click Play on the video—making it essential for GDPR and ePrivacy compliance on European websites.

Switch to the CWV Speed Facade tab in the code output box. Instead of loading ~900 KB of YouTube JavaScript on initial page load, the facade displays a lightweight static thumbnail with a play button and injects the iframe only when clicked.