Diagonal of Cube Calculator – Space and Face Diagonal Explained
The space diagonal (also called the body diagonal) of a cube is the longest straight line that fits inside it — a line connecting two opposite vertices that passes straight through the cube's interior. This calculator finds the space diagonal and the face diagonal from a cube's side length, or reverses the process to solve for the side length when a diagonal is already known. It's useful in architecture, packaging design, 3D modeling, and geometry education whenever you need the maximum dimension that will fit inside — or pass through — a cube-shaped space.
The Space Diagonal Formula
The space diagonal is derived by applying the Pythagorean theorem twice. First, the diagonal across one face of the cube is found using the two edges that form that face:
f = √(a² + a²) = a√2
That face diagonal then becomes one leg of a second right triangle, with the cube's height as the other leg and the space diagonal as the hypotenuse:
d = √(f² + a²) = √(2a² + a²) = √(3a²) = a√3
For example, a cube with a side length of 6 cm has a face diagonal of 6 × √2 ≈ 8.4853 cm and a space diagonal of 6 × √3 ≈ 10.3923 cm. No external library is required — both formulas rely only on Math.sqrt().
Reverse Calculations
If you already know a diagonal and need the side length, rearrange either formula:
a = d / √3 — side length from the space diagonala = f / √2 — side length from the face diagonal
Continuing the example above, a space diagonal of 10.3923 cm gives a = 10.3923 / √3 ≈ 6 cm, and a face diagonal of 8.4853 cm gives a = 8.4853 / √2 ≈ 6 cm — both recover the original side length.
Unit Conversion
Enter the side length or diagonal in any supported unit — millimeters, centimeters, meters, kilometers, inches, feet, or yards — and the calculator converts internally to a consistent base unit before computing the result, then displays the answer back in your chosen unit.
Surface Area and Volume
Alongside the diagonals, the calculator also reports the cube's surface area and volume for convenience:
Surface Area = 6a²Volume = a³
Common Applications
- Packaging and shipping — determining the longest item that can fit diagonally inside a cube-shaped box
- Architecture and construction — checking clearances for cube-shaped rooms, elevator shafts, or storage units
- 3D modeling and game design — computing bounding diagonals for collision detection and camera framing
- Furniture and moving — verifying whether a large cube-shaped object can be tilted diagonally through a doorway
- Geometry education — demonstrating how the Pythagorean theorem extends from two dimensions into three
Precision and Accuracy
All calculations use standard 64-bit floating-point arithmetic (IEEE 754), accurate to about 15 significant digits. Displayed values are rounded to your chosen precision, from 0 to 10 decimal places.