Hubble law calculator
A galaxy receding at 7,000 km/s with a Hubble constant of 70 km/s/Mpc lies 100 megaparsecs away, or 326156377.7 light-years. Enter the recession velocity and the Hubble constant to get the distance by Hubble's law, d = v / H0. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Recession velocity
- 7,000
- Hubble constant
- 70
- Distance
- 100
- Distance ly
- 326,156,377.7
- Redshift approx
- 0.0233494867
- Light travel time years
- 326,156,377.7
Hubble's law is the simple linear relation that links how fast a galaxy appears to recede with how far away it is in the expanding universe. In textbook form the approximate distance is d equals recession velocity v divided by the Hubble constant H0. When v is measured in kilometres per second and H0 in kilometres per second per megaparsec, d comes out in megaparsecs—the natural unit for nearby extragalactic work.
How Hubble's law estimates galaxy distance
Start from the classical Hubble–Lemaître relation: the recession velocity of a distant galaxy is approximately proportional to its distance, written v equals H0 times d, or rearranged d equals v divided by H0. The constant of proportionality H0 is the Hubble constant at the present epoch; modern determinations typically fall near sixty-seven to seventy-four kilometres per second per megaparsec depending on the probe, but homework sets and lab manuals often fix a single reference value such as seventy.
Hubble constant must be a finite non-zero number because division by zero is undefined; zero and near-zero H0 fail with invalid input instead of returning Infinity. Recession velocity may be positive for receding sources or negative for approaching ones under the same linear formula, producing a signed distance that callers interpret in context. This page intentionally uses the linear low-redshift approximation only; full Friedmann–Lemaître–Robertson–Walker integrals that depend on matter and dark-energy densities, luminosity distance versus angular-diameter distance, and peculiar-velocity corrections are separate search intents and separate landings.
Keep units consistent: convert miles per second or h-parameter forms into the pair you document so the numeric quotient matches the length unit your report claims.
Where Hubble-law distance calculators show up in real work
Secondary-school and introductory university astronomy courses assign Hubble diagram drills, Virgo-cluster distance estimates, and order-of-magnitude checks that rearrange the same formula; a single trusted oracle speeds grading and demo setup. Science communicators convert tabulated recession velocities into megaparsec and light-year scales for public displays without re-deriving unit conversions each time. Data pipelines that pre-filter nearby-galaxy catalogues sometimes need a deterministic linear distance column before heavier cosmological modules run.
Research notebooks comparing sensitivity to H0 can sweep several constant values against fixed velocities and compare returned distances side by side. If you later need luminosity distance from redshift under a full ΛCDM cosmology, angular-diameter distance, lookback-time integrals, or peculiar-velocity corrected Hubble flow models, treat those as separate search intents and landings rather than overloading this Hubble law calculator page.
What you can do with it
Homework and exam answer keys
Compute d = v/H0 for textbook recession velocities and a fixed Hubble constant so students and auto-graders share one closed-form ground truth in Mpc and light-years.
Planetarium and outreach demos
Turn survey recession velocities into human-readable megaparsec and light-year distances for exhibits and classroom widgets.
H0 sensitivity sweeps
Hold galaxy velocities fixed and vary H0 across modern estimate ranges to show how linear distances scale before full cosmology codes.
FAQ
What formula does this Hubble law calculator use?
The classical linear Hubble relation d = v / H0. With recession velocity in km/s and H0 in km/s/Mpc, distance is returned in megaparsecs, plus light-year and low-z convenience fields.
What happens if the Hubble constant is zero?
Hubble's law divides by H0, so zero (or near-zero) H0 is undefined and is never turned into Infinity or NaN.
Is this a full cosmological distance calculator?
No. It is the linear low-redshift Hubble-law approximation only. Full FLRW luminosity or comoving distances that depend on Ωm and ΩΛ are a different problem and a different landing.
Can I use negative recession velocity?
Yes. Negative v models approach (blueshift) under the same linear formula and returns a signed distance. Interpret the sign in your scientific context.
What does it cost?
The browser tool is free and runs locally.
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/astro/hubble-distance \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"recession_velocity":7000,"hubble_constant":70}'const res = await fetch("https://api.kit.forhosting.com/astro/hubble-distance", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"recession_velocity": 7000,
"hubble_constant": 70
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/hubble-distance",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"recession_velocity": 7000,
"hubble_constant": 70
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/hubble-distance", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"recession_velocity":7000,"hubble_constant":70}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"recession_velocity":7000,"hubble_constant":70}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/hubble-distance", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"recession_velocity": 7000,
"hubble_constant": 70
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.hubble_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.
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
How Hubble's law estimates galaxy distance
The calculator evaluates the closed form d equals v over H0 in deterministic floating-point arithmetic: no random seeds, no wall-clock timestamps, no network calls, and no model drift, so identical inputs always produce identical JSON.
What you send and what you get back
Recession velocity is typically the line-of-sight recessional speed v in kilometres per second from redshift or kinematic measurements; for a rough low-z link you may take v approximately c times z with c equal to two hundred ninety-nine thousand seven hundred ninety-two point four five eight kilometres per second. Hubble constant is H0 in kilometres per second per megaparsec in the usual convention, for example seventy for many textbook drills or sixty-seven point four for a Planck-era reference. Classic textbook checks include seven thousand kilometres per second at seventy kilometres per second per megaparsec recovering one hundred megaparsecs, and twelve hundred kilometres per second at the same H0 recovering roughly seventeen point one four megaparsecs. Send two required finite numbers under the fields recession_velocity and hubble_constant. Missing fields, non-numeric strings, NaN, Infinity, and a zero Hubble constant fail with invalid_input and are not charged. On success the response echoes cleaned recession_velocity and hubble_constant, returns distance as the primary result in megaparsecs under that unit convention, distance_ly as the same distance converted to light-years, redshift_approx as v over c for a classical low-z check, light_travel_time_years as a linear Hubble light-travel estimate, exposes c_km_s as the fixed speed of light used for the redshift approximation, includes a units hint object, sets method to hubble_law, formula to d equals v over H0, and approximation to linear_hubble_low_z for honest scope. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where Hubble-law distance calculators show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.