ForHosting KIT · Math

Sphere calculator

Enter a sphere's radius and get its diameter, equatorial circumference, surface area and volume at once: a radius of 1 gives a surface of 12.5663706144 and a volume of 4.1887902048. 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
Radius (r)
1
You get
Diameter
2
Circumference
6.2831853072
Sphere surface area
12.5663706144
Sphere volume
4.1887902048

Given a positive sphere radius, compute diameter, equatorial circumference, surface area and volume using Math.PI with round10 outputs.

Four measurements from one radius

Everything about a sphere follows from its radius. The diameter is twice the radius and the equatorial circumference is 2π times the radius. The surface area is 4π times the radius squared, and the volume is four thirds of π times the radius cubed. With a radius of 1 that gives a diameter of 2, a circumference of 6.2831853072, a surface of 12.5663706144 and a volume of 4.1887902048, all rounded to ten decimals. Because all four come from the same input, they always agree with each other.

Getting the units right

The results come out in the units you used: a radius in centimetres gives a surface in square centimetres and a volume in cubic centimetres, so convert before mixing the figures with others. Doubling the radius doubles the diameter and the circumference, multiplies the surface by four and the volume by eight, which is why small measuring errors grow quickly in the volume. The calculation is deterministic, so the same radius always gives the same numbers, a quick way to check a formula result without opening a spreadsheet.

Engineering quick checks

Validate a formula result without a spreadsheet.

Is it free?

Yes. Tier A runs in your browser without an account.

Rounding?

Half-away-from-zero to 10 decimal places on numeric outputs.

Why is it called the equatorial circumference?

Because it is measured around the widest circle of the sphere, the one that would be the equator on a globe. It equals π times the diameter, which for a radius of 1 is 6.2831853072.

Can I start from the diameter or the volume?

Only the radius goes in. If you measured the diameter, halve it first; if you only know the volume or the surface area, the radius has to be found from it before using this calculator.

Which values are rejected?

Zero, negative numbers and anything that is not a number are rejected before any arithmetic. A radius so large that a result would overflow is refused too, instead of returning a meaningless figure.

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/dev/sphere

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/dev/sphere \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"r":1}'
{
  "r": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.sphere",
  "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.

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.

How it works

Given a positive sphere radius, compute diameter, equatorial circumference, surface area and volume using Math.PI with round10 outputs. Inputs are validated before arithmetic. The calculation is fully deterministic and runs free in your browser with the same pure function as the API path. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results.

Inputs and outputs

Required fields must be present and correctly typed. Optional fields use documented defaults. Success payloads always include the primary output fields for stable UI binding. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results.

Edge cases and limits

Wrong types, zero or negative values where forbidden, and overflow to non-finite results become clear invalid_input errors instead of silent null or NaN fields. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results. Additional detail covers validation order, deterministic rounding, browser and API parity, stable error matches for certification, and safe handling of non-finite floating results.

Homework and teaching

Check classic examples with stable golden fixtures.

Automation

Same pure function in the free widget and the API.

Does it call the network?

No. Pure parse on-device.

What if input is invalid?

invalid_input with a clear stable match string.

Author?

samurai.

Read the full KIT documentation →