UCUM Unit Converter & Validator
Convert values between units of measure — metric, imperial, clinical and scientific — and validate UCUM codes. Exact arithmetic, entirely in your browser.
Validate a UCUM code
Convert a value
About UCUM and unit conversion
UCUM (Unified Code for Units of Measure) is a machine-readable
syntax for units used in healthcare and scientific data exchange, for example in
HL7 FHIR and LOINC records. Instead of free-text labels like “mg/dl”
or “mm Hg”, UCUM defines a single unambiguous code for every unit,
such as mg/dL and mm[Hg]. A code can also be a compound
expression: kg/m2 (body mass index), m/s (speed),
mmol/L (concentration) or kW.h (energy).
This tool does two things. The converter takes a number and two units of the same dimension and computes the equivalent value — metres to feet, kilograms to pounds, Celsius to Fahrenheit, mmHg to kPa, mg/dL to mmol/L and many more. The validator parses a UCUM expression and tells you whether it is legal, and if not, exactly where the problem is.
Conversions use exact rational arithmetic rather than floating point, so factors
such as 2.54 cm per inch are applied without rounding error. Results that
cannot be written as a finite decimal are rounded to 15 significant digits and
marked with ≈. Numbers may be entered as 1.5, 1,5,
1e-3 or 1/3, and negative values are supported, which is
useful for temperatures.
Every conversion is mirrored into the page address, so the URL always describes the value and units currently on screen. Press Copy link (or copy the address bar) to share the exact conversion — opening the link restores it.
Frequently asked questions
What is UCUM?
UCUM (Unified Code for Units of Measure) is a machine-readable syntax for
units of measure used in healthcare and scientific data exchange, such as
HL7 FHIR and LOINC. Examples of UCUM codes are kg/m2,
mm[Hg], Cel, [degF] and
mg/dL. See ucum.org
for the specification.
Which units can I convert?
Any two UCUM units of the same dimension can be converted, including length,
mass, volume, time, temperature, pressure, energy, power, electric and
magnetic units, radiation, substance amounts, and compound units such as
m/s, kg/m2, mg/dL and
mmol/L.
How do I validate a UCUM code?
Type the expression into the validator field. The parser reports either that
the code is valid or the exact error and its position, for example:
unknown unit "zzz" at position 0.
Are the conversions exact?
Conversion factors are applied as exact rational numbers rather than floating point values. Results that terminate are shown exactly; other results are rounded to 15 significant digits and marked with the approximately equal sign (≈).
Can I share or bookmark a conversion?
Yes. The value and both units are written into the page URL, for example
?value=1&from=km&to=m. Copy the address bar or press
Copy link and the recipient opens exactly the same
conversion.
Is my data sent to a server?
No. The UCUM implementation is compiled to WebAssembly and runs locally in the browser, so conversion and validation never leave the page.