← Solid Geometry /

Cube and Rectangular Prism Calculator

Calculate volume, surface area, and diagonal of a cube or rectangular prism (box).

Reviewed by Geometry Calculator, Geometry Calculator Developer & Online Math Educator Last updated April 24, 2026

Cube and Rectangular Prism Calculator

ℹ Enter length, width and height — or the volume and two of the dimensions to find the third. One edge alone is treated as a cube.

Formulas Used in Cube and Rectangular Prism Calculator

V = l × w × h
SA = 2(lw + lh + wh)
Diagonal = √(l² + w² + h²)

Full formula reference: Rectangular Prism Formula · 3D Geometry Formulas · Triangular Prism Formula

In-Depth Tutorial: Cube and Rectangular Prism Calculator

A rectangular prism (also called a "box", "cuboid", or sometimes just "rectangular box") is a 3D solid with 6 rectangular faces, 12 edges, and 8 vertices. A cube is the special case where all three dimensions (length, width, height) are equal — the cube is to the rectangular prism what the square is to the rectangle. This tutorial covers the volume formula, surface area formula, the 3D space diagonal, and the relationship between them.

The three measurements

A rectangular prism is fully determined by three perpendicular edge lengths:

  • Length (l) — typically the longest horizontal edge
  • Width (w) — the other horizontal edge, perpendicular to length
  • Height (h) — the vertical edge

The convention "longest is length" is just a labeling choice — the formulas work for any assignment of the three dimensions to l, w, h.

Volume formula

V = l × w × h

The intuition: imagine filling the box with unit cubes (1×1×1). Each layer along the floor has (l × w) unit squares. There are h layers stacked vertically. Total: l × w × h unit cubes = volume.

Volume scales as the cube of each dimension. Doubling l, w, AND h together multiplies the volume by 8 (= 2³).

Surface area formula

SA = 2(lw + lh + wh)

The box has 6 faces, in 3 matching pairs:

  • Top and bottom: each area l × w, total 2lw.
  • Front and back: each area l × h, total 2lh.
  • Left and right: each area w × h, total 2wh.

Summing: SA = 2lw + 2lh + 2wh = 2(lw + lh + wh).

The 3D space diagonal

The space diagonal is the longest internal line — from one corner of the box to the diagonally opposite corner, passing through the interior. Its length follows from the 3D extension of the Pythagorean theorem:

d = √(l² + w² + h²)

Derivation: drop a face diagonal across the bottom rectangle, length √(l² + w²). Then build a right triangle with this face diagonal and the height h as legs; the space diagonal is the hypotenuse. Applying Pythagorean: d² = (l² + w²) + h² = l² + w² + h². See the 3D Pythagorean Theorem Calculator for the derivation in detail.

The cube — a special case

When l = w = h = s (a single side length), all three formulas simplify:

  • Volume: V = s³
  • Surface area: SA = 6s² (6 identical square faces)
  • Space diagonal: d = s√3

The cube's space diagonal s√3 comes from d = √(s² + s² + s²) = √(3s²) = s√3 ≈ 1.732s. Compare to the face diagonal of a square (s√2 ≈ 1.414s) — the cube's body diagonal is longer because it spans through 3D, not 2D.

Worked example 1 — rectangular prism

A box has l = 8, w = 5, h = 4.

  • Volume: V = 8 × 5 × 4 = 160
  • Surface area: SA = 2(40 + 32 + 20) = 2(92) = 184
  • Space diagonal: d = √(64 + 25 + 16) = √105 ≈ 10.247

Worked example 2 — cube

A cube has s = 6.

  • Volume: V = 6³ = 216
  • Surface area: SA = 6(6²) = 6 × 36 = 216
  • Space diagonal: d = 6√3 ≈ 10.392

(Coincidence: V = 216 and SA = 216 for s = 6. This is the ONLY positive cube side where V = SA — solve s³ = 6s² → s = 6.)

Worked example 3 — find missing dimension from volume

A rectangular prism has volume 120 cm³, length 6 cm, and width 4 cm. Find height.

From V = l × w × h: 120 = 6 × 4 × h = 24h, so h = 5 cm.

Volume vs surface area — which grows faster?

For similar boxes (or cubes scaled up), volume grows as k³ but surface area grows as k². So as the box gets larger:

  • Volume grows faster than surface area.
  • The ratio "surface area to volume" decreases as size increases.

This is why larger animals lose heat slower (less surface per unit volume), larger ice cubes melt slower (same), and engineers must scale heat-dissipation surfaces (radiator fins) faster than the heat-generating volume in scaled-up machines. The "surface-to-volume ratio" is one of the most universal scaling laws in nature.

Open vs closed boxes

An open-top box (no lid) has surface area:

SA_open = lw + 2lh + 2wh (one less face — the top)

