ForHosting KIT · Science

Planet density calculator

Earth's mass of 5.972e+24 kg and radius of 6371000 m give a mean density of 5513.2587385891 kg/m³. Compare rocky planets, icy moons and gas giants with one uniform-sphere formula. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Mass
5,972,000,000,000,000,000,000,000
Radius
6,371,000
You get
Volume
1,083,206,916,845,753,600,000 kg/m³
Density
5,513.2587385891
Precision
10

This planet density calculator returns the mean bulk density of a planet, moon, dwarf planet, or star from its total mass and mean radius under the uniform-sphere model. The closed form is fully deterministic: density equals three times mass over four pi times radius cubed, which is the same as mass divided by the sphere volume four-thirds pi R cubed. With SI inputs — mass in kilograms and radius in metres — the result is in kilograms per cubic metre, the unit textbooks and planetary data tables use for bulk density comparisons. A well-known check is Earth-scale mass 5.972 times ten to the twenty-four kilograms and mean radius 6.371 times ten to the six metres, which yields about 5514 kilograms per cubic metre. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.

Where planet density fits in study, astronomy, and software

Students meet mean bulk density when a textbook moves from sphere volume to comparing rocky and icy worlds, when a contest problem asks for the density of a planet of given mass and radius, or when they classify exoplanet candidates as rocky versus gaseous without full interior models. Teachers can pre-generate answer keys for modest planetary parameters without trusting opaque calculator apps that silently switch between grams per cubic centimetre and kilograms per cubic metre.

Developers call the same contract from scripts to seed deterministic test vectors for space-game physics, to normalize user-entered mass and radius before mission-planning demos, or to satisfy programming-challenge statements that demand density rather than a hand-waved Earth value. Contest practice often needs a fast, offline source of bulk densities so solutions can be checked without graphing calculators under time pressure. Product and education tools use the formula when a learner types planetary mass and radius and the UI must show density in kilograms per cubic metre next to composition examples.

Homework and planetary density checks

Compute mean bulk density from textbook mass and radius values and verify ρ before composition or classification problems.

Exoplanet and education software

Normalize user-entered mass and radius into kg/m³ bulk density for plotters, lessons, and interactive astronomy demos.

What does the planet density calculator cost?

It is free in your browser on this page.

How is mean bulk density defined?

For total mass M and sphere radius R, density ρ = 3M/(4πR³), which equals M divided by volume (4/3)πR³. With M in kg and R in m, ρ is in kg/m³.

What happens if radius is zero or negative?

Mean bulk density is undefined for a non-positive radius because the sphere volume would not be positive.

Does this model layered interiors or ice shells?

No. It only returns the uniform-sphere mean density from total mass and outer radius. Use dedicated interior models if you need layered structure.

Why are results rounded to a precision?

Default precision is 10 decimal places; you can set precision from 0 to 15.

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.

POSThttps://api.kit.forhosting.com/astro/planet-density

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.

curl -X POST https://api.kit.forhosting.com/astro/planet-density \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mass":5.972e+24,"radius":6371000}'
{
  "mass": 5.972e+24,
  "radius": 6371000
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "astro.planet_density",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs_mass1e+40
max_abs_radius100000000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What mean bulk density means and what the response contains

Mean bulk density is the total mass of a body divided by the volume enclosed by its outer surface when that volume is modelled as a sphere of radius R. For mass M and radius R the sphere volume is four-thirds pi R cubed, so density is three M over four pi R cubed. That single number is the first-order way astronomers compare rocky planets, ice moons, and gas giants: Earth sits near five and a half grams per cubic centimetre, the Moon is lower, and the gas giants drop further when expressed in the same SI units. This calculator returns the normalized mass and radius you supplied, the implied spherical volume, the computed density rounded to the requested precision, a unit string kg/m³, the method tag planet_density, the precision used, and a short formula reminder. There is no layered-interior integrator and no random sampling of porosity: the engine either builds exact floating-point density inside the supported magnitude range or rejects the input with invalid_input. Rejected cases include missing mass or radius, non-finite values, magnitudes above the documented ceilings, negative mass, and any radius that is zero or negative, because division by R cubed is undefined or non-physical for a mean bulk density in this model.

How mass and radius are read and how density 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 density. Zero mass is valid and simply yields zero mean density. The preferred fields are mass for the body mass in kilograms and radius for the mean or volumetric radius in metres, but aliases m, M, and planet_mass for mass, 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 mean bulk density rho equals three M over four pi R cubed is undefined for a non-positive radius. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for mass, radius, volume, and density, 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 mean-density formula yourself.

Where planet density 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 or orbital tools when you need related planetary steps, and with other physics endpoints when you are building a small lab of free, deterministic science helpers.

Deterministic test fixtures

Generate reproducible density and volume values for unit tests, property checks, and CI assertions on planetary physics modules.

Read the full KIT documentation →