Free tool

Responsive Iframe Generator

Paste any embed code. Get a version that keeps its aspect ratio and fits every screen, with a preview.

YouTube, Vimeo, Google Maps, Spotify, a form, a calendar: anything that gives you an <iframe>.

Ratio (from × in your code)

Embedding a live stream? The code above fits every screen, but it still points at one video.

EmbedVidio puts a responsive player on your site that switches to your live stream the moment you go live and back to your latest video when you stop. No code to change.

Why iframes break on phones

An iframe is a fixed box. The embed code YouTube, Vimeo or Google Maps hands you says width="560" height="315", and that is exactly what you get on a 375-pixel phone screen: a player wider than the page, cut off on the right. Percent widths alone do not help either, because the height stays fixed and the video ends up letterboxed.

The padding-ratio trick

The fix is a wrapper whose height is defined by its width. A block with height: 0 and padding-bottom: 56.25% is always 16:9, whatever its width, because percentage padding is measured against the width. The iframe is stretched to fill that box with position: absolute. This tool writes exactly that, reading the ratio from the width and height in your code.

Modern browsers also understand aspect-ratio: 16 / 9 on the wrapper, which does the same job in one line. The padding version is generated here because it works everywhere, including older email-style page builders.

Common aspect ratios

Ratiopadding-bottomTypical content
16:956.25%YouTube, Vimeo, Twitch, most video
4:375%Older video, slide decks
1:1100%Instagram-style squares, some maps
9:16177.78%Vertical video, Shorts, Reels
21:942.86%Ultra-wide and cinematic players

Where to paste it

WordPress: a Custom HTML block. Wix: Embed, then Embed a widget. Squarespace: a Code block. Shopify: a Custom Liquid section. Weebly: the Embed Code element. Anywhere that accepts raw HTML works, because the output is a plain div and iframe.

Frequently asked questions

My embed has no width or height. What ratio is used?
16:9, and the tool says so in a note. Pick a different ratio from the menu if the content is a map, a form or a vertical video.
Why did some attributes disappear from my iframe?
Fixed width, height, frameborder and inline styles are replaced by the wrapper, which is the point. Script-like attributes are dropped on purpose. src, title, allow, allowfullscreen, loading, referrerpolicy and sandbox are kept.
Can I limit how wide it gets on desktop?
Yes, set a max width. The wrapper gets max-width and stays centred inside whatever column you place it in; on narrow screens it still shrinks to fit.
Does this work for things other than video?
Anything inside an iframe: maps, calendars, forms, playlists, presentations. Choose the ratio that matches the content, since maps and forms are rarely 16:9.