YouTube Embed Code Generator
Generate responsive iframe embed code with start time, autoplay, and privacy mode
π YouTube URL or Video ID
βοΈ Player Options
π Sizing
π Live Preview
Paste a YouTube URL or video ID to preview the embed
π» Embed Code
About the Free YouTube Embed Code Generator
Our free YouTube embed code generator turns any YouTube link into clean, copy-ready HTML in seconds. Paste a watch URL, a youtu.be short link, a Shorts link, or a plain 11-character video ID, and the tool instantly builds a valid iframe with the exact player options you choose: start time, autoplay, mute, loop, hidden controls, modest branding, and more.
The standout feature is the responsive YouTube embed mode, enabled by default. Instead of a fixed-width iframe that overflows on phones, the generator wraps the player in a padding-bottom container that keeps a perfect 16:9 aspect ratio at any screen width. That is the same technique used by professional publishers, and it works in every modern browser with zero JavaScript.
Privacy matters too. One checkbox switches the embed code to YouTube's privacy-enhanced youtube-nocookie.com domain, which delays tracking cookies until the visitor actually plays the video, a common requirement for GDPR-conscious sites. Optional lazy loading adds the loading="lazy" attribute so the iframe only loads when scrolled into view, improving page speed and Core Web Vitals.
Key Features
- Accepts every common YouTube URL format: watch, youtu.be, Shorts, embed, live, or a bare video ID
- Responsive 16:9 wrapper enabled by default so videos scale on mobile, tablet, and desktop
- Fixed-size presets (560x315, 640x360, 853x480, 1280x720) when you need exact dimensions
- Start time input in mm:ss or plain seconds, converted to the correct start parameter
- Autoplay, mute, loop, hidden controls, and modest branding toggles with live code regeneration
- Privacy-enhanced mode using youtube-nocookie.com for reduced cookie tracking
- Lazy loading option for faster pages and better Core Web Vitals scores
- Live player preview that updates as you change options (autoplay stays off in the preview)
- Accessible output with a title attribute and allowfullscreen on every iframe
- One-click copy to clipboard, no signup, completely free
How to Use the YouTube Embed Code Generator
- Paste your link: Drop any YouTube URL or 11-character video ID into the input field. The tool detects the video ID automatically.
- Pick your options: Set a start time, toggle autoplay, mute, loop, hidden controls, modest branding, or privacy-enhanced mode. The code updates live.
- Choose sizing: Keep the responsive wrapper for fluid layouts, or switch it off and select a fixed size like 560x315 or 1280x720.
- Check the preview: The live player on the right shows exactly how your embed will behave, minus autoplay so the page stays silent.
- Copy and paste: Click Copy Code and paste the HTML into your website, blog post, CMS HTML block, or email template builder.
Use Cases
- Bloggers: Embed tutorial or review videos in WordPress, Ghost, or static site posts with mobile-friendly responsive code.
- Web developers: Generate consistent, standards-compliant iframe markup with lazy loading instead of hand-writing it each time.
- Course creators: Embed lessons starting at an exact timestamp so students land on the right moment every time.
- Marketing teams: Add product demos to landing pages with modest branding and hidden controls for a cleaner look.
- Agencies handling GDPR sites: Ship privacy-enhanced youtube-nocookie.com embeds for European client websites.
- Documentation writers: Drop walkthrough videos into help centers and knowledge bases without layout breakage.
- Newsletter publishers: Build embeds for web versions of newsletters where video support is available.
- Small business owners: Put a looping, muted promo video on a homepage hero section without hiring a developer.
Frequently Asked Questions
Is this tool free?
Yes, the YouTube Embed Code Generator is completely free with no signup, no watermarks, and no usage limits.
Is my data secure?
Yes. The tool runs entirely in your browser. Your URLs and settings are never sent to our servers, and nothing is stored or logged.
Why does autoplay also add mute=1?
Chrome, Safari, and Firefox block autoplaying video with sound. YouTube embeds only autoplay reliably when muted, so the generator adds mute=1 whenever autoplay is enabled. Visitors can unmute with one click.
Why does loop add a playlist parameter?
This is a YouTube requirement. The loop=1 parameter only works on playlists, so to loop a single video you must pass playlist=VIDEO_ID with the same ID. The generator handles this automatically.
What is the difference between responsive and fixed-size embeds?
A fixed-size iframe always renders at the same pixel dimensions and can overflow small screens. The responsive version wraps the iframe in a container with padding-bottom of 56.25 percent (the 16:9 ratio), so the player fills its parent and scales smoothly on any device.
Does privacy-enhanced mode change how the video plays?
No. The player looks and behaves identically. The youtube-nocookie.com domain simply prevents YouTube from setting tracking cookies until the visitor starts playback, which helps with GDPR and cookie-consent compliance.
Tips & Best Practices
- Keep the responsive wrapper on: Over half of web traffic is mobile, and a fixed 560px iframe will overflow most phone screens.
- Use lazy loading below the fold: Each YouTube iframe pulls hundreds of kilobytes. loading="lazy" defers that cost until the player is actually visible.
- Set a start time for long videos: Linking viewers to the exact relevant moment reduces bounce and keeps them watching your content.
- Prefer privacy-enhanced mode: There is no downside for viewers, and it simplifies cookie-consent handling on sites with EU traffic.
- Keep the title attribute: Screen readers announce it, and accessibility audits like Lighthouse flag iframes without one.
- Test after pasting: Some CMS editors strip iframes in visual mode. Paste the code into an HTML or code block to keep it intact.
Related Tools
YouTube Font Generator
Convert text into fancy Unicode fonts for titles, comments, and channel names
YouTube Dislike Checker
See the hidden dislike count and like ratio of any YouTube video
YouTube Comment Image Generator
Generate realistic YouTube comment screenshots
YouTube Revenue Calculator
Estimate YouTube earnings from views and RPM by niche
YouTube Timestamp Link Generator
Create YouTube links that start at an exact time
YouTube Hashtag Generator
Find trending YouTube hashtags by category and mix in your own keywords
YouTube Banner Maker
Design 2560x1440 channel art with safe-area guides and export as PNG
YouTube Title Generator
Generate clickable video title ideas with proven formats and length checks
YouTube Watch Time Calculator
Calculate watch hours and track progress toward 4000 hours for monetization
YouTube Tag Extractor
Reveal the hidden tags of any YouTube video and copy them in one click
YouTube Channel Name Generator
Generate unique channel name ideas by niche and keyword
YouTube Channel ID Finder
Convert any handle or channel URL to the permanent channel ID with RSS feed
Last Added Free Tools
YouTube Thumbnail Downloader
Download any YouTube video thumbnail in HD and all other resolutions
YouTube Subscriber Counter
Track any channel's subscriber count live with auto-refresh
YouTube Subscribe Link Generator
Build channel links that open with a subscribe confirmation popup
ChatGPT Chat Generator
Create realistic ChatGPT conversation screenshots with user prompts and AI responses
Claude Chat Generator
Generate authentic Claude AI conversation screenshots with the signature warm theme
Gemini Chat Generator
Create realistic Google Gemini conversation screenshots with the sparkle logo
Grok Chat Generator
Generate authentic Grok AI conversation screenshots in dark and light themes
Perplexity Answer Generator
Create realistic Perplexity AI answer screenshots with sources and citations
Facebook Post Generator
Generate realistic Facebook post screenshots with reactions, comments, and shares
Threads Post Generator
Create authentic Threads post screenshots with replies, likes, and verified badges
Pinterest Pin Generator
Generate realistic Pinterest pin mockups with images, titles, and Save buttons
Instagram Comment Generator
Create realistic Instagram comment screenshots with likes, replies, and verified badges