Semi-major axis from apsides
Average the farthest and nearest points of an orbit to get its size: an apoapsis of 7350 km and a periapsis of 6650 km give a semi-major axis of 7000 km, with no eccentricity needed first. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Apoapsis
- 7,350
- Periapsis
- 6,650
- Semi major axis
- 7,000
The semi-major axis is the fundamental size parameter of a Keplerian orbit: half the long diameter of the elliptical path, or simply the circular radius when eccentricity is zero. When mission notes, textbooks, or tracking summaries already quote apoapsis and periapsis distances, you do not need eccentricity first—you recover the semi-major axis as the arithmetic mean of those two extremes.
Why the average of two distances gives the orbit's size
Every closed orbit has a farthest point from the central body, the apoapsis, and a nearest point, the periapsis. In an ellipse with the body at one focus, those two distances always add up to twice the semi-major axis, so half their sum is the size of the orbit. For a circle both distances are equal and the answer is simply the radius. You do not need the eccentricity first; if you want the shape afterwards, it equals the difference of the two distances divided by their sum, a step this tool leaves to you.
When to use it and the usual mistakes
It suits homework checks, lecture demos and mission notes that already quote both extremes. The most common slip is mixing altitude with radius: if your source gives height above the surface, add the planet's radius to both values before you enter them. Keep both numbers in the same unit, because the answer comes back in that unit: kilometers in, kilometers out. Negative or non-numeric distances are refused rather than averaged into something meaningless.
Classroom uses and practical limits
Call the free in-browser semi-major axis from apsides calculator for homework checks, lecture demos, and quick concept verification without installing Orekit, GMAT, or a local MATLAB toolbox. Typical classroom examples include a low-Earth-orbit ellipse with apoapsis and periapsis a few tens of kilometers apart around seven thousand kilometers center-to-body distance, a circular case where both apsides equal the same radius, and a highly elongated transfer sketch with a large gap between far and near turning points.
Extremely large magnitudes are bounded for isolate safety; stay within the published numeric range for reliable results.
FAQ
What happens if apoapsis or periapsis is negative?
Apsis distances must be non-negative; a negative value is rejected by product contract and is not charged.
What if a value is not a number?
Only finite numbers (or numeric strings) are accepted.
What units should I use?
Any consistent length unit. The returned semi-major axis uses the same unit as the input distances. The calculator does not convert between kilometers and meters for you.
Is the semi-major axis from apsides calculator free?
The browser tool runs free on your device.
Can I enter altitudes above Earth instead of distances from its center?
Not directly. Both numbers are read as distances from the center of the body being orbited, so add the planet's radius to each altitude first. Otherwise the result is the average height, not the true semi-major axis.
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/semimajor-from-apsides \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"apoapsis":7350,"periapsis":6650}'const res = await fetch("https://api.kit.forhosting.com/astro/semimajor-from-apsides", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"apoapsis": 7350,
"periapsis": 6650
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/semimajor-from-apsides",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"apoapsis": 7350,
"periapsis": 6650
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/semimajor-from-apsides", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"apoapsis":7350,"periapsis":6650}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"apoapsis":7350,"periapsis":6650}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/semimajor-from-apsides", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"apoapsis": 7350,
"periapsis": 6650
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.semimajor_from_apsides",
"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
Non-numeric or negative distances fail with invalid_input instead of inventing a meaningless average.
What semi-major axis means and why the average of the apsides works
Under the two-body Keplerian model every closed elliptical orbit has a farthest radial distance called the apoapsis and a nearest radial distance called the periapsis. Units of the input distances carry through unchanged: kilometers stay kilometers and meters stay meters. The calculator does not convert altitude above a planetary surface into center-to-body radius; if your source quotes height above Earth, add the planetary radius first so both apsides are true radial distances from the focus. Geometry of the ellipse places the focus (central body) such that the sum of the two extreme radii equals twice the semi-major axis: r_a plus r_p equals two a, so a equals (r_a plus r_p) divided by two. That identity is exact for the ideal Keplerian ellipse and for the circular limit where r_a equals r_p equals a. It does not require you to know eccentricity up front; once a is known you can still form e equals (r_a minus r_p) over (r_a plus r_p) if you need shape, but this capability stops at the size parameter. Apoapsis need not be labeled larger than periapsis for the average formula to remain mathematically correct, though conventional naming expects r_a greater than or equal to r_p. Identical finite inputs always produce identical JSON because the path is pure floating-point arithmetic with no network, no random seed, and no wall clock.
Input contract, response shape, and error behaviour
Both values must be non-negative. Example: apoapsis seven thousand three hundred fifty and periapsis six thousand six hundred fifty yields semi-major axis seven thousand in the same length unit. POST a JSON body with two required finite numbers: apoapsis for the farthest radial distance r_a and periapsis for the nearest radial distance r_p. Each field may arrive as a JSON number or as a numeric string; aliases ra, r_a, apoapsis_radius, and apogee are accepted for apoapsis, and rp, r_p, periapsis_radius, and perigee for periapsis. Missing fields, empty strings, NaN, Infinity, and non-numeric types fail with invalid_input messages that name the field. A negative apoapsis or periapsis also fails with invalid_input by product contract, because orbital radial distances are not negative in this model. Those validation failures are not billed after the engine rejects the request. On success the body echoes cleaned apoapsis and periapsis, reports semi_major_axis as (r_a plus r_p) over two rounded for stable cross-runtime comparison, sets formula to the string a equals open parenthesis r_a plus r_p close parenthesis slash two, and sets method to semimajor_from_apsides. Pair the result with period or velocity tools when the next question needs dynamical scale; this endpoint only recovers a from the two apsides.
API usage, pricing, classroom workflows, and practical limits
Use the prepaid API when a tutoring platform, coding-assessment sandbox, curriculum generator, or early mission-design pipeline needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after rejection. Authors shipping SDKs can map semi_major_axis into tables that recover a from published r_a and r_p pairs, teaching that the size of the orbit is the mean of the extremes—a natural inverse lesson to tools that expand a and e into apoapsis and periapsis when building multi-step orbital-mechanics lesson flows.
Integration use cases
Homework and exam verification
Students and graders recover semi-major axis from textbook apoapsis and periapsis values and get a clear invalid_input error when a distance is negative or non-numeric.
Tutoring and curriculum generators
Lesson builders produce worked Keplerian size examples with structured JSON for flashcards, step sheets, and auto-graded drills without embedding a full astrodynamics library.
Early mission concept sketches
Lightweight pipelines that already know turning-point radii call a prepaid endpoint for a instead of reimplementing (r_a + r_p) / 2 in every language.
Technical questions
How do I calculate semi-major axis from apoapsis and periapsis?
Send JSON with apoapsis (r_a) and periapsis (r_p) as finite non-negative numbers in the same length unit. The response includes semi_major_axis equal to (r_a + r_p) / 2, plus formula and method labels.