Brightness ratio to magnitude difference calculator
A source 100 times brighter than another sits 5 magnitudes lower: a ratio of 100 gives a difference of -5. Enter any positive brightness ratio and get the first magnitude minus the second. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Brightness ratio
- 100
- Magnitude difference
- -5
This brightness ratio to magnitude difference calculator applies the logarithmic astronomical magnitude scale in one direct step. Enter the positive ratio of the first source's brightness to the second source's brightness, and it returns the first magnitude minus the second magnitude. A ratio greater than one means the first source is brighter and therefore produces a negative magnitude difference. A ratio below one produces a positive difference.
Enter the ratio in the intended order
The input is the brightness ratio F1/F2, so order matters. Put the measured brightness or flux of the first object in the numerator and the corresponding value for the second object in the denominator before entering the ratio. The result is m1 minus m2 in magnitudes.
If F1/F2 is greater than one, object one is brighter; because brighter astronomical objects have smaller magnitude numbers, the returned difference is negative. If the ratio lies between zero and one, object one is fainter and the difference is positive. A ratio of exactly one returns zero because equally bright sources have equal magnitudes.
Brightnesses should refer to comparable measurements, such as the same photometric band, calibration, aperture convention, and flux-density basis. Mixing a visual-band measurement with an infrared measurement may produce an arithmetic result, but it does not represent a meaningful like-for-like magnitude difference. Compute the ratio before submitting it, or use a decimal such as 0.25 when the first source has one quarter of the second source's brightness.
Understand the logarithmic calculation
The calculator evaluates m1 − m2 = −2.5 log10(F1/F2). Astronomical magnitudes are logarithmic rather than linear, so multiplying brightness does not add the same number of magnitudes for every starting value; instead, a fixed brightness factor always corresponds to a fixed magnitude interval. A ratio of 100 gives −5 magnitudes, meaning the first source is one hundred times as bright and five magnitudes numerically lower than the second.
Reversing the ratio to 0.01 gives +5 magnitudes. The minus sign is essential because the historical magnitude convention assigns lower values to brighter objects. The base-ten logarithm also means ratios can cover a very wide dynamic range without requiring a special mode.
The returned number is not rounded to an arbitrary display precision by the algorithm, allowing downstream software to choose precision appropriate to its measurements. Input uncertainty is not propagated: if your flux ratio has an error bar, calculate the corresponding limits separately or apply an uncertainty model suited to the observations.
Validate the result and use it responsibly
A brightness ratio must be strictly positive because a logarithm is not defined here for zero or negative values. The calculator rejects non-positive ratios, missing values, non-numeric text, infinities, and values that cannot be represented as finite numbers. For a quick sign check, ask which object is brighter: if the numerator is brighter, the magnitude difference should be negative; if it is fainter, the answer should be positive.
You can also reverse the ratio and confirm that the new result has the same size with the opposite sign. Use the output to compare sources, check photometry calculations, translate contrast measurements, or prepare values for a report. Remember that this conversion describes a brightness relationship, not an absolute or apparent magnitude by itself.
It does not correct for extinction, background subtraction, detector response, redshift, or different filter systems. Those observational effects must be handled before forming a physically comparable ratio.
What you can do with it
Translate a contrast measurement
Convert the measured flux ratio of a companion and its host into the signed magnitude contrast used in an observing report.
Check a photometry worksheet
Verify the sign and size of a magnitude difference calculated from two comparable calibrated brightness measurements.
Build an astronomy pipeline
Turn positive brightness ratios into deterministic magnitude differences for catalog enrichment or quality-control checks.
FAQ
What formula does the calculator use?
It uses m1 − m2 = −2.5 log10(F1/F2), where F1/F2 is the brightness ratio entered.
Why is the result negative when the ratio is greater than one?
The first source is brighter, and the astronomical magnitude scale assigns brighter sources smaller magnitude values.
What happens when the brightness ratio is one?
The logarithm of one is zero, so the two equally bright sources have a magnitude difference of zero.
Does the order of the two sources matter?
Yes. Put the first source's brightness on top and the second underneath. Swapping them flips the sign: a ratio of 100 gives -5 magnitudes, while 0.01 gives +5.
Can I compare measurements from different filters?
Only like with like. Both brightnesses should come from the same band, calibration and aperture convention. Mixing a visual measurement with an infrared one still gives a number, but not a meaningful magnitude difference.
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/ratio-to-magnitude-diff \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"brightness_ratio":100}'const res = await fetch("https://api.kit.forhosting.com/astro/ratio-to-magnitude-diff", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"brightness_ratio": 100
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/ratio-to-magnitude-diff",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"brightness_ratio": 100
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/ratio-to-magnitude-diff", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"brightness_ratio":100}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"brightness_ratio":100}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/ratio-to-magnitude-diff", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"brightness_ratio": 100
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.ratio_to_magnitude_diff",
"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
The calculation is deterministic, requires no catalogue lookup, and costs $0.002 per API request.
Validate the result and use it responsibly
For automated use, each API request costs $0.002, and identical finite inputs always produce identical outputs because the implementation has no network calls, random values, or time-dependent state.
Technical questions
Can the ratio be zero or negative?
No. The logarithmic conversion requires a strictly positive finite ratio, and non-positive inputs return an invalid_input error.
How much does an API calculation cost?
Each API request costs $0.002. The browser calculator can run the same deterministic calculation locally.