YouTube Embed Code Generator
Paste a YouTube link to get clean, responsive embed code. Choose a start time, autoplay, mute, loop and privacy-enhanced mode, preview the video and copy the code for your website.
How to embed a YouTube video
- Copy the video link from YouTube’s address bar or the Share button.
- Paste it here and choose your options.
- Copy the embed code and paste it into an HTML block. In WordPress, use the Custom HTML block; in Elementor, use the HTML widget.
Embed options explained
| Option | What it does |
|---|---|
| Responsive | The video resizes to fit phones and desktops at 16:9 |
| Start at | Begins playback at a set time |
| Privacy-enhanced | Uses youtube-nocookie.com to limit cookies |
| Autoplay | Starts playing on load, muted, as browsers require |
| Loop | Replays the video when it ends |
| Lazy loading | The player loads only when it is near the screen, helping page speed |
Embeds and page speed
Each YouTube embed loads extra scripts, which can slow your page and hurt Core Web Vitals. Use lazy loading, which this code includes, avoid several embeds above the fold, and consider a click-to-play thumbnail on pages where speed matters most. Check the impact with the page weight budget calculator.
Related YouTube tools
Create timestamp and subscribe links with the YouTube link generator, and add Video schema with the video schema generator so Google understands the video on your page.
More free tools and guides
Practise tools like this on real projects in our digital marketing course in Faridabad, with weekday, weekend and online batches.
See the courseAll free toolsAsk on WhatsAppFrequently Asked Questions
Is this YouTube embed code generator free?
Yes. It is free with no sign-up and works in your browser.
How do I make a YouTube embed responsive?
Wrap the iframe in a container with 56.25% bottom padding and position the iframe absolutely inside it. The code here does that for you.
Why does autoplay not work?
Browsers block autoplay with sound. The video must be muted to autoplay, which is why mute is added.
What is privacy-enhanced mode?
It loads the player from youtube-nocookie.com, which avoids storing tracking cookies until the viewer plays the video.