Sphere volume calculator
Enter either the radius or the diameter of a sphere and get the rest: a radius of 3 gives a diameter of 6, a volume of four-thirds π times 3 cubed, and the surface area too. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Radius
- 3
- Diameter
- 6
- Volume
- 113.0973355292
- Surface area
- 113.0973355292
- Given
- radius
A sphere is the set of points in three-dimensional space at a fixed positive distance from a center. That distance is the radius; the diameter is twice the radius and is the longest chord through the solid. Once either the radius or the diameter is known and strictly positive, every classical metric of the solid is determined: the volume is four-thirds pi times the cube of the radius, and the surface area is four pi times the square of the radius. Students meet these formulas in solid-geometry homework, exams, and contest problems; engineers, designers, and makers need the same numbers when a drawing, bill of materials, or packaging note lists only a radius or only a diameter.
What a sphere is and which single measure determines the rest
In Euclidean solid geometry a sphere is completely determined, up to congruence, by a single positive length scale: the radius from the center to every point on the surface. The diameter is simply twice that radius and is often the quantity listed on a ball, tank, or planet model when the full width is easier to measure than the center-to-surface distance.
The volume of a solid sphere is four-thirds times pi times the radius cubed, a classical result obtained by integrating circular cross-sections or by relating the sphere to a cylinder and two cones of matching height and radius. The surface area is four times pi times the radius squared, equal to the lateral area of the circumscribed cylinder of the same radius and height equal to the diameter. If instead you know the diameter, the radius is half of that diameter, after which the same two formulas apply without change.
Giving neither field leaves the solid under-determined; giving both over-specifies the problem and can hide inconsistency when the numbers fail the relation diameter equals twice radius. Search intent clusters around phrases like sphere volume calculator, sphere surface area, volume of a sphere from radius, sphere diameter to volume, and 4/3 pi r cubed. People want numeric results they can check against a textbook answer key, a tank capacity chart, or a CAD note, not only a geometric argument that the figure is determined.
How this calculator validates input and applies the closed-form formulas
Each provided measure must be a positive finite number. The engine counts how many of the two fields are present: zero fails as under-specified, both fail as over-specified, and only a single field proceeds. When radius is known, the engine first checks that the radius is not negative and is strictly positive; diameter is then twice the radius, volume is four-thirds pi times radius cubed, and surface area is four pi times radius squared.
When diameter is known, the engine checks that the diameter is not negative and is strictly positive, recovers the radius as half the diameter, and then applies the same volume and surface-area formulas. Edge cases are explicit: negative radius, negative diameter, zero measures, non-numeric strings, missing fields, and providing both radius and diameter all fail before any metric is returned. A negative radius is rejected with a clear message that a sphere radius cannot be negative, matching the product contract and common homework validation rules.
You may use any consistent unit system for the radius or diameter; volume and area are expressed in the corresponding cubic and square units without conversion inside the engine.
What you can do with it
Homework and exam sphere drills
Students and graders confirm volume and surface area from a single known radius or diameter, including rejection when the radius is negative or not positive.
FAQ
Which formulas does the calculator use?
Volume is (4/3)·π·r³. Surface area is 4·π·r². Diameter is 2·r. From diameter, radius is diameter/2 before the same formulas apply.
What happens if the radius is negative?
A sphere requires a strictly positive radius (or an equivalent positive diameter); negative values are rejected and those calls are not charged.
Is the sphere volume calculator free?
The browser tool runs free on your device.
Can I enter the diameter instead of the radius?
Yes. Enter one of the two, not both: a diameter is halved to get the radius, and the same volume and surface formulas then apply without change.
What happens if I enter both the radius and the diameter?
The calculator refuses the pair, because two values can contradict each other when the diameter is not exactly twice the radius. Enter just one of them.
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/geom/sphere-volume \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"radius":3,"diameter":6}'const res = await fetch("https://api.kit.forhosting.com/geom/sphere-volume", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"radius": 3,
"diameter": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/sphere-volume",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"radius": 3,
"diameter": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/sphere-volume", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"radius":3,"diameter":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"radius":3,"diameter":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/sphere-volume", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"radius": 3,
"diameter": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.sphere_volume",
"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
This capacity accepts exactly one of radius or diameter, rejects negative and non-positive values and ambiguous multi-field inputs, and returns radius, diameter, volume, and surface area as structured JSON.
What a sphere is and which single measure determines the rest
Delivering radius, diameter, volume, and surface_area as JSON makes the result easy to paste into notes, diff in automated tests, or feed into a larger pipeline without reimplementing pi multiplications and powers in every language you teach or deploy.
How this calculator validates input and applies the closed-form formulas
Send a JSON body with exactly one of the two fields radius or diameter. Results are rounded to a stable decimal precision so the same input always yields the same JSON across JavaScript engines.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want an immediate sphere solution while checking homework, sizing a spherical tank or ball, verifying a storage volume from a measured diameter, or confirming a workshop drawing without installing a computer-algebra system. Results are fully deterministic: the same single measure always yields the same radius, diameter, volume, and surface area. There is no language model, no external geometry service, and no randomness, so the capacity is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Accepted inputs must be strictly positive; a negative radius is always rejected with invalid_input, and zero or non-finite measures are likewise refused. Wire the endpoint into solid-geometry drills, contest answer checkers, tank capacity worksheets that list only diameter, or floating preprocessing steps where you already prefer explicit domain errors over opaque black-box widgets that cannot show why a negative radius is rejected.
Integration use cases
Deterministic fixtures for solid-geometry tests
Pipelines that seed unit tests or interactive sphere demos can call a pure sphere oracle instead of reimplementing (4/3)πr³ and 4πr² in every language.
Tanks, balls, and spherical storage from one known length
Shop or logistics notes that list only a radius or a diameter recover full sphere metrics as structured JSON for reports, capacity charts, or lightweight CAD helpers.
Technical questions
How do I compute sphere volume and surface area with this API?
Send a JSON body with exactly one of radius or diameter to geom.sphere_volume. The response returns radius, diameter, volume, and surface_area.
Can I send both radius and diameter?
No. Provide exactly one field. Sending both is over-specified and fails with invalid_input so inconsistent pairs cannot hide behind a silent preference for one measure.