Length converter
Convert between metric, imperial/US, nautical and astronomical lengths.
- Version 1
- Checked against 6 published values
- Free, no sign-up
Result: One parsec in light-years
| Result The converted value. |
3.26156377716743 rounded |
|---|---|
| Factor How many to_unit make one from_unit (multiply by this to convert). |
3.26156377716743 rounded |
Rounding: Half even, 15 significant digits. Calculator units/length@1.
How it is calculated
result = value × factor(from_unit) ÷ factor(to_unit), factors in mConvert between metric, imperial/US, nautical and astronomical lengths. Conversion factors are exact values from the official unit definitions, so the result is exact before the single final rounding. Leave out to_unit to get the value in every supported unit.
- Unit definitions: 1 m = 1 m (SI base unit); 1 km = 1000 m (SI prefix); 1 cm = 0.01 m (SI prefix); 1 mm = 0.001 m (SI prefix); 1 um = 0.000001 m (SI prefix); 1 nm = 0.000000001 m (SI prefix); 1 in = 0.0254 m (international inch, exact since 1959); 1 ft = 0.3048 m (international foot = 12 in); 1 yd = 0.9144 m (international yard = 3 ft); 1 mi = 1609.344 m (international mile = 5280 ft); 1 nmi = 1852 m (international nautical mile, exact); 1 mil = 0.0000254 m (1/1000 inch); 1 fathom = 1.8288 m (6 ft); 1 chain = 20.1168 m (66 ft); 1 furlong = 201.168 m (660 ft); 1 ft_us = 1200/3937 m (1200/3937 m; retired by NIST at the end of 2022 but still in old land records); 1 au = 149597870700 m (IAU 2012 Resolution B2, exact); 1 ly = 9460730472580800 m (speed of light × Julian year (IAU)); 1 pc = see source m (648000/π au, IAU 2015 Resolution B2)
References
- NIST Special Publication 811 (2008), Appendix B: conversion factors
- IAU 2012 Resolution B2 (astronomical unit)
- IAU 2015 Resolution B2 (parsec)
- NIST: The U.S. survey foot (deprecation notice)
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/units/length \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "1",
"from_unit": "pc",
"to_unit": "ly"
}'
The same call in Python
import os
import requests
payload = {
"value": "1",
"from_unit": "pc",
"to_unit": "ly",
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/units/length",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"value": "1",
"from_unit": "pc",
"to_unit": "ly",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/units/length", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_units_length at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="units/length" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
Add this calculator to your website
Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.
Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.