HomeUnit Conversion › Length Converter

Length Converter

Converts a length or distance between metric (nm to km), imperial/US (in, ft, yd, mi), nautical and astronomical units using exact NIST factors (1 in = 0.0254 m, 1 mi = 1609.344 m).

When to use

You need a distance, height or length in a different unit, e.g. miles to kilometres, feet to metres or inches to centimetres.

Do not use when: You need an area (use area), a volume (use volume), or a speed (use speed); for walking distance from step counts use steps-to-distance.

Formula

result = value × factor, factor = (1 from_unit in m) / (1 to_unit in m)

Inputs

ParameterTypeUnitRequiredDescription
valuenumberyesAmount to convert, expressed in from_unit.
from_unitenum: nm | um | mm | cm | m | km | in | ft | yd | mi | nmi | fathom | au | lyyesUnit of the input value. Accepted symbols: nm, um, mm, cm, m, km, in, ft, yd, mi, nmi, fathom, au, ly; spelled-out names and common abbreviations are accepted too.
to_unitenum: nm | um | mm | cm | m | km | in | ft | yd | mi | nmi | fathom | au | lyyesUnit to convert into (same symbols as from_unit).

Outputs

OutputTypeUnitDescription
resultnumberConverted value expressed in to_unit (rounded to 6 decimals; see result_text for very small or very large values).
result_textstringThe conversion as text with 6 significant figures, e.g. "5 mi = 8.04672 km".
formulastringRelation used, e.g. "1 mi = 1.609344 km".
factornumberMultiplier from from_unit to to_unit (result = value × factor); absent for non-linear conversions.
conversion_tableobjectThe input value expressed in every supported length unit (6 significant figures), keyed by unit symbol.

Example

5 miles to kilometres: {"value":5,"from_unit":"mi","to_unit":"km"}{"result":8.04672,"factor":1.609344,"formula":"1 mi = 1.609344 km","result_text":"5 mi = 8.04672 km","conversion_table":{"m":8046.72,"ft":26400}}

6 feet to centimetres: {"value":6,"from_unit":"ft","to_unit":"cm"}{"result":182.88,"factor":30.48,"conversion_table":{"in":72,"m":1.8288}}

GET https://tttkmbb.com/api/v1/calculate/length?value=5&from_unit=mi&to_unit=km

Machine access

Sources

FAQ

Which mile is used?

The international statute mile (1609.344 m exactly). Nautical miles (1852 m) are the separate unit nmi.

Are the factors exact?

Yes for all SI and customary units: 1 in = 25.4 mm exactly by the 1959 international yard and pound agreement, so ft, yd and mi are exact multiples. The light-year uses the IAU Julian year (9 460 730 472 580 800 m).

Related calculators