Orbital period with both masses
Get the real orbital period of two bodies that pull on each other: the Sun and Earth, 149,597,870,700 m apart, give about 365.25 days, because both masses count, not only the heavier one. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Mass1
- 1,988,470,000,000,000,000,000,000,000,000
- Mass2
- 5,972,200,000,000,000,000,000,000
- Separation
- 149,597,870,700
- Total mass
- 1,988,475,972,200,000,000,000,000,000,000
- G
- 0.0000000001
- Mu
- 132,716,851,813,000,000,000
- A cubed
- 3,347,928,975,810,000,000,000,000,000,000,000
When two bodies orbit each other under mutual gravity, the correct Newtonian period uses the sum of both masses, not only the heavier one. The two-body form of Kepler's third law states that the orbital period T equals two pi times the square root of a cubed over G times (m1 plus m2), where a is the relative semi-major axis or orbital separation. Binary-star homework, equal-mass planet–moon systems, and mission concepts where the secondary is not negligible all need this reduced-mass form rather than the single-central-mass approximation. This calculator accepts mass1 and mass2 in kilograms and separation in metres, returns period in seconds with day and Julian-year convenience fields, gravitational parameter mu equal to G times total mass, mean motion, and intermediate a cubed for audit, and rejects non-positive total mass or separation so bad specs never become a silent NaN.
How the two-body Kepler law uses both masses
The mean motion of that relative orbit is the square root of G M over a cubed, so the sidereal period is T equals two pi times the square root of a cubed over G times (m1 plus m2). When m2 is much smaller than m1 the sum collapses to m1 and you recover the familiar central-mass form used on satellite and planet-around-star homework. When the masses are comparable—binary stars, Pluto–Charon class systems, or a large moon relative to its planet—dropping m2 underestimates the period.
Squaring the two-body formula recovers T squared proportional to a cubed with constant four pi squared over G (m1 plus m2). Separation a must be finite and strictly positive so a cubed stays positive and the square root is real. Total mass m1 plus m2 must be strictly positive; zero or negative totals fail with invalid input because they are non-physical under the two-body Kepler law and would divide by zero or produce non-real periods.
Individual masses may be any finite numbers whose sum is positive, which covers the common case where one mass is zero and the problem reduces to a single central body.
What you send and what you get back
Send three required finite numbers under the fields mass1, mass2, and separation. Mass1 and mass2 are the two body masses in kilograms; their sum must be strictly greater than zero. Separation is the relative semi-major axis a in metres and must be strictly greater than zero; for Earth about the Sun use roughly one point four nine six times ten to the eleven metres, which is one astronomical unit.
Classic checks include solar mass plus Earth mass at one AU recovering roughly one year (slightly shorter than the pure solar-mass-only estimate because Earth adds a tiny fraction to total mass), and equal stellar masses at a known binary separation for double-star period drills. Keep units consistent: convert kilometres, AU, solar masses, and Earth masses to metres and kilograms before calling so the numeric product matches the SI interpretation your report claims.
Where two-mass orbital period calculators show up in real work
Secondary-school and university astronomy courses assign binary-star period problems and reduced-mass Kepler drills that rearrange the same formula; a single trusted oracle speeds grading and demo setup. Amateur double-star observers convert estimated component masses and angular separations into rough periods before full orbit fitting. Mission concept studies that include large secondary bodies—Moon-scale companions, binary asteroid pairs, or dual-satellite formations—compare periods with and without the secondary mass to decide whether the central-mass approximation is good enough.
Science communicators turn tabulated binary separations and stellar masses into human-scale year lengths for public exhibits. If you later need the single-central-mass period only, Kepler ratio solves between two orbits about the same body, semi-major axis from period, or full n-body ephemerides, treat those as separate search intents and landings rather than overloading this orbital period with both masses page.
What you can do with it
Binary-star homework and answer keys
Compute two-body Kepler period T from m1, m2 and separation a so students and auto-graders share one closed-form ground truth in seconds, days, and years.
Comparable-mass planet–moon systems
Include both primary and secondary mass when the moon is not negligible, instead of the pure central-mass satellite approximation.
Binary asteroid and dual-body concept studies
Compare periods with and without the secondary mass for mission sketches and public science exhibits before full numerical propagators.
FAQ
What formula does this orbital period with both masses calculator use?
Separation a is the relative semi-major axis; m1 and m2 are the two masses.
What happens if total mass or separation is zero or negative?
Non-positive separation or non-positive total mass (mass1 + mass2) is non-physical under the two-body Kepler law and would make the period undefined or non-real.
What units should I use?
SI: masses in kilograms and separation in metres. Convert AU and solar masses yourself before calling.
What does it cost?
The browser tool is free and runs locally.
Why does the smaller body's mass matter?
Both bodies circle their common centre, so the period depends on the sum of the two masses. Leaving out the second mass is only safe when it is far smaller than the first, as with a planet around a star.
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/kepler-two-masses \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"mass1":1.98847e+30,"mass2":5.9722e+24,"separation":149597870700}'const res = await fetch("https://api.kit.forhosting.com/astro/kepler-two-masses", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"mass1": 1.98847e+30,
"mass2": 5.9722e+24,
"separation": 149597870700
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/kepler-two-masses",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"mass1": 1.98847e+30,
"mass2": 5.9722e+24,
"separation": 149597870700
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/kepler-two-masses", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"mass1":1.98847e+30,"mass2":5.9722e+24,"separation":149597870700}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"mass1":1.98847e+30,"mass2":5.9722e+24,"separation":149597870700}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/kepler-two-masses", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"mass1": 1.98847e+30,
"mass2": 5.9722e+24,
"separation": 149597870700
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.kepler_two_masses",
"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 two-body Kepler law uses both masses
Newtonian two-body gravity reduces the relative motion of two point masses to an equivalent one-body problem: a reduced mass mu_red equals m1 m2 over (m1 plus m2) orbiting a fixed mass equal to the total mass M equals m1 plus m2 at separation equal to the relative vector. This capability evaluates that closed form in deterministic floating-point arithmetic with the CODATA two thousand eighteen value of G: no random seeds, no wall-clock timestamps, no network calls, and no model drift, so identical inputs always produce identical JSON.
What you send and what you get back
Missing fields, non-numeric strings, NaN, Infinity, non-positive separation, and non-positive total mass fail with invalid_input and are not charged. On success the response echoes cleaned mass1, mass2, and separation, exposes total_mass as their sum, G as the fixed CODATA constant, mu as G times total mass, a_cubed as separation to the third power, period as the primary SI result in seconds, period_days as period divided by eighty-six thousand four hundred, period_years as period divided by a Julian year of three hundred sixty-five point two five days, mean_motion as two pi over period in radians per second, includes a units hint object, sets method to kepler_two_body, formula to T equals two pi times the square root of a cubed over G times (m1 plus m2), and approximation to two_body_both_masses for honest scope. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where two-mass orbital period calculators show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Technical questions
How is this different from the single-mass orbital period calculator?
The single-central-mass form uses T = 2π √(a³ / (G·M)) and assumes the secondary is negligible. This page always uses the sum m1 + m2, which matters for binaries and comparable-mass pairs.