Useful for things like swimming pools (no lid), water tanks, or boxes whose top is to be replaced. Adjust by subtracting the missing face's area from the closed formula.

Real-world applications

  • Shipping and storage. Box volume determines how much fits inside; surface area determines packaging material needed.
  • Architecture. Room volume (for HVAC sizing) and surface area (for paint, drywall, insulation) both come from these formulas.
  • Aquariums and tanks. Water volume (for chemistry calculations) plus glass surface area (for cost of glass).
  • Logistics. Dimensional weight pricing uses the larger of actual weight vs (length × width × height / divisor) — purely a rectangular-prism volume calculation.
  • Refrigerators and freezers. Interior volume in cubic feet/liters comes from l × w × h.

The cube as a "perfect" 3D shape

The cube is the 3D analog of the square — both have all edges equal and all angles equal to 90°. The cube is one of the five Platonic solids (regular convex polyhedra), along with the tetrahedron, octahedron, dodecahedron, and icosahedron. It is the only Platonic solid that can tile 3D space with copies of itself — a property used in everything from sugar cubes to data center cooling architectures.

Common mistakes

  • Computing surface area without the factor of 2. Each pair of faces appears twice — front/back, top/bottom, left/right. Forgetting the 2 gives half the correct surface area.
  • Mixing units. Volume is l × w × h, units are cubic (cm³, m³). Surface area is in square units (cm², m²). Diagonal is in linear units (cm, m). Easy to get confused with cubic vs square.
  • Using a face diagonal instead of the space diagonal. Face diagonal = √(l² + w²) (or any 2 dimensions). Space diagonal = √(l² + w² + h²) (all 3). The space diagonal is longer.
  • Treating "cube" and "square" as synonyms. Square is 2D, cube is 3D. A 3 × 3 square has area 9; a 3 × 3 × 3 cube has volume 27.

Frequently Asked Questions – Cube and Rectangular Prism Calculator

Volume (V = l × w × h), surface area (SA = 2(lw + lh + wh)), and space diagonal (d = √(l² + w² + h²)) of a rectangular box or cube.

A cube has all three dimensions equal (l = w = h), simplifying to V = s³ and SA = 6s². Enter equal values for all three dimensions to calculate a cube.

The longest internal line of the box, connecting two diagonally opposite corners through the interior. It is calculated using the 3D Pythagorean theorem.

Divide the volume by the base area: h = V / (l × w). A box with a volume of 60 and a 3 × 4 base is 60 / 12 = 5 tall. Enter the volume and two dimensions above.

The area of the four side faces only, without the top and bottom: 2h(l + w). For a 3 × 4 × 5 box it is 2 × 5 × 7 = 70; adding the two 3 × 4 ends gives the total of 94.

Yes — free and unlimited.

The surface-to-volume ratio drives biology, engineering, and thermodynamics

The tutorial above notes that volume scales with the cube of size while surface area scales with the square. This surface-to-volume ratio — informally called S/V — turns out to be one of the most important scaling laws in the physical world, with consequences that reach from cellular biology to server-farm cooling.

Body heat. A cube 1 cm on a side has surface area 6 cm² and volume 1 cm³ — S/V = 6. Scale to 10 cm per side: S/V = 0.6. Scale to 100 cm: S/V = 0.06. The larger cube has proportionally 100× less surface per unit of volume. This is why elephants and whales can live in cold water while shrews and mice cannot — small mammals lose heat through their skin (surface) faster than they can generate it in their bodies (volume). Shrews eat almost continuously; large whales don't need to. The size difference isn't accidental — the S/V ratio sets a lower bound on how small a warm-blooded animal can be, at roughly the size of the bumblebee bat (2 grams).

Chip cooling. Modern CPUs generate heat proportional to their transistor count (volume) but can only dissipate it through their surface. As chips get denser, the S/V ratio drops, and passive dissipation stops being enough. Heat sinks with fin geometry (increasing the effective surface area of the chip) are engineering compensation for the unfavorable scaling. Data-center design fundamentally revolves around this: high-power servers need proportionally larger cooling surfaces, which is why server rooms are dominated by fans, radiators, and airflow management. A hypothetical CPU twice the size of current models would need 2³ = 8× the heat dissipation but only offers 2² = 4× the surface — a factor-of-2 shortfall.

Cells. Living cells must exchange nutrients and waste through their membrane. As a cell grows, its S/V ratio drops, eventually making membrane exchange the limiting factor. Cells divide before they get "too big" precisely because of this scaling. Most bacterial cells are around 1-2 μm across; a hypothetical bacterium the size of a marble would have hopelessly insufficient membrane area to feed its interior. Eukaryotic cells reach larger sizes partly by having internal organelles (mitochondria, endoplasmic reticulum) that provide additional effective surface area inside the cell itself.

