The YouTube Embed Code Generator creates ready-to-paste iframe HTML for a single YouTube video. Enter a YouTube URL or video ID, choose your size and playback settings, preview the result, and copy the generated code into a website that supports iframe HTML.
What Is a YouTube Embed Code Generator?
A YouTube embed code generator converts a regular YouTube link into an HTML iframe. The iframe displays the YouTube player directly on a webpage, allowing visitors to watch the video without opening the standard YouTube watch page first.
The SanishTech YouTube Embed Code Generator also lets you add supported player parameters without editing the iframe URL manually. You can set a start or end time, request autoplay, loop the video, hide selected player controls, switch to privacy-enhanced mode or create a responsive 16:9 embed.
What the YouTube Embed Code Generator Supports
Live testing confirmed that the current tool accepts:
- A standard YouTube watch URL
- A shortened youtu.be link
- A YouTube Shorts URL
- An existing youtube.com/embed URL
- A raw 11-character YouTube video ID
The generated result can include:
- Default or custom iframe dimensions
- Start and end times entered in minutes and seconds
- Autoplay and single-video looping parameters
- Options to hide player controls or the fullscreen button
- Privacy-enhanced youtube-nocookie.com embeds
- A responsive 16:9 video wrapper
- A live preview of the generated embed
- A button for copying the complete HTML
This page is designed for one video at a time. To embed an entire playlist, use the YouTube Playlist Embed Code Generator. For a dedicated vertical-video layout, try the YouTube Shorts Embed Code Generator.
How to Use the YouTube Embed Code Generator
- Copy the YouTube video URL you want to embed. You can also copy its 11-character video ID.
- Paste the URL or ID into the video input field.
- Enter a custom width and height or leave both fields blank to use 560 × 315.
- Add optional start and end times in minutes and seconds.
- Select the playback, display, privacy or responsive options you need.
- Click Generate.
- Review the preview and generated iframe code.
- Click Copy HTML to clipboard and paste the code into your website's HTML editor.
The YouTube Embed Code Generator does not require a SanishTech account or a connected YouTube account.
Fixed Size Versus Responsive YouTube Embeds
When the Responsive option is disabled, the tool uses the width and height entered in the form. Leaving both fields empty produces a 560 × 315 iframe.
When Responsive is enabled, the generated HTML uses a container with a 56.25% bottom padding. This creates a 16:9 aspect ratio and allows the iframe to expand or shrink with the available container width.
Custom width and height values are not included in responsive output. Responsive mode always creates the current 16:9 wrapper, so it should not be used when you need a vertical or square aspect ratio.
How the Playback Options Change the Embed Code
- Autoplay: adds
autoplay=1to the iframe URL. - Loop video: adds
loop=1and repeats the video ID through the playlist parameter. - Hide controls: adds
controls=0. - Hide full-screen: adds
fs=0. - Start time: converts the entered minutes and seconds into the
startparameter. - End time: converts the entered minutes and seconds into the
endparameter. - Privacy enhanced: changes the iframe host from youtube.com to youtube-nocookie.com.
YouTube states that the start and end parameters are measured in seconds from the beginning of the video. A requested start point may also move to a nearby video keyframe. You can review the supported behavior in YouTube's embedded-player parameter documentation.
Make sure the end time is later than the start time. The current SanishTech interface does not block an end time that comes before the selected start time.
Important Autoplay and Preview Differences
Selecting Auto play video adds the autoplay request to the copied iframe code. Browsers and website policies may still prevent a video from starting automatically, especially when it contains sound.
During live testing, the SanishTech preview omitted the autoplay parameter even though the copied HTML included it. Therefore, a preview that does not autoplay does not necessarily mean the copied setting is missing.
YouTube also explains that enabling autoplay can cause playback data collection and sharing to begin when the player loads, before the viewer interacts with it.
What Privacy-Enhanced Mode Does
Privacy-enhanced mode changes the iframe domain to youtube-nocookie.com. YouTube explains that ads shown in this mode are non-personalized and that the view is not used to personalize advertising shown outside your website or app.
This setting should not be described as automatic GDPR, cookie-law or consent compliance. Website owners remain responsible for reviewing their own consent setup, location-specific requirements and use of third-party content. See YouTube's Privacy Enhanced Mode instructions.
Can the YouTube Logo Be Removed?
The interface currently includes a Hide YouTube logo option, which adds modestbranding=1. However, YouTube has deprecated the modestbranding parameter and says it has no effect.
Because YouTube now decides how its branding appears, the generator cannot guarantee that the logo or other YouTube branding will be hidden. SanishTech should consider removing this option or labelling it as deprecated.
Where to Paste the Generated Iframe Code
Paste the copied code into a part of your website that accepts HTML. In WordPress, this is normally a Custom HTML block. Other content management systems and page builders may provide an HTML, iframe, embed or code widget.
Do not paste iframe code into a visual text field that escapes or removes HTML. Some hosted platforms restrict iframe elements, so check the platform's embed rules if the player disappears after publishing.
Social networks generally expect the original YouTube URL rather than iframe HTML. Use the generated code on webpages, not inside ordinary social-media posts.
Checks to Make Before Publishing
- Confirm that the preview loads the intended video.
- Check that the end time is later than the start time.
- Test autoplay in the browsers your visitors commonly use.
- Preview responsive embeds on both desktop and mobile layouts.
- Add a descriptive
titleattribute to the iframe for accessibility. - Review your privacy and consent requirements before publishing third-party embeds.
- Test the finished embed inside the actual website builder or theme.
The current generated code does not automatically add lazy loading or a descriptive iframe title. The YouTube Embed Code Generator should therefore be treated as a practical starting point that you can adjust for your site's accessibility and performance requirements.
Frequently Asked Questions
How does the YouTube Embed Code Generator work?
The YouTube Embed Code Generator extracts the video ID from a supported YouTube link or accepts a raw video ID. It combines that ID with your selected size and playback options, then produces iframe HTML that you can preview and copy.
What YouTube links and IDs does the tool accept?
Live testing confirmed support for standard watch URLs, shortened youtu.be links, Shorts URLs, existing YouTube embed URLs and raw 11-character video IDs.
Can I generate responsive YouTube embed code?
Yes. Responsive mode creates a fluid 16:9 wrapper using 56.25% bottom padding. It does not use the custom width and height fields, and it does not create a vertical Shorts layout.
Can I set a start and end time for the video?
Yes. Enter the start and end times in minutes and seconds. The generator converts them into seconds for YouTube's start and end parameters. Make sure the end time is later than the start time.
Does YouTube embed autoplay always work?
No. The generator adds autoplay=1 when enabled, but browser autoplay rules can still block playback. The live SanishTech preview also omits autoplay even though the copied code includes it.
What does privacy-enhanced mode do?
Privacy-enhanced mode changes the embed host to youtube-nocookie.com. It affects how YouTube uses the viewing activity for advertising, but it should not be treated as automatic privacy-law or consent compliance.
How do I get embed code for a YouTube video?
Paste the video's YouTube URL or video ID into the generator, choose the settings you need and click Generate. Review the preview, copy the iframe HTML and paste it into an HTML-supported area of your website.
How do I make an embedded YouTube video loop?
Enable Loop video before generating the code. The tool adds loop=1 and includes the same video ID in the playlist parameter, which is the structure YouTube documents for looping a single video.
Can I remove the YouTube logo from an embedded video?
The tool has a Hide YouTube logo option that adds modestbranding=1. YouTube has deprecated this parameter and says it has no effect, so the generator cannot guarantee that branding will disappear.
Can I use the generated embed code in WordPress?
Yes. Paste the copied iframe code into a WordPress Custom HTML block. If you use a page builder, place it inside a widget or module that permits iframe HTML rather than an ordinary text field.
