All tools

Embed Code Tester

Paste an embed code (a video, a map, a post, a form, or a widget) to see it run in a live preview and to get a report of problems: an address that the browser will block, a page that refuses to show in a frame, a missing title, a width that does not fit a phone, and the other hosts that the embed contacts. Free tool, and the code that you test is not stored.

How to use

  1. 1

    Copy the embed code from the provider. Look for Share and then Embed. The code starts with <iframe, <script, or <blockquote.

  2. 2

    Paste it into the field above and click Test embed code.

  3. 3

    Look at the live preview at desktop, tablet, and phone width. Then read the report: each line says what is wrong and how to fix it.

  4. 4

    Change the code in the field below the report and test it again, until the report is clean.

Tip: test the code again after each change. A fix for one line can bring a new warning for a different line.

What is an embed code tester?

An embed code is a short piece of HTML that shows content from another site inside your page: a video, a map, a social post, a booking form, a chat widget. Most embed codes are an <iframe>, a <script>, or the two together. An embed code tester runs the code in a safe place and tells you what will go wrong before you put it on your site.

What does this tool check?

  • Blocked frames. Many pages refuse to show inside a frame. The tool reads the page's X-Frame-Options and frame-ancestors headers and tells you if the browser will show "refused to connect".
  • Insecure addresses. A page on https:// does not load an embed from http://.
  • Broken code. A tag with no end tag, an iframe with no address, a social post with no script, code that was escaped by an editor.
  • Accessibility. An iframe needs a title, so a screen reader can say what it shows.
  • Phones. A fixed width of 560 pixels is wider than most phone screens.
  • Speed. A script that stops the page while it loads, and an iframe that loads before the visitor can see it.
  • Privacy. The list of other hosts that the embed contacts when a visitor opens your page.

How does the live preview stay safe?

The preview runs in a locked browser sandbox. The code can show itself and load its own files, but it cannot read this site's cookies or pages, and it cannot move you to a different site. Because of the sandbox, an embed that needs its own cookies or storage can look different here than on your site. The report does not depend on the preview.

FAQ

Is this tool free?

Yes, and you do not need an account.

Do you store the code that I test?

No. The code is sent to the server, the report and the preview are sent back, and nothing is saved.

Why does my embed show "refused to connect" or an empty box?

The page in the iframe address tells browsers not to show it inside a frame. It does this with an X-Frame-Options header or a frame-ancestors rule. You cannot change this from your side. Use the embed address that the provider gives. It is often different from the address of the page itself (for YouTube, /embed/ and not /watch).

The report says that the page allows embedding, but the embed is empty on my site. Why?

Look at your own site first. A Content-Security-Policy on your site can block frames and scripts from other hosts, and so can a cookie banner or an ad blocker. Open the browser console on your page and look for a message that names the embed's address. A page can also block a frame with script, which this tool cannot see.

The preview shows an error, but the embed works on my site. Why?

The preview runs in a locked sandbox, and frames inside it are locked too. An embed that needs its own cookies or storage can refuse to run there. If the report shows no problem and the embed works on your page, the code is correct.

How do I make an iframe fit a phone?

Change the fixed width to width="100%" and add style="aspect-ratio: 16 / 9; height: auto" to keep the shape of a video. For other frames, style="max-width: 100%" is sufficient.

Which embeds can I test?

Any HTML embed code up to 20 KB: videos, maps, social posts, music players, forms, calendars, code samples, and widgets that load with a script.

Related tools

All tools