Free tool · runs in your browser

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

  1. 01

    Paste the video URL

    YouTube, Vimeo, or generic iframe URL.

  2. 02

    Pick aspect ratio

    16:9 covers most cases; 9:16 for vertical.

  3. 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

FAQ

The padding-bottom hack is the legacy responsive-embed technique: you wrap the iframe in a relatively-positioned div with a percentage bottom padding (56.25% for 16:9), then absolutely position the iframe to fill it. The modern `aspect-ratio` CSS property does the same thing in one declaration with no wrapper gymnastics, so the markup is cleaner and easier to maintain. This generator emits the `aspect-ratio` version as the primary snippet and includes the padding-bottom equivalent in a commented block so you can swap it in if you need to support very old browsers.

Explore the full toolkit

94 free tools covering titles, tags, thumbnails, scripts, captions, embeds, schema, and in-browser video processing.

Browse all tools →