Airmass from altitude calculator
A target 30 degrees above the horizon has an airmass of 2, twice the air it would cross straight overhead. Enter the altitude in degrees and get the zenith angle and airmass for planning observations. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Altitude degrees
- 30
- Zenith angle degrees
- 60
- Airmass
- 2
This airmass from altitude calculator converts an object's angular height above the horizon into relative atmospheric airmass. It first finds the zenith angle, then applies the standard plane-parallel secant approximation. The result describes how much atmosphere the line of sight crosses compared with a source directly overhead. Enter an altitude in degrees greater than zero and no higher than ninety. The calculation is deterministic, immediate, and suitable for quick observing plans, exposure comparisons, and educational work.
What atmospheric airmass represents
Atmospheric airmass is a dimensionless measure of the path length that light travels through Earth's atmosphere relative to the shortest path at the zenith. An object directly overhead has an altitude of 90 degrees and an airmass of 1. As the object moves lower, its light crosses a longer slanted column of air, so the airmass rises.
This matters because a longer path generally produces more extinction, scattering, atmospheric absorption, and image degradation. The calculator accepts altitude above the astronomical horizon, not elevation above sea level and not declination. Those quantities answer different questions.
A positive altitude places the target above the horizon, while an altitude of zero lies exactly on it. The tool deliberately rejects zero and negative values because the simple secant relationship becomes singular at the horizon and does not describe an object below it. Use the result as a relative geometric path estimate, with the zenith observation serving as the reference value.
How the secant calculation works
Angles supplied in degrees are converted to radians before the trigonometric function is evaluated. For example, an altitude of 30 degrees has a sine of one half, giving an airmass of 2. At 90 degrees, the sine is 1 and the airmass is 1.
The returned object includes the validated altitude, the corresponding zenith angle, and the computed airmass, making each step easy to inspect or store. Inputs must be finite numbers no greater than 90 degrees. Numeric strings are accepted by the calculation for practical text-form use, but ambiguous, missing, infinite, and nonnumeric values are rejected rather than silently producing an unusable result.
When to use this approximation
The secant model treats the atmosphere as a flat, plane-parallel layer. It is convenient and intuitive for targets that are comfortably above the horizon, where it provides a quick estimate for planning observations or explaining why low targets suffer stronger atmospheric effects. Near the horizon, however, Earth's curvature, atmospheric refraction, observer height, pressure, temperature, and the vertical distribution of air become increasingly important.
The ideal secant formula then grows without bound, whereas the real optical path behaves differently. For precision photometry or very low altitudes, use a refined empirical or spherical-atmosphere model and supply the environmental data that model requires. This calculator intentionally does not disguise those assumptions by applying an undocumented correction.
It returns the direct secant result requested, so the number remains reproducible and easy to compare with textbooks, spreadsheets, or observing notes.
What you can do with it
Plan an observing sequence
Compare targets by geometric atmospheric path length and prioritize those that will be higher in the sky.
Estimate relative extinction conditions
Use airmass as an input to a separate extinction model when assessing how strongly the atmosphere may dim a target.
Teach altitude and zenith geometry
Demonstrate the relationship between altitude, zenith angle, and the secant approximation with reproducible values.
FAQ
What formula does the calculator use?
It uses X = sec(z) = 1 / sin(h), where z is the zenith angle and h is altitude above the horizon.
What is the airmass at the zenith?
At an altitude of 90 degrees, the zenith angle is zero and the calculated airmass is 1.
Why are zero and negative altitudes rejected?
The secant approximation is singular at zero altitude, and a negative altitude places the object below the horizon.
Is the result accurate near the horizon?
No. The plane-parallel secant approximation becomes unrealistic near the horizon; a refined atmospheric model is preferable there.
Does observer elevation affect this result?
Not in this simplified calculation. It uses only angular altitude and does not model observer elevation, pressure, temperature, or refraction.
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/airmass-from-altitude \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"altitude_degrees":30}'const res = await fetch("https://api.kit.forhosting.com/astro/airmass-from-altitude", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"altitude_degrees": 30
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/airmass-from-altitude",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"altitude_degrees": 30
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/airmass-from-altitude", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"altitude_degrees":30}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"altitude_degrees":30}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/airmass-from-altitude", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"altitude_degrees": 30
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.airmass_from_altitude",
"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 the secant calculation works
The calculation begins by converting altitude h into zenith angle z with z = 90 degrees - h. It then evaluates X = sec(z), which is equivalent to X = 1 / sin(h).
When to use this approximation
For automated use, send one altitude per request and treat $0.002 as the base API price; browser calculations can use the same pure deterministic logic without network access.
Technical questions
What does an API request cost?
The base price is $0.002 per request.