Home › Developer Tools › YouTube Embed Code Generator

YouTube Embed Code Generator

Paste a YouTube link in any format, choose start and end times, autoplay, loop, captions and privacy-enhanced mode, and copy clean, responsive iframe code for your website. The preview only loads YouTube when you click it.

Last updated:

Playback

Use seconds (90), mm:ss (1:30) or h:mm:ss.

Player & size

Live preview

Advertisement

How to use the YouTube Embed Code Generator

  1. Paste the YouTube link (or just the 11-character video ID). Shorts are detected and switched to a 9:16 frame.
  2. Set start and end times if you only want part of the video, for example 1:30 to 2:45.
  3. Choose playback options such as autoplay, loop, captions or hidden controls.
  4. Pick a size: Responsive fills the width of its container at the chosen aspect ratio; Fixed size uses exact pixels.
  5. Press Copy Code and paste it into your HTML, WordPress Custom HTML block or page builder. Click Load Preview to check it first.

YouTube links this tool understands

Link formatExample
Watch pagehttps://www.youtube.com/watch?v=VIDEO_ID&t=90s
Short linkhttps://youtu.be/VIDEO_ID?t=1m30s
Shortshttps://www.youtube.com/shorts/VIDEO_ID
Livehttps://www.youtube.com/live/VIDEO_ID
Existing embedhttps://www.youtube.com/embed/VIDEO_ID?start=30
Playlisthttps://www.youtube.com/playlist?list=PL…
Mobile / Musicm.youtube.com, music.youtube.com
Bare ID11 characters of letters, digits, - and _

YouTube embed parameters reference

ParameterValueEffect
startsecondsBegin playback at this second (1:30 = 90).
endsecondsStop playback at this second.
autoplay1Start playing automatically (needs mute=1 in most browsers).
mute1Start muted.
loop + playlist1 + video IDRepeat the video; a single video must be listed as its own playlist.
controls0Hide the player controls.
cc_load_policy1Show captions by default.
cc_lang_preflanguage codePreferred caption language, e.g. en or es.
rel0Related videos at the end come from the same channel.
playsinline1Play inside the page on iPhone instead of fullscreen.
fs0Hide the fullscreen button.

Responsive embed: how the padding trick works

An iframe has no natural aspect ratio, so the responsive code wraps it in a div with height:0 and a bottom padding equal to height ÷ width × 100. Percentage padding is measured against the container's width, so the box always keeps the right shape, and the iframe is stretched to fill it with absolute positioning.

Aspect ratioPadding-bottomTypical use
16:99 ÷ 16 = 56.25%Standard YouTube videos
9:1616 ÷ 9 = 177.7778%YouTube Shorts
4:33 ÷ 4 = 75%Older recordings, presentations
1:1100%Square social clips

Frequently asked questions

How do I embed a YouTube video on my website?

Paste the video link above, copy the generated code and paste it into your page's HTML where the video should appear. In WordPress use a Custom HTML block; in most site builders use an Embed or HTML element.

How do I make a YouTube embed start at a specific time?

Enter the time in the Start at field, for example 1:30. The tool adds start=90 to the embed URL. If your link already contains ?t=90 or ?t=1m30s, the start time is filled in automatically. Use End at to stop playback at a given second.

Why doesn't my embedded YouTube video autoplay?

Browsers only allow autoplay when the video is muted, so the tool switches on Start muted when you tick Autoplay. Data-saver modes and some mobile browsers may still block autoplay entirely.

How do I loop a YouTube embed?

Tick Loop. For a single video YouTube also requires a playlist parameter containing the same video ID, which the generator adds for you (loop=1&playlist=VIDEO_ID).

What is privacy-enhanced mode?

Embeds from youtube-nocookie.com do not store YouTube cookies or personalise ads for visitors until they play the video. It is the recommended option for GDPR-conscious sites and works the same for viewers.

How do I make a YouTube embed responsive?

Use the Responsive option. The iframe is placed inside a wrapper with a percentage padding (56.25% for 16:9) so it scales with the width of the page while keeping its shape. Set a max width if it should not grow beyond a certain size.

Can I embed YouTube Shorts?

