Home › Unit 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
value | number | yes | Amount to convert, expressed in from_unit. | |
from_unit | enum: nm | um | mm | cm | m | km | in | ft | yd | mi | nmi | fathom | au | ly | yes | Unit 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_unit | enum: nm | um | mm | cm | m | km | in | ft | yd | mi | nmi | fathom | au | ly | yes | Unit to convert into (same symbols as from_unit). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
result | number | Converted value expressed in to_unit (rounded to 6 decimals; see result_text for very small or very large values). | |
result_text | string | The conversion as text with 6 significant figures, e.g. "5 mi = 8.04672 km". | |
formula | string | Relation used, e.g. "1 mi = 1.609344 km". | |
factor | number | Multiplier from from_unit to to_unit (result = value × factor); absent for non-linear conversions. | |
conversion_table | object | The 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
- API:
GET https://tttkmbb.com/api/v1/calculate/length(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/length · Markdown: https://tttkmbb.com/conversion/length.md · JSON definition: https://tttkmbb.com/conversion/length.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="length" - OpenAPI operationId:
convert_length - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- Area Converter — Convert square units of the same lengths.
- Speed Converter — Convert distance-per-time units such as mph and km/h.
- Steps to Distance Calculator — Turn step counts into distance.