YouTube Embed Code Generator
Create ready-to-paste embed code with the options you choose
What the YouTube Embed Code Generator Does
Embedding lets you show a YouTube video directly on your own web page so visitors can watch without leaving your site. The embed code is a small snippet of HTML, usually an iframe, that tells the browser where to load the video from. The YouTube Embed Code Generator on WebTOOLkt builds that snippet for you. Paste a video link, choose your options and copy the finished code into your page.
It is handy for bloggers, teachers, small business owners and developers who want a correct, tidy snippet without remembering the syntax.
How to Use the YouTube Embed Code Generator
- Copy the link of the YouTube video you want to show.
- Paste it into the tool.
- Choose the width and height, or a responsive setting if one is offered.
- Pick any extra options, such as autoplay, controls or a start time, where available.
- Generate the code and copy it.
- Paste the snippet into the HTML of your page, or into the custom HTML block of your content editor.
- Preview the page on desktop and mobile to confirm the video appears correctly.
What an Embed Code Looks Like
A typical embed is an iframe element whose source points to the YouTube player and contains the video's unique ID. Around it you will see attributes that control size, permissions and loading behaviour. The full list of player options is documented in Google's YouTube embedded player parameters, and developers who want deeper control can use the IFrame Player API.
Choosing Settings Wisely
- Size. Standard widescreen videos use a 16:9 ratio. A common size is 560 by 315 pixels, but a responsive layout that scales to the container is better for mobile visitors.
- Autoplay. Browsers often block autoplay with sound, and visitors usually dislike it. Use it sparingly and keep sound off if you do.
- Controls. Leave them on unless there is a clear design reason. Visitors expect to pause, seek and change volume.
- Start and end times. Useful for pointing to a specific segment of a long video.
- Related videos. You can limit suggestions at the end to videos from the same channel, though you cannot fully remove them.
- Privacy-enhanced mode. Switching the domain to youtube-nocookie.com reduces tracking until the visitor plays the video.
Embedding Without Hurting Page Speed
Video players are heavy. Each embedded player can load scripts and data before anyone presses play, which can slow your page and hurt metrics that Google measures. Google's Core Web Vitals guidance explains why this matters. To keep pages quick:
- Add loading="lazy" to the iframe so it loads only when it nears the screen.
- Embed only one or two videos per page where possible.
- Place important videos below the main content if they are not essential to the first impression.
- Consider showing a thumbnail image that loads the player only when clicked.
- Test the page with a speed tool after adding the video.
SEO and Accessibility Tips
- Surround the video with text. A short introduction and a written summary help search engines understand the page and help visitors who cannot play audio.
- Add a title attribute. A descriptive title on the iframe helps screen reader users know what the frame contains.
- Offer a transcript. It makes the content accessible and gives search engines more text to index.
- Use structured data if appropriate. Google documents video markup in its video structured data guide.
Things to Check Before You Embed
Only embed videos you are allowed to show. Many creators allow embedding, but some disable it, and the video will then display an error. Private videos cannot be embedded. If you embed someone else's video, you are using their player, which is generally permitted by YouTube's terms, but you should not misrepresent it as your own. Review current rules in the YouTube Help Center.
Why Use This Tool Instead of Other Options
You can copy embed code from YouTube's Share menu, but this generator is faster when you need to adjust size or parameters, and it avoids typing mistakes in the code. It is free, requires no account and sits with other YouTube utilities on WebTOOLkt for titles, tags, descriptions and statistics.
Related WebTOOLkt Tools
- YouTube Video Statistics to check public numbers for a video.
- YouTube Title Generator to write a clear video title.
- YouTube Description Generator to draft a matching description.
- Page Size Checker to see how heavy a page is after embedding.
- Image Compressor to shrink thumbnails and other page images.
- Meta Tag Generator to create titles and descriptions for the page.
Useful External Resources
- Google: YouTube embedded player parameters
- Google: YouTube IFrame Player API
- web.dev: Core Web Vitals
Frequently Asked Questions
Why does my embedded video show an error?
The owner may have disabled embedding, or the video may be private or removed.
Can I make the embed responsive?
Yes. Wrap the iframe in a container with a fixed aspect ratio and let it scale to the width.
Does embedding count as a view?
Views from embedded players can count, but YouTube applies its own rules for what is counted.
Is embedding the same as copying a video?
No. The video stays on YouTube and plays from there.

