Unit Converter API
Convert a value between units of length, mass, temperature, volume, area, speed, data, time, energy, pressure or fuel economy. Leave out `to` to get every unit in the category.
POST /api/v1/tools/unit-converterMCP unit_converterCalculatorsConvert length, weight, temperature, volume, area, speed, data size, time, energy, pressure and fuel economy, with every unit for your value in one table.
Input
Send these as a JSON object. Unknown fields are rejected.
- value
- The value to convert. (number, required)
- from
- Unit id to convert from. Length: nm, um, mm, cm, m, km, in, ft, yd, mi, nmi. Mass and weight: mg, g, kg, t, oz, lb, st, us-ton, uk-ton. Temperature: celsius, fahrenheit, kelvin, rankine. Volume: ml, l, m3, metric-tsp, metric-tbsp, metric-cup, us-tsp, us-tbsp, us-fl-oz, us-cup, us-pint, us-quart, us-gallon, imp-fl-oz, imp-cup, imp-pint, imp-quart, imp-gallon, in3, ft3. Area: mm2, cm2, m2, ha, km2, in2, ft2, yd2, acre, mi2. Speed: mps, kph, mph, knot, fps. Data size: bit, kbit, mbit, gbit, byte, kb, mb, gb, tb, pb, kib, mib, gib, tib, pib. Time: ns, us, ms, s, min, h, day, week, month, year. Energy: j, kj, cal, kcal, wh, kwh, btu, ev, ft-lbf. Pressure: pa, hpa, kpa, mpa, mbar, bar, atm, psi, torr, mmhg, inhg. Fuel economy: l-per-100km, km-per-l, mpg-us, mpg-uk. (string, one of nm, um, mm, cm, m, km, in, ft, yd, mi, nmi, mg, g, kg, t, oz, lb, st, us-ton, uk-ton, celsius, fahrenheit, kelvin, rankine, ml, l, m3, metric-tsp, metric-tbsp, metric-cup, us-tsp, us-tbsp, us-fl-oz, us-cup, us-pint, us-quart, us-gallon, imp-fl-oz, imp-cup, imp-pint, imp-quart, imp-gallon, in3, ft3, mm2, cm2, m2, ha, km2, in2, ft2, yd2, acre, mi2, mps, kph, mph, knot, fps, bit, kbit, mbit, gbit, byte, kb, mb, gb, tb, pb, kib, mib, gib, tib, pib, ns, us, ms, s, min, h, day, week, month, year, j, kj, cal, kcal, wh, kwh, btu, ev, ft-lbf, pa, hpa, kpa, mpa, mbar, bar, atm, psi, torr, mmhg, inhg, l-per-100km, km-per-l, mpg-us, mpg-uk, required)
- to
- Unit id to convert to, in the same category as from. Omit to convert to every unit in the category. (string, one of nm, um, mm, cm, m, km, in, ft, yd, mi, nmi, mg, g, kg, t, oz, lb, st, us-ton, uk-ton, celsius, fahrenheit, kelvin, rankine, ml, l, m3, metric-tsp, metric-tbsp, metric-cup, us-tsp, us-tbsp, us-fl-oz, us-cup, us-pint, us-quart, us-gallon, imp-fl-oz, imp-cup, imp-pint, imp-quart, imp-gallon, in3, ft3, mm2, cm2, m2, ha, km2, in2, ft2, yd2, acre, mi2, mps, kph, mph, knot, fps, bit, kbit, mbit, gbit, byte, kb, mb, gb, tb, pb, kib, mib, gib, tib, pib, ns, us, ms, s, min, h, day, week, month, year, j, kj, cal, kcal, wh, kwh, btu, ev, ft-lbf, pa, hpa, kpa, mpa, mbar, bar, atm, psi, torr, mmhg, inhg, l-per-100km, km-per-l, mpg-us, mpg-uk)
curl https://pithlab.com/api/v1/tools/unit-converter \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"value":5,"from":"km","to":"mi"}'Example response
{
"ok": true,
"result": {
"value": 3.10685596118667,
"formatted": "3.10685596119",
"unit": "mi",
"text": "5 km = 3.10685596119 mi"
}
}