Cube volume, surface area and space diagonal from edge length
From one edge length, get the cube's volume, total surface area and space diagonal at once: an edge of 3 gives 27, 54 and 5.196152. Choose from zero to twelve decimals, six by default, and keep your own unit throughout. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Edge
- 3
- Volume
- 27
- Surface area
- 54
- Space diagonal
- 5.196152
A cube is fully described by a single number: the length of one edge. From that one measurement this capability derives the three quantities engineers, students and makers ask for most often — the volume the cube encloses, the total surface area of its six faces, and the space diagonal that runs from one vertex to the opposite one. You send the edge length, you get all three values back in a single deterministic call. No units are assumed: feed it millimetres, metres or inches and the results come back in the corresponding cubic, square and linear units of the same system.
One edge, three answers
Every property of a cube is locked to its edge length, which makes the cube the simplest solid in geometry and the easiest to compute exactly. Given an edge a, the volume is a³, the total surface area is 6a² because the six square faces are identical, and the space diagonal is a√3, the longest straight line that fits inside the solid, connecting two opposite vertices through the interior.
Because the formulas are exact, the only approximation anywhere in the pipeline is the final rounding to the number of decimals you choose, and even that is a stable half-up rule rather than whatever the floating-point hardware happens to produce.
How the numbers are computed and rounded
Once the edge is accepted, the three results are computed in double precision and then rounded to the requested number of decimal places, six by default, using a half-up rule applied to the absolute value. That choice is deliberate: raw floating-point results such as 0.1 + 0.2 produce long, machine-dependent tails, and a deterministic round makes the output byte-identical on any machine, which is what lets automated pipelines compare responses reliably. You can ask for anywhere between zero and twelve decimals through the optional <em>decimals</em> field.
Where it fits in real work
Typical callers are homework checkers that verify a student's manual calculation of a³ and 6a², configurators for cubic tanks, boxes or rooms that quote capacity and lining material together, and logistics tools that test whether an object fits along the diagonal of a cubic container — the single most common way a 'it should fit' estimate goes wrong. If you need the reverse direction — recovering the edge from a known volume or area — a cube root or square root of the corresponding result gives it back exactly.
What you can do with it
Check homework instantly
Verify a manual calculation of cube volume, surface area or space diagonal against an exact reference value.
Size cubic packaging and tanks
Get capacity and surface material from one inner edge length when quoting boxes, bins or cubic containers.
Test fit along the diagonal
Check whether a rod or object up to a√3 long can fit inside a cubic space before committing to a design.
FAQ
Which units does it use?
None are assumed. If the edge is in centimetres, the volume is in cubic centimetres, the area in square centimetres and the diagonal in centimetres.
What is the space diagonal?
The straight line between two opposite vertices passing through the interior of the cube, equal to the edge times the square root of three.
Can I control the precision?
Yes. The optional decimals field sets the number of decimal places, from 0 to 12, with six as the default. Rounding is half-up.
Is my input stored anywhere?
No. The computation is a pure function: the edge length is processed in memory and discarded, and only the three results are returned.
Will a long object fit inside a cubic box?
Compare its length with the space diagonal, the longest straight line that fits inside the cube. A box with an edge of 3 has a diagonal of 5.196152, so anything longer cannot fit, even placed corner to corner.
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/math/cube-v-a-d \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"edge":3}'const res = await fetch("https://api.kit.forhosting.com/math/cube-v-a-d", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"edge": 3
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/cube-v-a-d",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"edge": 3
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/cube-v-a-d", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"edge":3}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"edge":3}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/cube-v-a-d", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"edge": 3
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.cube_v_a_d",
"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
One edge, three answers
This endpoint applies those three closed formulas directly and returns all of them together, so you never have to chain calls or repeat the input. That matters in practice: a packaging check that needs capacity and cardboard area, or a 3D-printing job that needs material volume and the bounding diagonal of the build plate, gets everything from one request.
How the numbers are computed and rounded
The input is validated before any arithmetic happens: the edge must be a positive finite number, and anything else — zero, a negative value, a string that does not parse, a missing field — is rejected with a typed <em>invalid_input</em> error that names the offending field. The echoed <em>edge</em> in the response is the exact value that was used, so the record of what was computed is complete in a single payload.
Where it fits in real work
The capability runs as a pure function on our global edge: nothing is stored, nothing is sent to any third party, and the same code that answers paid API calls runs free in your browser on this page, so you can sanity-check values interactively before automating anything. Because the price is $0.002 per request with no per-unit component, batch jobs that sweep thousands of candidate edge lengths cost exactly what the catalog says, with no surprises.
Technical questions
What does it cost?
$0.002 per request, with no per-unit component. It is also free to run in your browser on this page.
What input is rejected?
Anything that is not a positive finite number: zero, negative values, non-numeric strings and missing fields all return a typed invalid_input error.