Absolute magnitude calculator
A star of apparent magnitude 0 at 100 parsecs has an absolute magnitude of -5, while one of magnitude 5 at 10 parsecs stays at 5. Enter what you observe and the distance to see true brightness. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Apparent magnitude
- 5
- Heliocentric
- 10
- Absolute magnitude
- 5
- Distance modulus
- 0
- Precision
- 10
- Unit distance
- pc
This absolute magnitude calculator returns the intrinsic brightness rank of a star from its apparent magnitude and its distance in parsecs. The closed form is fully deterministic: absolute magnitude M equals apparent magnitude m minus five times the base-ten logarithm of distance over ten parsecs, the classical distance modulus used in astronomy textbooks and catalogues. Absolute magnitude is defined as the magnitude the object would have if it sat at a standard distance of ten parsecs, so at d equals ten the values of M and m coincide. Small checks you may already know include m equals five at ten parsecs yielding M equals five, and m equals zero at one hundred parsecs yielding M equals negative five. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.
What absolute magnitude means and what you get
Absolute magnitude is a distance-independent measure of how bright a star would appear if placed at ten parsecs from the observer. Apparent magnitude alone mixes intrinsic luminosity with geometric dimming: a luminous distant star can look as faint as a nearby dim one. The distance modulus μ equals five times log base ten of d over ten, with d in parsecs, and absolute magnitude is M equals m minus μ.
Brighter objects have smaller (or more negative) magnitude numbers on the Pogson scale; the same convention applies to both m and M.
Where absolute magnitude fits in study, astronomy, and software
Students meet absolute magnitude when a textbook moves from apparent brightness to intrinsic stellar luminosity, when a contest problem asks for M given m and a parallax-derived distance, or when they place stars on a Hertzsprung–Russell diagram that is labelled in absolute magnitude rather than flux. Teachers can pre-generate answer keys for modest m and d values without trusting opaque calculator apps that silently switch units from light-years to parsecs or drop the factor of ten inside the logarithm.
Developers call the same contract from scripts to seed deterministic test vectors for catalogue importers, to normalize user-entered photometry before HR-diagram demos, or to satisfy programming-challenge statements that demand M rather than a hand-waved luminosity class. Contest practice often needs a fast, offline source of absolute magnitudes so solutions can be checked without planetarium software under time pressure. Product and education tools use the formula when a learner types apparent magnitude and distance in parsecs and the UI must show M next to a distance-modulus explanation.
What you can do with it
Homework and distance-modulus checks
Convert textbook apparent magnitudes and parsec distances into absolute magnitude M before HR-diagram or luminosity problems.
Catalogue and teaching software
Normalize user-entered m and d into absolute magnitude for stellar comparators, lab demos, and interactive lessons.
FAQ
What does the absolute magnitude calculator cost?
It is free in your browser on this page.
How is absolute magnitude defined here?
M = m − 5·log10(d/10) with d in parsecs. Absolute magnitude is the magnitude the object would have at a standard distance of 10 parsecs.
What happens if distance is zero or negative?
Absolute magnitude uses log10 of distance over ten parsecs, which is undefined for non-positive distance.
Does this correct for interstellar extinction?
No. It applies only the pure geometric distance modulus. Extinction, reddening, and bolometric corrections are out of scope.
Why are results rounded to a precision?
Default precision is 10 decimal places; you can set precision from 0 to 15.
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/absolute-magnitude \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"apparent_magnitude":5,"distance_pc":10}'const res = await fetch("https://api.kit.forhosting.com/astro/absolute-magnitude", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"apparent_magnitude": 5,
"distance_pc": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/absolute-magnitude",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"apparent_magnitude": 5,
"distance_pc": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/absolute-magnitude", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"apparent_magnitude":5,"distance_pc":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"apparent_magnitude":5,"distance_pc":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/absolute-magnitude", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"apparent_magnitude": 5,
"distance_pc": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.absolute_magnitude",
"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.
Limits
max_abs_magnitude | 1000000 |
max_distance_pc | 1000000000000000 |
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
What absolute magnitude means and what the response contains
This calculator returns the normalized apparent magnitude and distance you supplied, the computed absolute magnitude rounded to the requested precision, the intermediate distance modulus, the method tag absolute_magnitude, the precision used, a unit_distance string of pc, and a short formula reminder. There is no extinction model and no random sampling of luminosity classes: the engine either builds exact floating-point M inside the supported ranges or rejects the input with invalid_input. Rejected cases include missing m or d, non-finite values, magnitudes or distances above the documented ceilings, and any distance that is zero or negative, because the logarithm of a non-positive argument is undefined.
How m and distance are read and how M stays reproducible
Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces, hex prefixes, and non-numeric tokens are rejected with a clear message so a bad cell does not become a wrong absolute magnitude. Negative apparent magnitudes are valid and simply mean a very bright object on the sky. The preferred fields are apparent_magnitude for the observed magnitude m and distance_pc for the distance in parsecs, but aliases m, app_mag, apparent, and mag for the magnitude, and d, distance, pc, and parsecs for the distance are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. Distance must be strictly positive: if distance_pc is zero, negative, or negative zero, the request fails with invalid_input because absolute magnitude M equals m minus five log ten of d over ten is undefined for a non-positive distance. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for m, d, M, and the modulus, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the absolute-magnitude formula yourself.
Where absolute magnitude fits in study, astronomy, and software
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with light-travel-time or surface-gravity tools when you need related astronomy steps, and with other science endpoints when you are building a small lab of free, deterministic helpers.
Integration use cases
Deterministic test fixtures
Generate reproducible M and distance-modulus values for unit tests, property checks, and CI assertions on astronomy modules.