About the YouTube Embed Code Generator
You get a browser-side generator that produces a YouTube iframe and a direct embed link. You paste a YouTube URL or video ID, pick a size and player options, and the page updates instantly with code you can copy. The tool runs in your browser only; you do not upload files to a server. The generator uses standard YouTube player parameters from Google Developers and offers privacy-enhanced mode using youtube-nocookie.com as documented by YouTube Help. The results include a responsive option that keeps 16:9 on phones using CSS aspect-ratio. The tool shows a live preview and an embed link you can share so the page reopens with your settings.
How to use it
- 1Paste a YouTube URL or video ID into the input field.
- 2Choose a Size: Responsive (16:9) or a fixed size like 560 x 315.
- 3Set optional Start and Stop seconds and toggles like Autoplay, Loop, Controls and Captions.
- 4Copy the generated iframe HTML or the embed link and paste it into your site.
Worked example
<iframe width="100%" style="aspect-ratio:16/9;border:0" src="https://www.youtube-nocookie.com/embed/M7lc1UVf-VE?start=30&end=90&autoplay=1&mute=1&loop=1&playlist=M7lc1UVf-VE&controls=0&cc_load_policy=1&rel=0" title="YouTube demo" loading="lazy" referrerpolicy="strict-origin-when-cross-origin" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
How it works
Builds the standard YouTube iframe with the player parameters you pick: start and end (in seconds), autoplay=1 with mute=1 (browsers only autoplay muted video), loop=1 with playlist set to the same video (YouTube needs both), controls=0, cc_load_policy=1 and rel=0Privacy-enhanced mode uses youtube-nocookie.comResponsive code uses CSS aspect-ratio so the video keeps 16:9 on phonesResults update instantly as the visitor types; there is no calculate buttonVisitors can copy the result and share a link that reopens with their numbersSource: YouTube Player Parameters (Google Developers)YouTube Help: Privacy-enhanced mode. Last checked 5 November 2026.
What it is good for
- Generates standard YouTube iframe HTML and a shareable embed link.
- Runs entirely in your browser; nothing is uploaded to a server.
- Responsive option uses CSS aspect-ratio to keep 16:9 on phones.
- Autoplay only works in browsers if the player is muted and browser rules allow it.
- Embedding can be blocked if the video owner disabled embedding.
Questions people ask
How do I make the embed start at a specific time?
Enter the Start at value in seconds. The generator adds start=SECONDS to the iframe URL, for example start=90 to begin at 1 minute 30 seconds. This follows YouTube player parameters.
Will autoplay start with sound?
Browsers block autoplay with sound, so the generator sets mute when you pick Autoplay. The iframe uses autoplay=1 and mute=1 because only muted autoplay is reliable across browsers.
How do I loop a single video?
Turn on Loop. The generator adds loop=1 and playlist=VIDEO_ID to the query string. YouTube requires both loop and playlist for a single-video loop to work.
What does privacy-enhanced mode do?
Privacy-enhanced mode uses youtube-nocookie.com so YouTube delays some cookies until the user plays the video. It does not block all network calls to Google. See YouTube Help for details.
Can I embed a YouTube Short?
Yes. Paste the Short URL or ID and choose a vertical or responsive size. The generator handles Short links and outputs a working iframe that matches the format.
Does the tool send my video ID to any server?
No. The generator runs in your browser and builds the iframe locally. You do not upload the video ID or settings to FreeToolr servers.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.