Yes. Paste the youtube.com/shorts/ link; the generator converts it to a normal embed URL and selects a vertical 9:16 frame.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Meta Tag GeneratorCreate SEO, Open Graph and X meta tags with live previews.Open Graph PreviewPaste OG tags and preview how links look on Facebook, X and LinkedIn.Deep Link GeneratorCreate links that open directly in apps.UTM Campaign URL BuilderAdd UTM tracking parameters to links and make a QR code.Clock Widget GeneratorDesign an analog or digital clock for any time zone and copy embed code for your website.Countdown Widget GeneratorDesign an embeddable countdown and copy HTML code or an iframe link for your website or Notion.YouTube Channel Name GeneratorGenerate YouTube channel names from your niche and name, with handle-ready @versions.CSS Box Shadow GeneratorDesign layered CSS box shadows with a live preview, presets and one-click Copy CSS.CSS Border Radius GeneratorRound each corner, draw elliptical 8-value radii or random blob shapes and copy the CSS.CSS Button GeneratorDesign CSS buttons with gradients, borders, shadows and hover and active states, then copy the code.CSS Flexbox GeneratorBuild flexbox layouts visually: set container and item properties, then copy the CSS and HTML.Twitter Card GeneratorCreate X / Twitter Card meta tags with Open Graph fallbacks, character counters and a live preview.CSS Grid GeneratorDraw CSS grid layouts: set tracks and gaps, drag to name areas, then copy the CSS and HTML.PX to REM ConverterConvert px to rem or em and back, with a 1-100px table and a whole-CSS converter.Glassmorphism CSS GeneratorDesign frosted-glass UI cards with blur, transparency and border sliders, then copy the CSS.CSS Text Shadow GeneratorLayer CSS text shadows with a live preview and neon, 3D, outline and retro presets.HTML Editor (Live Preview)Write HTML, CSS and JavaScript and see a live, sandboxed preview as you type.HTML to JSX ConverterConvert HTML to valid React JSX: className, htmlFor, style objects, self-closing tags and events.CSS Clip-Path GeneratorDraw CSS clip-path shapes by dragging points: polygons, circle, ellipse and inset. Copy the CSS.CSS Animation GeneratorCreate CSS keyframe animations from 23 presets with live preview, timing controls and Copy CSS.CSS Triangle GeneratorMake CSS triangles in 8 directions with the border trick or clip-path. Set size and color, copy CSS.CSS Loader GeneratorPick from 14 pure CSS spinners and loaders, set color, size and speed, then copy the HTML and CSS.Cubic Bezier GeneratorDrag the control points to design a CSS easing curve, compare it with linear and copy cubic-bezier().CSS Filter GeneratorAdjust blur, brightness, contrast, hue, sepia and drop-shadow on an image and copy the CSS filter.CSS Specificity CalculatorCalculate CSS selector specificity (a, b, c), including :is(), :not(), :has() and :where(), and compare.Google Maps Embed GeneratorTurn an address or coordinates into responsive Google Maps iframe embed code, no API key.Neumorphism CSS GeneratorDesign soft UI neumorphic shapes with live preview and copy the box-shadow CSS.SVG Wave GeneratorMake layered SVG waves for section dividers and export SVG, PNG or a CSS background.SVG Blob GeneratorGenerate random organic SVG blob shapes with gradients and export SVG, PNG or CSS clip-path.CSS Clamp GeneratorTurn min/max sizes and viewport widths into a fluid CSS clamp() value in rem and vw.CSS @font-face GeneratorTurn font files or URLs into ready-to-paste @font-face rules with weights, styles and a preview.CSS Media Query GeneratorBuild @media rules for widths, orientation, dark mode and hover, or get framework breakpoints.CSS Scrollbar GeneratorStyle scrollbars: width, colors, radius and hover, with ::-webkit-scrollbar and scrollbar-color CSS.CSS Sprite GeneratorPack many icons into one sprite sheet PNG and get CSS classes with background-position.CSS Text Gradient GeneratorMake gradient text with background-clip:text: color stops, angle, font preview and fallback CSS.CSS Toggle Switch GeneratorDesign pure-CSS toggle switches: size, colors, shape and animation. Copy accessible HTML + CSS.CSS Tooltip GeneratorBuild pure CSS tooltips: position, arrow, colors, padding and animation. Copy HTML and CSS.HTML Form BuilderDrag and drop form fields with labels and validation, then copy accessible HTML and CSS code.CSS Shape Divider GeneratorCreate wave, tilt, curve and triangle section dividers and copy the SVG, HTML and CSS.CSS Transform GeneratorRotate, scale, skew and translate an element with sliders and copy the CSS transform code.Font Pairing ToolPreview Google Font heading and body pairs on real layouts and copy the embed code and CSS.HTML Accessibility CheckerPaste HTML to find WCAG accessibility problems with impact level, the failing element and a fix.HTML Image Map GeneratorDraw clickable rectangle, circle and polygon hotspots on an image and get image map HTML.SVG ViewerOpen or paste SVG code to preview it live with zoom, backgrounds, size info and PNG export.Pathfinding VisualizerAnimate BFS, DFS, Dijkstra, A* and greedy search on a grid with walls, weights and mazes.Iframe GeneratorCreate iframe embed code: size or responsive ratio, border, allow, sandbox, lazy load, live preview.PX to VW ConverterConvert pixels to vw and vh for any viewport size, and vw/vh back to px, with breakpoint tables.SVG Path EditorEdit an SVG path d attribute visually: drag points, edit commands, convert, scale and minify.SVG to CSS Data URITurn SVG code into a small URL-encoded data URI for CSS backgrounds, with Base64 size comparison.SVG to JSXTurn SVG code into a clean React component: camelCase attributes, style objects, TypeScript.Tailwind CSS Cheat SheetSearchable Tailwind class to CSS reference with live previews, class decoder and color palette.Web App Manifest GeneratorCreate a PWA manifest.json and every app icon size from one image, downloaded as a ZIP.CSS Background Pattern GeneratorMake pure-CSS stripes, dots, checkerboard, zigzag and grid backgrounds and copy the code.CSS Color Filter GeneratorTurn a HEX color into a CSS filter that recolors black icons and SVGs, with an accuracy score.CSS Gradient Animation GeneratorCreate animated gradient backgrounds: pick colors, angle and speed, preview live and copy the CSS.CSS Hover Effects GeneratorPick button, link and image hover effects, tweak colors and timing, and copy the HTML and CSS.CSS InlinerMove CSS from style blocks into inline style attributes so HTML emails render in every client.
See all 52 Web, HTML & CSS Tools →