Skip to main content

    Unit conversion API

    Every unit and conversion factor behind UnitConvertLab, published as static JSON. 466 units across 36 categories. No key, no sign-up, no rate limit.

    Endpoints

    PathReturns
    /api/v1/index.jsonService description: version, endpoint list, counts and licence.
    /api/v1/categories.jsonAll measurement categories with unit counts and base units.
    /api/v1/units.jsonEvery unit across every category (466 units) in one document.
    /api/v1/units/{category}.jsonUnits and conversion factors for a single category, e.g. length.

    Valid {category} values: length, mass, temperature, volume, area, speed, time, data, angle, current, energy, force, power, pressure, fuel, density, frequency, torque, radiation, luminance, illuminance, typography, blood_sugar, shoe_size, wire_gauge, paper_size, flow_rate, mass_flow, dynamic_viscosity, kinematic_viscosity, thermal_conductivity, specific_heat, magnetic_flux, magnetic_flux_density, molar_concentration, catalytic_activity.

    How units are described

    Every unit declares how it relates to its category base unit, so you never have to guess:

    • linearbase = value × factorToBase. Covers metres, grams, litres and most of the catalogue.
    • affinebase = value × factorToBase + offsetToBase. Used by offset scales such as Fahrenheit and Kelvin.
    • nonlinear — no closed factor (fuel economy, wire gauge). These ship a samples table of value/base pairs instead.

    Factors are derived from the same definitions the site itself uses, documented on the methodology page.

    Examples

    JavaScript

    // Convert 12 inches to centimetres, entirely client-side
    const res = await fetch('https://unitconvertlab.com/api/v1/units/length.json');
    const { units } = await res.json();
    
    const from = units.find((u) => u.id === 'inch');   // factorToBase: 0.0254
    const to   = units.find((u) => u.id === 'centimeter');
    
    const base = 12 * from.factorToBase;               // → metres
    const result = base / to.factorToBase;             // → 30.48

    Shell

    curl -s https://unitconvertlab.com/api/v1/units/temperature.json | jq '.units[] | {id, relation, factorToBase, offsetToBase}'

    Live response

    Loading…

    Licence

    Published under CC BY 4.0. Commercial use is fine; credit UnitConvertLab with a link wherever the data is shown.

    Prefer a ready-made UI? The embeddable converter widget uses these same factors.

    Frequently asked questions

    Is the UnitConvertLab data API free?

    Yes. Every endpoint is a static JSON file served from the CDN. There is no key, no sign-up, no quota and no rate limit — you can also mirror the files into your own build.

    How do I convert a value with the API?

    Fetch the category document and apply the published relationship. Linear units use base = value × factorToBase; affine units such as Fahrenheit use base = value × factorToBase + offsetToBase. Convert out of the base unit by inverting the target unit's relationship.

    How current are the conversion factors?

    The JSON is regenerated from the same definitions the website uses on every deployment, so the published factors always match the numbers shown in the converter. Each document carries a generatedAt date.

    Can I use the data commercially?

    Yes, under CC BY 4.0. Credit UnitConvertLab with a visible link wherever the data is displayed.