ForHosting KIT · Unit converters

Astronomical distance converter

Light-years, parsecs and astronomical units in one converter: 1 AU is 149,597,870.7 km, and every value passes through exact definitions, so solar-system figures, star catalogues and popular science articles agree with each other. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Value
1
From
Au
To
Km
You get
Result
149,597,870.7 km
Converted
149,597,870.7
Value m
149,597,870,700
Factor
149,597,870.7

An astronomical distance converter turns one celestial length into another unit without spreadsheet factor tables or memorized constants. Enter a finite value plus a source unit and a target unit among astronomical units, light-years, parsecs, kilometres, and statute miles; the tool returns the converted distance, the SI intermediate in metres, the exact unit factor applied, and step-by-step substitution lines you can paste into a report or homework check. Students comparing textbook AU and light-years, amateurs reading stellar catalogues in parsecs, science writers switching between kilometres and miles, and pipeline jobs that normalize mixed distance fields all need the same deterministic path.

Which astronomical units are supported and how conversion works

This capability converts among five distance units that dominate solar-system work, stellar catalogues, popular science, and mixed metric-imperial reporting. The SI metre is the internal hub: every conversion multiplies the input by how many metres equal one source unit, then divides by how many metres equal one target unit. The astronomical unit uses the IAU 2012 exact definition of one hundred forty-nine billion five hundred ninety-seven million eight hundred seventy thousand seven hundred metres.

A light-year is the distance light travels in vacuum in one Julian year: the exact speed of light times three hundred sixty-five point two five days of eighty-six thousand four hundred seconds each. A parsec uses the exact geometric definition of six hundred forty-eight thousand over pi astronomical units, so AU-to-parsec ratios stay consistent with the same AU constant. Kilometres are one thousand metres; statute miles use the international mile of one thousand six hundred nine point three four four metres.

Same-unit requests succeed and return the input magnitude with a short message that no change of unit was required.

Practical tips, limits, and when to use this landing

Prefer sending bare numbers for value when you control the client; string numbers are accepted only when they match a strict finite numeric pattern without thousand separators or unit suffixes in the number field. Round-trip checks are straightforward: convert A to B and B back to A and confirm you recover the original within the published twelve-decimal rounding. When teaching scale, pair classic examples such as one astronomical unit to kilometres, one light-year to parsecs, and four point three light-years (approximate Proxima Centauri distance) into AU or kilometres.

Stay inside the absolute range so intermediate metre values cannot overflow. This landing targets people searching for an astronomical distance converter, AU to light years, parsecs to kilometres, or light-years to miles online; it is not a general everyday length converter for metres and inches, not an angular-size tool, not a redshift distance calculator, and not a travel-time light-delay solver.

Homework and lab scale checks

Students convert textbook AU and light-year figures into kilometres or parsecs and compare deterministic steps against hand calculations before submission.

Catalogue and pipeline normalization

Data jobs normalize mixed stellar or solar-system distance fields into one canonical unit before analytics, charts, or cross-matching services.

Science writing and outreach copy

Writers and educators convert parsecs or light-years into kilometres and miles so popular articles and planetarium scripts use familiar everyday units.

Which distance units does this converter support?

Five: astronomical units (au), light-years (ly), parsecs (pc), kilometres (km), and statute miles (mi).

What definition of AU, light-year, and parsec is used?

AU is the IAU 2012 exact value 149597870700 m. A light-year is c times one Julian year. A parsec is exactly (648000/π) AU. Miles use the international statute mile 1609.344 m.

Does this convert megaparsecs or redshift distances?

No. Only au, ly, pc, km, and mi. Cosmological redshift distance or Mpc scales are out of scope for this landing.

Is the astronomical distance converter free?

The browser tool is free and runs locally.

Can it work out a star's distance from its brightness?

No. Getting a distance from apparent and absolute magnitude is a different calculation. This converter takes a distance you already have and changes its unit between AU, light-years, parsecs, kilometres and miles.

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.

POSThttps://api.kit.forhosting.com/conv/astronomical-distance

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.

curl -X POST https://api.kit.forhosting.com/conv/astronomical-distance \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":1,"from":"au","to":"ly"}'
{
  "value": 1,
  "from": "au",
  "to": "ly"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "conv.astronomical_distance",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs1e+30
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Unknown unit names fail with a clear invalid_input error instead of silent wrong factors.

Which astronomical units are supported and how conversion works

Common aliases are accepted case-insensitively: ua and astronomical unit for au, light year and light-years for ly, parsec and parsecs for pc, kilometer and kilometre spellings for km, and mile or miles for mi. If the name is not on that list the solver rejects the request with invalid_input naming the bad field and listing supported units, so clients never guess whether a typo produced a wrong number. Absolute magnitude must stay within the published limit so intermediate metre products remain finite in IEEE double precision on the Worker and in the browser.

How to call the API and read the response

Value must be a finite number or a strict numeric string within absolute limits. Wire this into educational apps, catalogue importers, or batch jobs that already hold a distance reading and only need a second unit for display or cross-system comparison without shipping floating conversion tables in every binary. Send a JSON body with three required fields: value (aliases distance, amount, v, and d), from (aliases from_unit, unit_from, and source), and to (aliases to_unit, unit_to, and target). From and to must resolve to supported unit names after alias normalization. On success the response echoes the rounded input value, canonical from and to labels, result and converted set to the same rounded target magnitude, value_m as the SI intermediate in metres, unit as the target label, factor as the from-to multiplier, formula as the short equation string, message as an English summary, steps as ordered substitution lines, and supported_units as the five canonical identifiers au, ly, pc, km, and mi. Failed validation—missing fields, non-finite numbers, values outside absolute limits, or an unknown unit name—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.

Practical tips, limits, and when to use this landing

Normalize display labels on your side if you need full spellings for a UI—this API always returns the short canonical tokens au, ly, pc, km, and mi so automated tests stay stable. Prefer this capability when both endpoints are among the five supported astronomical or SI length units and you need deterministic IAU factors and step strings; if you only need to reformat a number for a locale without changing physical unit, use a number-format capability instead. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients deliberately probe unknown unit names such as furlongs or megaparsecs that this converter does not implement.

What happens if I send an unknown unit?

The API returns invalid_input naming the field and listing supported units. Failed validation is never charged.

Read the full KIT documentation →