Embed a unit converter

Add a free converter to any site with one async script or a lazy iframe. No sign-up. Host pages stay fast if you keep the snippet async and sized.

Snippets below are prefilled for kw to ps (kw-to-ps). Canonical URL stays /embed.

How to embed

  1. Copy a snippet. Copy the recommended async JavaScript widget or the lazy iframe. Add ?pair= on this page to prefill a published converter such as psi-to-kpa or m-to-ft.
  2. Paste it on your page. Place the snippet where the calculator should appear. Keep the script async, or add loading="lazy" on the iframe, so the host page stays fast.
  3. Keep the Powered by credit. Leave the visible Powered by AllUnitConversions link in place. It deep-links with ?ref=embed for analytics and canonicalizes to the clean URL.

Recommended: async JavaScript widget

The script is a small static file. Use async so it never blocks your page. Place the div where the calculator should appear. Optional attributes: data-pair, data-category, data-from, data-to, data-value.

<!-- Powered by AllUnitConversions https://allunitconversions.com/kw-to-ps?ref=embed -->
<div data-allunitconversions-widget data-pair="kw-to-ps" data-value="10"></div>
<script src="https://allunitconversions.com/_assets/converter-widget.js" async></script>

Alternative: lazy iframe

Point the iframe at /widget. That route is a static document (no site chrome) so it does not pull this app's React bundle into your page. Add loading="lazy" and a ?pair= deep-link when you want a preset.

<iframe
  src="https://allunitconversions.com/widget?pair=kw-to-ps"
  title="kw to ps converter"
  width="320"
  height="240"
  loading="lazy"
  referrerpolicy="strict-origin-when-cross-origin"
  style="border:0;border-radius:8px;max-width:100%;"
></iframe>
<!-- Powered by AllUnitConversions https://allunitconversions.com/kw-to-ps?ref=embed -->

Live examples

kw to ps

Async JS widget with data-pair="kw-to-ps".

Volume · liters to gallons

Second async instance on the same page.

Temperature · iframe

Lazy iframe of /widget?pair=c-to-f (compact 320×240).

Sizing

PresetWidthHeightUse
Compact320px240pxSidebar, cards, and docs asides.
Default360px280pxArticle body or classroom page.
Wide420px320pxGive the category widget more room.

For a responsive iframe, wrap it in a container with max-width: 100% and keep the iframe width at 100% of that container. The JS widget maxes out at 420px and shrinks with the host column.

Allowed domains

  • Any public HTTPS site may embed. /widget is framed with Content-Security-Policy: frame-ancestors * and does not send X-Frame-Options: SAMEORIGIN. Other routes stay clickjack-protected.
  • Your host page must allow our origin. For the async widget, add https://allunitconversions.com to script-src. For the iframe, allow it in frame-src.
  • We do not currently restrict embeds to an allowlist. If you need a private allowlist later, contact us before going live.

Referral links and canonicals

Every embed shows a visible Powered by AllUnitConversions link, and snippets include the same credit as an HTML comment. The link deep-links to the matching published pair when one exists (otherwise the category hub or homepage) with ?ref=embed.

  • ?ref=embed is ignored for on-page UX. Calculators, copy, and navigation do not change.
  • Analytics can read the query on first load, then the client strips it (same as UTM parameters) so the address bar returns to the clean URL.
  • Page metadata always canonicalizes to the clean path. Example: https://allunitconversions.com/m-to-ft?ref=embed canonicalizes to https://allunitconversions.com/m-to-ft. Referral URLs are not added to sitemaps, so they are not indexable soft duplicates.
  • /widget itself is noindex and canonicalizes to https://allunitconversions.com/widget without query strings.
  • This docs page canonicalizes to https://allunitconversions.com/embed even when opened with ?pair= prefill.

More

The category widget (length, pressure, force, power, volume) also has a dedicated landing page at /embed/unit-converter-widget. Prefer this docs page when you need sizing, domain, or referral details.