Developer & data tools

UnitProof Unit Calculator

Unit maths you can audit: dimension check, exact factors and a full derivation tree.

Numbers, units with SI prefixes, ^ powers, * / + − and parentheses; optional "to"/"in" target. Juxtaposition (e.g. "2 h") binds tighter than * and /. Bare C/F mean °C/°F.

Try an example: Distance: 3.5 km/h for 2 h in metres · Temperature: 72 °F in °C · Energy: 1500 W for 3 h in kWh · Force: 75 kg at 9.81 m/s² · Mixed lengths: 1 mi + 200 m in km · Opaque currency: 5 USD/kg × 2.5 kg

How it works

Type an expression such as "3.5 km/h * 2 h to m", "72 F to C" or "1500 W * 3 h to kWh". UnitProof parses it, checks dimensions over the SI base units, applies exact NIST/SI conversion factors and shows every step as a derivation tree, including correct absolute-vs-difference temperature handling.

  • A tokenizer and recursive-descent parser read numbers (incl. scientific notation), units with SI prefixes (q…Q, incl. µ/u) and binary prefixes (Ki…Ei for bit/B), ^ powers (also ² ³ and "m2"), × ÷ + − and parentheses. Juxtaposition ("2 h", "kg m") binds tighter than explicit * and /, so "60 km / 2 h" = 30 km/h.
  • Every quantity is a value in coherent SI units plus a dimension vector over m, kg, s, A, K, mol, cd and bit; ISO 4217 currency codes are carried as opaque dimensions (never converted). The table has 144 named units.
  • Multiplication adds dimension exponents, division subtracts them, powers scale them; addition, subtraction and conversion require identical dimensions, otherwise the calculation stops with an explanation of the mismatch.
  • Temperatures: "72 F" or "-40 C" (a number directly followed by °C/°F) is an absolute temperature converted with its offset; absolute − absolute gives a difference; absolute ± difference stays absolute; multiplying, dividing or powering °C/°F is refused as ambiguous (use K or deltaC/deltaF). Converting a difference to °C/°F applies only the scale factor.
  • Exact factors follow the SI Brochure (9th ed.) and NIST SP 811 Appendix B (international foot/pound, US liquid gallon = 231 in³, Btu_IT, thermochemical calorie, etc.); conventional or measured values (mmHg, inHg, dalton) are flagged as not exact.
  • The derivation graph lists literals, unit definitions (with factor), operations and the final conversion; values are IEEE-754 doubles, shown unrounded and rounded to the requested significant digits.

Sources

For scripts and AI agents

  • JSON API: POST https://unitproof.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://unitproof.usefulweb.site/mcp · tool name unitproof
Example request
curl -s -X POST https://unitproof.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"expression":"3.5 km/h * 2 h to m"}'
Feedback