What Is the Diagonal of a Rectangular Prism?
A rectangular prism (also called a cuboid or box) has three dimensions: length (l), width (w), and height (h). The space diagonal is the straight line that runs from one corner of the box through its interior to the opposite corner. It is the longest straight segment that fits inside the prism. This calculator finds that diagonal instantly from the three side lengths.
How to Use the Calculator
Enter the length, width, and height of your box using the same unit (cm, inches, meters — anything works, as long as all three match). The calculator returns the space diagonal in those same units, plus the base face diagonal and the volume for convenience.
The Formula Explained
The space diagonal comes from applying the Pythagorean theorem twice. First, the diagonal of the base rectangle is \(\sqrt{l^2 + w^2}\). Then that base diagonal and the height form a right triangle, giving the full 3D diagonal:
$$d = \sqrt{l^2 + w^2 + h^2}$$
It works because the three edges are mutually perpendicular, so their squared lengths simply add.
Worked Example
Suppose a box measures \(l = 3\), \(w = 4\), and \(h = 12\). Then $$d = \sqrt{3^2 + 4^2 + 12^2} = \sqrt{9 + 16 + 144} = \sqrt{169} = 13.$$ So the longest object that could fit corner-to-corner inside the box is 13 units long.
What the Diagonal Tells You
- Longest straight line inside the box: the space diagonal runs from one corner to the opposite corner through the interior. A perfectly thin, straight object longer than \(d\) cannot fit, even when placed diagonally.
- Always longer than any edge or face diagonal: \(d > \sqrt{l^2 + w^2}\), and that face diagonal is itself longer than \(l\) and \(w\). The same holds for the other two faces.
- Always less than \(l + w + h\): a straight line is shorter than a path along three edges. For the 30 × 20 × 10 box, \(d \approx 37.42 < 30 + 20 + 10 = 60\).
- Cube: with all edges equal to \(a\), \(d = \sqrt{3a^2} = a\sqrt{3} \approx 1.732a\).
- Real-world fit depends on thickness: the diagonal applies to an ideal line with no width. A real object such as a rod, rolled poster or fishing rod has thickness, and its ends need clearance. It must therefore be somewhat shorter than \(d\), and a rigid or bulky item may not fit at all even if its length is below \(d\).
FAQ
Does the order of l, w, and h matter? No. Because all three terms are squared and added, you can swap them freely and get the same diagonal.
What units does the answer use? The same unit you enter. Use consistent units for all three dimensions.
What is the difference between the face diagonal and the space diagonal? The face diagonal lies flat on one side of the box, while the space diagonal cuts through the interior and is always longer.