YouTube Embed Generator
Generate custom YouTube embed code with autoplay, loop, mute, time controls, and responsive sizing. Preview your embed live before copying the code.
Embed Options
Sharing YouTube videos across platforms? Schedule posts with posterly.
posterly lets you schedule posts across 9 platforms with AI-powered captions. Start with a free 7-day trial.
How to Embed a YouTube Video
Embedding a YouTube video on your website or blog is done using an iframe element. This tool generates the correct iframe code for any YouTube video, with options to customize how the video behaves when embedded. Simply paste a video URL, configure your options, and copy the generated code.
Embed Options Explained
- Autoplay — The video starts playing automatically when the page loads. Note: most browsers require the video to also be muted for autoplay to work.
- Loop — The video replays continuously after reaching the end. Useful for background videos or ambient content.
- Mute — The video starts muted. Required by most browsers if autoplay is enabled.
- Show Controls — Toggle the YouTube player controls (play/pause, volume, progress bar). Hiding controls creates a cleaner look but reduces user control.
- Start/End Time — Set specific start and end points in seconds. Useful for embedding only a relevant portion of a longer video. For shareable links that jump to a specific moment, see the YouTube timestamp link generator.
- Responsive — Wraps the iframe in a container that scales to fit any screen size. Recommended for mobile-friendly websites.
Responsive Embedding
The responsive option uses the padding-bottom technique to maintain a 16:9 aspect ratio regardless of the container width. This ensures your embedded video looks great on desktops, tablets, and phones without horizontal scrollbars or awkward cropping.
Supported URL Formats
This tool accepts all standard YouTube URL formats: regular watch URLs, shortened youtu.be links, Shorts URLs, existing embed URLs, and direct video IDs. It extracts the 11-character video ID automatically regardless of the format you provide.
Best Practices for YouTube Embeds
For the best user experience, enable responsive mode so videos adapt to different screen sizes. Avoid autoplay on content-focused pages as it can be disruptive. Use start and end times to highlight the most relevant section of a video when embedding tutorials or reviews. Always test your embed on mobile devices before publishing. Pair your embeds with a subscribe link or button to convert viewers into subscribers, and schedule your YouTube content so fresh videos are always ready to embed.
More Free Tools
Check out our other free social media tools to boost your content creation workflow.
YouTube Revenue Calculator
Estimate your YouTube earnings from AdSense, memberships, and Super Chats.
Try it nowYouTube Thumbnail Downloader
Download YouTube video thumbnails in all available resolutions.
Try it nowYouTube Subscribe Link Generator
Generate a subscribe link with confirmation popup and HTML button.
Try it now