Responsive Iframe Generator
Paste any embed code. Get a version that keeps its aspect ratio and fits every screen, with a preview.
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
| Ratio | padding-bottom | Typical content |
|---|---|---|
| 16:9 | 56.25% | YouTube, Vimeo, Twitch, most video |
| 4:3 | 75% | Older video, slide decks |
| 1:1 | 100% | Instagram-style squares, some maps |
| 9:16 | 177.78% | Vertical video, Shorts, Reels |
| 21:9 | 42.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.
More free tools
- Live Stream Embed Code Generator Pick YouTube, Facebook or Twitch, paste a link, get embed code that works, with a live preview.
- Live Stream Status Checker Paste a YouTube or Twitch channel and find out if it is live right now, and what is on.
- YouTube Video ID & Thumbnail Finder Paste any YouTube link and get the video ID, every thumbnail size, and clean embed and share URLs.
- YouTube Channel ID Finder Paste any YouTube video URL and get the channel ID instantly.
- YouTube RSS Feed Finder Get the RSS feed for any YouTube channel from a URL, @handle, or channel ID.
- YouTube Embed Checker Check whether a YouTube video allows embedding before you build the page.