L4 and L5 Lagrange Point Geometry Calculator
This L4 and L5 geometry calculator converts one positive primary-secondary separation into the two triangular Lagrange-point positions.
Run — free
It uses a clear two-dimensional reference frame: the primary is at the origin, the secondary lies on the positive x-axis, and both triangular points are the same distance from each body as the bodies are from one another. The result gives Cartesian coordinates for the primary, secondary, L4, and L5, making the geometry ready for diagrams, simulations, lessons, and reproducible calculations.
Understand the coordinate frame before using the coordinates
The calculator fixes the primary body at x = 0 and y = 0, then places the secondary body at x equal to the supplied separation and y = 0. That convention turns an otherwise orientation-dependent question into a unique Cartesian answer. L4 is the vertex on the positive-y side of the primary-secondary line, corresponding to sixty degrees ahead in the chosen orientation, while L5 is its negative-y reflection, corresponding to sixty degrees behind. Both have an x-coordinate equal to half the separation. Their y-coordinate magnitude is the equilateral-triangle altitude: the separation multiplied by the square root of three and divided by two. The input has no prescribed physical unit. If the separation is in kilometres, every returned coordinate is in kilometres; if it is in astronomical units, every coordinate uses astronomical units. Keep one unit throughout your workflow, because this geometry operation does not label, infer, or convert units. It only preserves the scale supplied by the caller.
Interpret what this geometric result represents
L4 and L5 form equilateral triangles with the two massive bodies in the ideal circular restricted three-body model. This calculator returns those ideal triangle vertices, not a numerical orbit integration or an ephemeris. The primary and secondary therefore define a snapshot in a rotating, two-dimensional frame, and the returned points share the same separation from each endpoint. You can verify the construction directly: the distance from either triangular point to the primary equals the input separation, and the distance from that point to the secondary does too. The signs of the y-coordinates distinguish the two symmetric solutions. Which side is called ahead depends on the orientation convention of a larger simulation, so map positive y to the direction appropriate for your coordinate system before combining these values with other data. Masses are not requested because they do not change the equilateral vertex coordinates in this ideal geometry. They do matter for stability, dynamics, barycentric coordinates, and real trajectories, none of which this focused calculation claims to solve.
Use the output safely in diagrams and calculations
Start with a separation measured consistently, submit it as a finite positive number, and read the four returned position objects. The primary and secondary entries make the assumed baseline explicit, while the L4 and L5 entries can be plotted without reconstructing the reference frame. For a drawing, use equal scaling on both axes; unequal screen scales can make the equilateral triangles appear distorted even though the coordinates are correct. For a simulation that uses a barycentric origin, translate all four points by the offset required by that model after this calculation. For a baseline pointing in another direction, rotate every returned point through the desired angle. Translation and rotation preserve the equilateral geometry. A zero or negative separation is rejected because distinct bodies cannot define a triangle with such a baseline, and non-finite values are rejected because they cannot produce meaningful coordinates. The operation is deterministic and uses no network calls, current time, random values, body catalogs, or hidden constants beyond the exact square-root expression for an equilateral triangle.
What you can do with it
Build an orbital-mechanics diagram
Generate consistent L4 and L5 plot coordinates from a known distance before adding labels, scale marks, or a rotation into the desired viewing frame.
Check a simulation setup
Compare triangular-point seed coordinates against a simple independent geometry result before introducing masses, velocities, perturbations, or numerical integration.
Teach equilateral Lagrange geometry
Show how one separation determines both symmetric vertices and verify that all three sides of each primary-secondary-point triangle have equal length.
FAQ
What coordinate system does the calculator use?
It places the primary at (0, 0), the secondary at (separation, 0), L4 above the x-axis, and L5 below it.
What unit should I use for separation?
Any consistent length unit works. The returned x and y coordinates remain in that same unit.
Why are masses not required?
The ideal L4 and L5 triangle vertices depend on the primary-secondary separation, not their masses. Masses affect stability and barycentric placement, which are outside this geometry calculation.
Does this calculate a spacecraft trajectory?
No. It returns ideal geometric positions only; it does not calculate velocity, stability, perturbations, or an orbit over time.
Why does a non-positive separation fail?
A separation must be greater than zero to define two distinct endpoints and a non-degenerate equilateral triangle.
What does the API request cost?
Each API request costs $0.002; the same deterministic calculation can also run free in the browser.
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/lagrange-l4-l5-geometry \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"separation":384400}'const res = await fetch("https://api.kit.forhosting.com/astro/lagrange-l4-l5-geometry", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"separation": 384400
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/lagrange-l4-l5-geometry",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"separation": 384400
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/lagrange-l4-l5-geometry", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"separation":384400}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"separation":384400}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/lagrange-l4-l5-geometry", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"separation": 384400
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.lagrange_l4_l5_geometry",
"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. |