ForHosting KIT · Math

Rectangular prism calculator

Enter the length, width and height of a box and get three answers at once: edges of 3, 4 and 5 give a volume of 60, a surface area of 94 and the corner-to-corner diagonal. 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
Length
3
Width
4
Height
5
You get
Volume
60
Surface area
94
Diagonal
7.0710678119

A rectangular prism, also called a cuboid or rectangular box, is a three-dimensional solid whose six faces are rectangles meeting at right angles. Given the three edge lengths—length, width and height—this calculator returns the enclosed volume, the total surface area of all six faces, and the space diagonal that runs from one vertex through the interior to the opposite vertex.

How volume, surface area and space diagonal are computed

Label the three mutually perpendicular edge lengths as length, width and height. The volume of the rectangular prism is simply the product of those three numbers: volume equals length times width times height. That product measures the cubic capacity of the solid and is zero whenever any edge is zero, which matches the geometric idea of a collapsed prism with no interior.

Each pair of opposite faces contributes one of those products, and the factor of two accounts for both faces in the pair. The space diagonal is the length of the longest straight segment inside the prism, connecting opposite corners; by the three-dimensional Pythagorean theorem it equals the square root of length squared plus width squared plus height squared.

Classic checks include edges three, four and five, which yield volume sixty, surface area ninety-four, and space diagonal about seven point zero seven one; a unit cube has volume one, surface area six, and diagonal root three; equal edges recover a cube. Because the path uses only multiplication, addition, a factor of two, and one square root, it is deterministic, O(1), and free of iterative solvers.

Where rectangular prism calculations show up in real work

Secondary-school and college solid-geometry courses constantly ask students for the volume and surface area of a rectangular prism given three edges, and often for the space diagonal on the same problem set; a trusted calculator with a strict non-negative gate speeds homework grading and removes spreadsheet mistakes where someone multiplies only two faces or forgets the factor of two on surface area.

Packaging, fulfillment and warehouse workflows size cartons, pallets and voids from outer length, width and height; volume feeds capacity and freight class while surface area informs wrap and label estimates and the space diagonal checks whether a rigid item fits on a diagonal path through the box. Architecture, interior design and cabinet shops estimate room volumes for HVAC load, paint or finish area from wall and floor faces, and clear diagonal dimensions for long furniture through doorways.

Game, graphics and CAD libraries store axis-aligned bounding boxes (AABBs) for collision, culling and layout; deterministic volume, surface and diagonal support debug readouts and property panels without a full mesh library. If you later need cylinder or sphere formulas, packing density of multiple boxes, or oriented bounding boxes from meshes, treat those as separate search intents rather than overloading this rectangular-prism landing.

Homework and exam checks

Compute cuboid volume, total surface area and space diagonal from three edges, and reject negative dimensions with a clear error.

Packaging and freight sizing

From outer length, width and height, recover volume, wrap surface and space diagonal for cartons, voids and fit checks.

CAD and game AABB metrics

Turn three edge lengths into volume, surface area and body diagonal for layout, collision proxies and property panels.

What happens if length, width or height is negative?

Dimensions must not be negative; the error message names the field.

Is a zero edge length allowed?

Yes. Zero is non-negative and yields a defined (possibly degenerate) volume, surface area and diagonal—for example one zero edge collapses the prism to a rectangular face with volume zero.

Does the order of length, width and height matter?

No. Volume, total surface area and space diagonal depend only on the three edge lengths as a set; permuting the labels does not change those three results.

What does it cost?

The browser tool is free and runs locally.

What is the space diagonal of a rectangular prism?

It is the longest straight line inside the box, from one corner through the middle to the opposite corner. It equals the square root of the three edges squared and added, about 7.071067811865 for edges of 3, 4 and 5.

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/geom/rectangular-prism

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/geom/rectangular-prism \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"length":3,"width":4,"height":5}'
{
  "length": 3,
  "width": 4,
  "height": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.rectangular_prism",
  "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.

Any negative edge length is rejected with a clear invalid_input error instead of a silent nonsense volume. No network calls, no random sampling, and no floating-point surprises beyond ordinary IEEE-754 arithmetic on the numbers you provide.

How volume, surface area and space diagonal are computed

The total surface area is twice the sum of the three pairwise face areas: surface_area equals two times (length times width plus length times height plus width times height). Huge magnitudes can still overflow IEEE-754 double range; when intermediates are non-finite the request fails with a clear overflow message instead of returning Infinity in JSON. That closed form matches solid-geometry textbooks and keeps automated graders aligned with hand computation on the same three numbers.

What you send and what you get back

Provide three required finite numbers: length, width and height are the three edge lengths of the rectangular prism. None of the three may be negative; zero is allowed and produces a mathematically defined (possibly degenerate) volume, surface area and diagonal. Example checks: length three, width four and height five yield volume sixty, surface area ninety-four and diagonal square root of fifty; a two-by-two-by-two cube yields volume eight, surface area twenty-four and diagonal two root three; a negative width fails naming the field. Wire the free browser tool for quick sanity checks, then call the identical contract from scripts for bulk evaluation without reimplementing the cuboid formulas in every language. Missing fields, empty strings, non-numeric text, NaN, Infinity, and any negative dimension are rejected with invalid_input and are not charged. On success the JSON response returns length, width, height, volume, surface_area, diagonal, and method set to cuboid_lwh_volume_surface_diagonal so logs and teaching UIs can document the algorithm. API pricing is the published base of $0.002 per successful item.

Where rectangular prism calculations show up in real work

Because this capability is a pure parse engine, failed validation does not consume balance and successful runs stay at $0.002 per item.

What formulas does this calculator use?

volume = length × width × height; surface_area = 2(length×width + length×height + width×height); diagonal = √(length² + width² + height²). The response includes method: "cuboid_lwh_volume_surface_diagonal".

Read the full KIT documentation →