Length converter
Change one measurement into another unit in a single step: 5 kilometers come out as 3.106855961187 miles. Every pair goes through the meter with the exact international foot, inch, yard and mile, so a road, a parcel or a room measures the same everywhere. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Value
- 5
- From
- kilometers
- To
- miles
- Value
- 3.1068559612
- Input
- 5
- Meters
- 5,000
This length converter turns a single number from one length unit into another without spreadsheets, half-remembered constants, or rounding surprises that differ between tools. You pass a numeric value plus a source unit and a target unit — meters, kilometers, miles, feet, inches, yards, centimeters or millimeters — and receive a deterministic result grounded in the international yard and meter definitions. Unknown unit names fail clearly instead of inventing a number.
Why a dedicated length converter still matters
People search for a length converter when they already know the quantity is a distance or dimension: a road segment in kilometers that must become miles, a product height in millimeters that design specs list in inches, or a construction measurement that jumps between feet and meters. A general multi-family unit tool can do the arithmetic, but a focused length page answers that intent with clearer defaults, clearer errors, and copy that matches how builders, travelers, and engineers actually talk.
This capability accepts full unit names and common short forms, normalizes them, and converts through meters as the intermediate scale so every pair shares the same definitions. The international foot and inch are fixed at 0.3048 m and 0.0254 m; the statute mile is 1609.344 m; the yard is 0.9144 m. Those constants do not drift with locale settings or browser math quirks.
How the conversion request and response work
Send three fields: value (the finite number you want to convert), from (the unit of that number), and to (the unit you need). Singular and plural forms are accepted and folded to a canonical label in the response so clients can display consistent wording. The engine multiplies the input by the source factor in meters, divides by the target factor, and rounds to a fixed precision so repeated calls stay byte-stable for tests and caches.
Negative lengths are allowed when your domain needs them (for example signed offsets); non-finite values such as NaN or Infinity are rejected.
Where teams plug it in and what it costs
Product teams embed this length converter in checkout flows that show dimensions in the shopper’s preferred system, in logistics tools that compare carrier limits stated in different units, and in data-cleaning jobs that normalize mixed CSV columns before analytics. Document the unit vocabulary your users type, map UI labels to the allowed names, and treat unknown unit errors as user-fixable feedback rather than internal faults. The result is a small, dependable building block for any workflow that must speak both metric and imperial without spreadsheet drift.
What you can do with it
Product dimensions on storefronts
Convert package size from millimeters or centimeters into inches for regional product pages while keeping the metric source as the system of record.
Travel and mapping distances
Turn route lengths stored in kilometers into miles for audiences that expect imperial road signs, without hand-edited constants in the front end.
Construction and CAD handoffs
Normalize feet, inches and meters when exchanging measurements between teams that still mix site notes with SI drawings.
FAQ
Which length units are supported?
Meters, kilometers, miles, feet, inches, yards, centimeters and millimeters, including common short forms such as m, km, mi, ft, in, yd, cm and mm.
Can I convert weight or temperature here?
Sending a non-length unit name fails with an unknown-unit error so mixed-domain inputs do not silently convert.
What does it cost?
The interactive page runs free in your browser.
How many miles are 5 kilometers?
5 kilometers are 3.106855961187 miles. The converter first turns them into 5000 meters and then divides by 1609.344, the exact number of meters in one statute mile.
Can I type short forms like ft, km or mm?
Yes. The short forms m, km, mi, ft, in, yd, cm and mm are understood, and so are singular and plural names such as foot or feet. A name that is not a length is refused instead of guessed.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/conv/length \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"value":5,"from":"kilometers","to":"miles"}'const res = await fetch("https://api.kit.forhosting.com/conv/length", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": 5,
"from": "kilometers",
"to": "miles"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/conv/length",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"value": 5,
"from": "kilometers",
"to": "miles"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/conv/length", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"value":5,"from":"kilometers","to":"miles"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"value":5,"from":"kilometers","to":"miles"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/conv/length", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"value": 5,
"from": "kilometers",
"to": "miles"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "conv.length",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Use it free in the browser on this page, or call the same logic by API for automation at $0.002 per request.
Why a dedicated length converter still matters
If you type a unit that is not in the allowed set — weight, volume, or a misspelled name — the call fails with an explicit unknown-unit message so pipelines stop instead of shipping a wrong figure.
How the conversion request and response work
Supported names include meters, kilometers, miles, feet, inches, yards, centimeters and millimeters, plus short aliases such as m, km, mi, ft, in, yd, cm and mm. The JSON result includes the converted value, the original input, the canonical from and to labels, and the intermediate length in meters for audit trails. Missing fields produce invalid_input with a message that names what was wrong, which keeps form validation and API error handling aligned.
Where teams plug it in and what it costs
Prefer this endpoint when your search intent or UI is specifically about length; keep broader multi-category converters for mixed scientific tables.
Technical questions
What happens if I send an unknown unit name?
The capability returns invalid_input and names the unknown unit. It does not guess, fall back to another family, or invent a conversion factor.
How accurate are the conversions?
Factors use the international definitions: 1 inch = 0.0254 m, 1 foot = 0.3048 m, 1 yard = 0.9144 m, 1 mile = 1609.344 m, with metric prefixes as exact powers of ten. Results are rounded to a stable fixed precision for repeatable API output.