Skip to converter

Developers

A free JSON factor API and a copy-paste converter widget, both built on the same exact factors as the rest of UnitGlide. No key, no sign-up.

JSON API

The API is a set of static JSON files, generated at build time from the same data as the converters. Every response is CORS-open, so you can fetch it straight from the browser. The one you need for converting is the factor table: every unit with its factor to the base unit of its category, an exactness flag and the defining source. It is the machine-readable version of the methodology page.

Request

https://unitglide.net/api/v1/factors

Response (abridged)

{
  "ok": true,
  "units": [
    {
      "id": "lb",
      "name": "Pound",
      "symbol": "lb",
      "category": "mass",
      "baseUnit": { "id": "kg", "name": "Kilogram", "symbol": "kg" },
      "factorToBase": 0.45359237,
      "exact": true,
      ...
    },
    ...
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "attribution": "UnitGlide, https://unitglide.net"
}

To convert, multiply the value by the factor of the unit you convert from and divide by the factor of the unit you convert to. Both units must be in the same category. That is the exact arithmetic every converter on this site runs, so the result is identical to the full-precision number the site computes. Temperature is the one exception: its factorToBase is null because the scales do not share a zero, and it converts by the formulas on the Celsius to Fahrenheit page.

Convert 5 kg to pounds

const res = await fetch("https://unitglide.net/api/v1/factors");
const { units } = await res.json();
const factor = Object.fromEntries(units.map((u) => [u.id, u.factorToBase]));

// value x factor(from) / factor(to), both units in the same category
const lb = (5 * factor.kg) / factor.lb; // 11.023113109243878

Unit ids are the short slugs used across the site (kg, lb, cm, c, f…). The full catalogue of categories and unit ids is at /api/v1/units and the factor table at /api/v1/factors. The unversioned /api/units still works with an unchanged response; it is deprecated and returns a Deprecation header plus a Link header pointing at /api/v1/units.

The per-query endpoints /api/convert and /api/v1/convert were retired on 13 October 2026, so that the whole site, API included, is served as static files. Those URLs now return a 404. Fetching the factor table once gives the same numbers for every pair, without a request per conversion. The API changelog has the details.

Embeddable widget

Drop a converter onto any page with an <iframe>. Swap kg-to-lb for any pair slug on the site. The attribution link below the frame is appreciated rather than required, and keeping it is the main thing that makes the widget worth publishing for free.

Copy this

<iframe src="https://unitglide.net/embed/kg-to-lb"
        width="360" height="200" loading="lazy"
        style="border:1px solid #e2e6ec;border-radius:12px"
        title="Kg to Lbs converter"></iframe>
<p><a href="https://unitglide.net/convert/kg-to-lb">Kg to Lbs Converter</a> by UnitGlide</p>

Result

Licence and attribution

Both the API and the widget are free for personal and commercial use, and there are two different rules depending on what you do with them.

  • Republishing the reference data: attribution required. The conversion factors and the reference tables are published under CC BY 4.0. If you copy the numbers into your own pages, dataset, app or documentation, the licence requires credit: UnitGlide with a link to unitglide.net. Every /api/v1/ response repeats that in its license and attribution fields so you can carry it through automatically.
  • Calling the API or embedding the widget: attribution appreciated. Showing a converted value in your own interface is normal use and needs no credit. A link back is genuinely appreciated and helps keep this free, but nothing is withheld if you leave it out.

Fair use

There is no key, no quota and no account. The documented fair-use expectation is up to 10 requests per second and 100,000 requests per day per project. To be plain about it: none of that is enforced. This site is fully static with no backend and no database, so there is no rate limiter, no counter and no way for us to cut anyone off. The figure is an expectation, not a technical limit.

The factors only change when a definition does, and every such change is logged on the changelog, so fetch /api/v1/factors once, cache it and do the arithmetic locally, which is faster and works offline. The service is provided as-is with no uptime guarantee. A question? Get in touch.

Spec and changelog

The machine-readable contract for the versioned endpoints is an OpenAPI 3.1 document at /api/openapi.json, which you can point a client generator or an API browser straight at. Dated versions, new endpoints and deprecations are listed on the API changelog.

Embed a reference table instead

Some pages want a table rather than an input box. The reference data pages each ship the same way: an <iframe> at /embed/reference/<slug> with the attribution built in, plus the full table on the page under a CC BY 4.0 licence if you would rather hold the numbers yourself. 8 are published, among them the EU nutrition label energy factors and the decimal versus binary byte units.

How the numbers are derived

Every value the API and widget return comes from the exact SI and NIST factors documented on the methodology and sources page.