# 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).

- Calculator id: `length` · Category: Unit Conversion (`conversion`) · Tool name: `convert_length`
- Canonical page: https://tttkmbb.com/conversion/length · This document: https://tttkmbb.com/conversion/length.md · JSON definition: https://tttkmbb.com/conversion/length.json

## Purpose

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).

**Use when:** 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.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | number |  | required | Amount to convert, expressed in from_unit. |
| `from_unit` | enum: nm \| um \| mm \| cm \| m \| km \| in \| ft \| yd \| mi \| nmi \| fathom \| au \| ly |  | required | 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 |  | required | Unit to convert into (same symbols as from_unit). |

## Output

| Field | 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. |

## Formula

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

## Data Sources

- NIST Special Publication 811 – Guide for the Use of the International System of Units (SI), Appendix B conversion factors — https://www.nist.gov/pml/special-publication-811 (standard, retrieved 2026-09-23)
- BIPM – The International System of Units (SI Brochure, 9th edition) — https://www.bipm.org/en/publications/si-brochure (standard, retrieved 2026-09-23)
- Wikipedia – Conversion of units — https://en.wikipedia.org/wiki/Conversion_of_units (reference, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/length?value=…&from_unit=…&to_unit=…`
- `POST https://tttkmbb.com/api/v1/calculate/length` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/length · OpenAPI operationId `convert_length` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "length", "inputs": {…}}`

## Example

- 5 miles to kilometres: inputs `{"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: inputs `{"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
```

## Limitations

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. All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Area Converter](https://tttkmbb.com/conversion/area.md) — Convert square units of the same lengths.
- [Speed Converter](https://tttkmbb.com/conversion/speed.md) — Convert distance-per-time units such as mph and km/h.
- [Steps to Distance Calculator](https://tttkmbb.com/fitness/steps-to-distance.md) — Turn step counts into distance.
