Converts a length between metric and US/imperial units using exact NIST SP 811 meter-equivalents.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
value (number, from_unit, required) : The length to convert
from_unit (string, required) one of: mm, cm, m, km, in, ft, yd, mi, nmi : Unit of the input value
to_unit (string, required) one of: mm, cm, m, km, in, ft, yd, mi, nmi : Unit to convert into
Outputs
result (to_unit): The converted length
Steps
Look up the exact meter-equivalent of from_unit and of to_unit from the NIST SP 811 table.
Convert the input to meters: meters = value * meters_per(from_unit).
Convert meters to the target unit: result = meters / meters_per(to_unit).
Round result to 6 significant figures.
Constants
mm = 0.001 m (source: Guide for the Use of the International System of Units (SI))
cm = 0.01 m (source: Guide for the Use of the International System of Units (SI))
m = 1 m (source: Guide for the Use of the International System of Units (SI))
km = 1000 m (source: Guide for the Use of the International System of Units (SI))
in = 0.0254 m (source: Guide for the Use of the International System of Units (SI))
ft = 0.3048 m (source: Guide for the Use of the International System of Units (SI))
yd = 0.9144 m (source: Guide for the Use of the International System of Units (SI))
mi = 1609.344 m (source: Guide for the Use of the International System of Units (SI))
nmi = 1852 m (source: Guide for the Use of the International System of Units (SI))
Sources
Guide for the Use of the International System of Units (SI) (National Institute of Standards and Technology, 2026-09-30T19:29:48Z) - in, ft, yd, mi, nmi are exact by international/nautical-mile definitions; mm, cm, km are exact SI decimal multiples of the meter.