Embed Code Generator
Paste a YouTube, Vimeo, or generic iframe URL, pick an aspect ratio and options, and get a clean responsive embed snippet built on the modern aspect-ratio CSS property — with a commented padding-bottom fallback for older browsers.
How to use this tool
- 01
Paste the video URL
YouTube, Vimeo, or generic iframe URL.
- 02
Pick aspect ratio
16:9 covers most cases; 9:16 for vertical.
- 03
Copy the snippet
Drop into your page where you want the video to appear.
Why this matters
A mis-built embed is one of the most visible bugs on a page: a fixed-pixel iframe overflows the column on mobile and forces a horizontal scrollbar, or a height-less responsive wrapper collapses to nothing and the video disappears entirely. Most copy-paste embed snippets people find are either the platform's own fixed-size markup or a decade-old padding-bottom hack with magic numbers nobody remembers how to change — both age badly and break the first time the layout changes.
This generator emits the modern aspect-ratio CSS approach as the primary snippet (one declaration, no wrapper math) and ships the padding-bottom equivalent in a commented block so you have a drop-in fallback without hunting for the percentage. It privacy-hardens YouTube to youtube-nocookie.com, lazy-loads the iframe, and always includes an accessible title. For a click-to-load embed that defers the entire player until interaction, use the Lazy-Load Embed Generator instead; for a privacy-first YouTube-specific embed, see the Privacy YouTube Embed tool.
Related tools
Build a YouTube embed with autoplay, loop, start/end times, captions, controls, and privacy mode. Live preview updates as you toggle settings.
Generate a self-contained lazy-load YouTube embed snippet. Shows the thumbnail until clicked, then loads the player. Saves 1MB+ per embed before interaction.
Generate a YouTube embed that uses youtube-nocookie.com to defer tracking cookies until viewer interaction. Helps with GDPR consent banner requirements.
FAQ
Explore the full toolkit
94 free tools covering titles, tags, thumbnails, scripts, captions, embeds, schema, and in-browser video processing.
Browse all tools →