Planet mass from surface gravity
Recover a world's mass from how strongly it pulls at its surface: 9.82 m/s² with a radius of 6,371,000 m gives Earth's mass, about 5.97 × 10²⁴ kg. Works for planets, moons and stars. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Gravity
- 9.82
- Radius
- 6,371,000
- Mass
- 5,972,016,160,795,889,000,000,000 kg
- G
- 0.0000000001
- Precision
- 10
This planet mass from surface gravity calculator recovers the mass of a planet, moon, or star by inverting Newton’s surface-gravity law. Given surface gravitational acceleration g and radius R, mass equals g times R squared divided by the gravitational constant G. The engine uses the CODATA 2018 value G equals 6.67430 times ten to the minus eleven cubic metres per kilogram per second squared, so SI inputs — g in metres per second squared and R in metres — return mass in kilograms. A familiar Earth-scale check is g near 9.82 metres per second squared with mean radius 6.371 times ten to the six metres, which recovers roughly 5.97 times ten to the twenty-four kilograms. Computation is pure finite arithmetic: no network, no sampling, and no date-dependent shortcuts.
Where mass-from-gravity fits in study, astronomy, and software
Students meet inverted surface gravity when a textbook gives g and R for another world and asks for mass, when a contest problem supplies measured surface acceleration and radius without listing M, or when they compare terrestrial planets without juggling scientific notation by hand. Teachers can pre-generate answer keys for modest planetary parameters without trusting opaque calculator apps that silently switch units or drop exponents.
Developers call the same contract from scripts to seed deterministic test vectors for space-game physics, to normalize user-entered g and radius before mission-planning demos, or to satisfy programming-challenge statements that demand mass rather than a hand-waved Earth value. Contest practice often needs a fast, offline source of planetary masses so solutions can be checked without graphing calculators under time pressure. Product and education tools use the formula when a learner types surface gravity and radius and the UI must show mass in kilograms next to density or escape-speed examples.
What you can do with it
Homework and planetary mass checks
Recover planet mass from textbook surface gravity and radius, then verify M before density or escape-speed problems.
Astronomy and game physics tools
Normalize user-entered g and radius into mass for exoplanet comparators, mission demos, and space games.
FAQ
What does the planet mass from surface gravity calculator cost?
It is free in your browser on this page.
What happens if radius is zero or negative?
Mass M = g·R²/G is undefined for a non-positive radius.
Does this include planetary rotation or oblateness?
No. It returns pure Newtonian mass from the spherical surface-field inversion. Rotation, J2, and altitude above the surface are out of scope.
Why are results rounded to a precision?
Default precision is 10 decimal places; you can set precision from 0 to 15.
How do I find a planet's mass from its gravity?
Multiply the surface gravity by the radius squared and divide by the gravitational constant. For Earth, 9.82 m/s² and 6,371,000 m give about 5.97 × 10²⁴ kg.
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/mass-from-gravity \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"gravity":9.82,"radius":6371000}'const res = await fetch("https://api.kit.forhosting.com/astro/mass-from-gravity", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"gravity": 9.82,
"radius": 6371000
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/mass-from-gravity",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"gravity": 9.82,
"radius": 6371000
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/mass-from-gravity", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"gravity":9.82,"radius":6371000}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"gravity":9.82,"radius":6371000}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/mass-from-gravity", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"gravity": 9.82,
"radius": 6371000
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.mass_from_gravity",
"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
What inverted surface gravity means and what the response contains
Surface gravity is the acceleration a test mass would experience at the exterior surface of a spherical body if only Newtonian gravity acted and the body were non-rotating. The forward law is g equals G times M over R squared; solving for mass gives the compact identity M equals g times R squared over G. This calculator returns the normalized gravity and radius you supplied, the computed mass rounded to the requested precision, the fixed CODATA gravitational constant G used in the quotient, a unit string kg, the method tag mass_from_gravity, the precision used, and a short formula reminder. There is no approximate numerical integrator and no random sampling of multipole moments: the engine either builds exact floating-point mass inside the supported magnitude range or rejects the input with invalid_input. Rejected cases include missing gravity or radius, non-finite values, magnitudes above the documented ceilings, negative gravity, and any radius that is zero or negative, because division by a non-positive radius squared is undefined or non-physical for mass recovery in this model.
How gravity and radius are read and how mass stays reproducible
Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces, hex prefixes, and non-numeric tokens are rejected with a clear message so a bad cell does not become a wrong planetary mass. Zero gravity is valid and simply yields zero mass. The preferred fields are gravity for surface acceleration in metres per second squared and radius for the mean or equatorial radius in metres, but aliases g, surface_gravity, and surface_g for gravity, and r, R, and planet_radius for radius are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. Radius must be strictly positive: if radius is zero, negative, or negative zero, the request fails with invalid_input because mass M equals g times R squared over G is undefined for a non-positive radius. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for gravity, radius, and mass, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the inverted surface-gravity formula yourself.
Where mass-from-gravity fits in study, astronomy, and software
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with surface-gravity, escape-velocity, or orbital tools when you need related mechanics steps, and with other physics endpoints when you are building a small lab of free, deterministic science helpers.
Integration use cases
Deterministic test fixtures
Generate reproducible masses for unit tests, property checks, and CI assertions on planetary physics modules.
Technical questions
How is mass defined here?
For a spherical body of surface gravity g and radius R, M = g·R²/G with G = 6.67430×10⁻¹¹ m³ kg⁻¹ s⁻² (CODATA 2018). The SI unit is kilograms.