Responsive iframe Wrapper
Paste any existing iframe — YouTube, Vimeo, Wistia, Loom, Maps, anything — pick a target aspect ratio, and get back a modern aspect-ratio responsive wrapper as a self-contained inline snippet or a clean class-based HTML + CSS pair.
One self-contained snippet — paste anywhere, no stylesheet needed.
Responsive HTML
<div style="aspect-ratio:16 / 9;width:100%"> <iframe style="width:100%;height:100%;border:0" loading="lazy" title="Embedded content" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ" allowfullscreen></iframe> </div>
Uses the modern aspect-ratio CSS property (Chrome 88+, Firefox 89+, Safari 15+). Fixed width / height / style attributes are stripped from your iframe; title and loading="lazy" are added if missing.
How to use this tool
- 01
Paste your iframe code
Any HTML iframe snippet.
- 02
Set the aspect ratio
Match your source video's aspect ratio.
- 03
Pick output style
Inline (one snippet) or separate CSS (cleaner for production).
Why this matters
A fixed-size iframe is one of the most common mobile layout bugs on the web: the embed keeps its hard-coded pixel width, blows past the content column on a phone, and either forces a horizontal scrollbar or gets clipped — and because the iframe has no intrinsic aspect ratio, naively setting width:100% just letterboxes it at a wrong fixed height. Every video host hands you embed code with baked-in width and height attributes, so this problem shows up the first time anyone views the page on something smaller than a laptop.
This tool strips the fixed sizing, wraps the iframe in a container that owns the aspect ratio via the modern aspect-ratio CSS property, and gives you the choice between a portable inline snippet and a maintainable class-based HTML + CSS pair. It also injects an accessible title and loading="lazy" if your pasted iframe is missing them. If you don't have an iframe yet, the Embed Code Generator builds a responsive one from a video URL directly.
Related tools
Build a modern aspect-ratio responsive embed snippet for YouTube, Vimeo, or any iframe URL, with a padding-bottom fallback.
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.
FAQ
Explore the full toolkit
94 free tools covering titles, tags, thumbnails, scripts, captions, embeds, schema, and in-browser video processing.
Browse all tools →