All three cases — mammal, chip, cell — are governed by the same V/S = k · size relationship the cube-and-prism formulas produce. The mathematics is elementary; the biological and engineering consequences are enormous.

The cube is the only Platonic solid that tiles 3D space

The tutorial mentions that the cube is one of the five Platonic solids — regular convex polyhedra with congruent regular-polygon faces meeting at identical vertices. The five are: tetrahedron (4 triangular faces), cube (6 squares), octahedron (8 triangles), dodecahedron (12 pentagons), and icosahedron (20 triangles). No other regular polyhedra exist in three dimensions.

Among these five, only the cube can be arranged as a space tiling — infinite copies filling all of 3D space without gaps or overlaps. Tetrahedra alone leave gaps; octahedra alone leave gaps; dodecahedra and icosahedra fail even worse. Only the cube's 90° dihedral angles let four cubes meet at each edge and eight cubes meet at each vertex, cleanly filling space.

This uniqueness has downstream consequences. Crystallography: the simplest crystal lattice — the "simple cubic" — is a stack of cubes. Iron at high temperatures and many artificial crystalline materials adopt this arrangement. More common variants (body-centered cubic, face-centered cubic) are still built on cubic packing frameworks. The seven crystal systems that classify all real crystals include the cubic system as the highest-symmetry option.

Shipping and logistics: the standard ISO shipping container is rectangular-prism shaped (typically 20 ft × 8 ft × 8.5 ft or 40 ft × 8 ft × 8.5 ft) precisely because cubic geometry stacks efficiently without wasted space. A yard of shipping containers packs 100% of its ground area — impossible with cylindrical or hexagonal containers. The world economy runs on the space-filling property of rectangular prisms.

Storage and architecture: rooms, warehouses, refrigerators, and shelving units all use rectangular-prism geometry because it fills whatever larger rectangular-prism space contains them without waste. Curved or non-cubic shapes require empty gap space between them. The 90° angles that make cubes special also make them tessellating — a property no other regular polyhedron has.

Cube geometry questions worth answering

How many ways can you unfold a cube into a flat shape?

Exactly 11 distinct nets of a cube. Each net consists of six squares connected edge-to-edge in a flat arrangement that can be folded into a cube. The most familiar is the "T-tetromino plus tail" shape often drawn in geometry textbooks; another is the classic cross shape formed by five squares in a row and one attached above the middle. Cardboard box designers exploit this: packaging manufacturers pick nets that minimize waste when die-cut from rectangular cardboard sheets. Solving the "which arrangement of squares folds into a cube" problem is a standard exercise for teaching combinatorial geometry, and the answer 11 was proven around 1900 but somehow feels smaller than expected — you'd think there'd be many more, but the topological constraint of "must fold cleanly" limits the options.

Among boxes with fixed surface area, does the cube have maximum volume?

Yes — this is the 3D isoperimetric inequality for rectangular prisms. Given a fixed surface area S, the rectangular prism enclosing the most volume is the one with equal edges (i.e., a cube). The cube's S/V ratio is the smallest possible among rectangular prisms of given surface area. If you're packaging a fixed amount of material to enclose the greatest volume, cube shape wins. More generally, if you allow any shape (not just rectangular prisms), the sphere wins — it has the smallest S/V ratio of any 3D shape. The cube is the "best rectangular shape"; the sphere is the "best overall shape." This is why bubbles are spherical, water droplets tend spherical, and soap films minimize their surface area under surface-tension constraints. In package design where rectangular shapes are required (for stacking, storage, or shipping), the cube wins the volume-optimization contest.

What is a Rubik's cube from a geometry standpoint?

Erno Rubik's 1974 invention is a 3×3×3 cube made of 26 smaller cubies (with a hidden 27th at the center of the mechanism), where each of the six faces can rotate independently. There are 43,252,003,274,489,856,000 reachable configurations — over 43 quintillion. The mathematical structure is a group generated by the six face-rotation operations, subject to relations that arise from the cube's geometric constraints. Any state can be solved in at most 20 face rotations from any starting position — a fact called "God's number" that was only proven in 2010 via exhaustive computer search across all states. The Rubik's cube is a case study in how a geometric object's combinatorial structure can be much more complex than its shape suggests.

Why is the "diagonal" formula for a cube s√3 rather than 3s?

Because the diagonal isn't three edges laid end-to-end — it cuts through the interior at an angle. The formula d = s√3 comes from applying the Pythagorean theorem twice: once to the bottom face (giving a face diagonal of s√2), then again with that diagonal and the height s as the two legs of a new right triangle. Adding squares: d² = (s√2)² + s² = 2s² + s² = 3s², so d = s√3. The result reflects that the space diagonal cuts across all three dimensions simultaneously. 3s would be the total length of three straight edges, not the diagonal — a common confusion for students first encountering 3D geometry.