Embed code generator
Turn a YouTube, Vimeo, maps, or plain URL into responsive embed code that scales with its container — preview included.
One URL in, a working embed out
Paste a link and the tool figures out what it is. YouTube watch, Shorts, and youtu.be URLs become the official /embed/ player (on the privacy-enhanced youtube-nocookie.com domain by default), Vimeo links become the player.vimeo.com endpoint, and Google Maps links are rebuilt against the Maps embed endpoint. Anything else is embedded as a plain iframe.
With the responsive wrapper on — the default — the snippet is a div carrying an aspect-ratio style with the iframe filling it. Drop it into any column, sidebar, or article body and it scales to fit while keeping its shape. Turn the wrapper off for a fixed-size embed with explicit width and height attributes.
Embedding without the gotchas
- Use the responsive wrapper unless you have a reason not to — fixed-width embeds are the most common cause of horizontal scrolling on phones.
- 16:9 fits nearly all modern video; 4:3 suits older uploads and slide recordings; 1:1 works for maps and square widgets.
- Keep lazy loading on for embeds below the fold — a YouTube player pulls in hundreds of kilobytes of script the moment it loads, and lazy defers that until it's about to be seen.
- The YouTube privacy toggle costs nothing: youtube-nocookie.com serves the identical player but holds back tracking cookies until playback starts.
- Embedding someone's content doesn't make it yours — the video or map still loads from the original service under its terms, and if the source is deleted your embed goes dark.
Frequently asked questions
Which URLs does the generator understand?
YouTube (watch, Shorts, and youtu.be links), Vimeo, and Google Maps URLs get converted to their proper embed endpoints. Any other http(s) URL becomes a plain iframe embed — which works whenever the target site allows framing.
What makes an embed responsive?
Instead of fixed width and height attributes, the iframe sits inside a wrapper div with the CSS aspect-ratio property. The wrapper scales with its container and the iframe fills the wrapper, so the embed keeps its shape on every screen size with no media queries.
What is youtube-nocookie.com?
It's YouTube's privacy-enhanced embed domain: the player doesn't set tracking cookies until the visitor actually plays the video. It's the better default for GDPR-conscious sites, and the video works exactly the same.
Why doesn't my Google Maps link embed?
Regular Maps URLs aren't embeddable directly — browsers block them inside iframes. The generator extracts the place, query, or coordinates from your link and rebuilds it against Maps' embed endpoint (output=embed), which is made for framing.
Can I embed any website with this?
Only if that site allows it. Many sites send an X-Frame-Options header or a Content-Security-Policy frame-ancestors directive that tells browsers to refuse framing. If the preview stays blank, that's the target site declining — no embed code can work around it.
Does this tool upload my URL anywhere?
No. Detection and code generation happen entirely in your browser; the only request made is the preview frame loading the embed itself, the same way it would on your own page.
Related free tools
See all free tools →Built something? Put it online in seconds
host0 is the cloud for small software: bring any coding agent, build the tool only you need — like this one — and say "deploy to host0". Live at a shareable URL, no servers to run.