Rectangular Prism Diagonal Calculator: Find the Longest Distance Inside a Box
ByMuhammad Ali•Founder of KruskalCode
21:59
6 min read

Have you ever wondered how to find the longest straight line you can draw inside a box? That's exactly what the space diagonal of a rectangular prism is! Whether you're working on a geometry problem, trying to fit a long object into a tight space, or just curious, understanding how to calculate this diagonal is a useful skill. Our Rectangular Prism Diagonal Calculator makes it simple.
Explanation
A rectangular prism, often called a cuboid or simply a box, is a three-dimensional shape with six rectangular faces. Its dimensions are defined by its length (l), width (w), and height (h). While you might be familiar with finding the diagonal of a flat rectangle (using the Pythagorean theorem), the space diagonal extends this concept into 3D. It connects one corner of the prism to the opposite corner, passing through the very center of the shape. This calculation is crucial in various fields, from architecture and engineering to packing and design.
Formula
The formula for the space diagonal (d) of a rectangular prism is: d = √(l² + w² + h²) Where: * 'l' is the length of the prism * 'w' is the width of the prism * 'h' is the height of the prism
Example
Let's say you have a rectangular prism with a length of 8 meters, a width of 4 meters, and a height of 3 meters. To find its space diagonal: 1. **Square each dimension:** * Length² = 8² = 64 * Width² = 4² = 16 * Height² = 3² = 9 2. **Add the squared values:** * 64 + 16 + 9 = 89 3. **Take the square root of the sum:** * d = √89 ≈ 9.434 meters So, the space diagonal of this rectangular prism is approximately 9.434 meters.
How to use the related calculator
Using our Rectangular Prism Diagonal Calculator is straightforward. Simply locate the input fields labeled 'Length (l)', 'Width (w)', and 'Height (h)'. Enter the numerical values for each dimension of your rectangular prism. Make sure all your measurements are in the same units (e.g., all in centimeters, all in inches). Once you've entered the values, the calculator will instantly display the space diagonal, showing both the exact square root form and a rounded decimal approximation.
Try the related calculator
Open toolFAQ
What is a rectangular prism's space diagonal?
The space diagonal of a rectangular prism is the line segment that connects two opposite vertices (corners) of the prism, passing through its interior. It's the longest possible straight line you can draw inside the prism.
How is the formula derived?
The formula for the space diagonal is an extension of the Pythagorean theorem. First, you find the diagonal of the base (d_base = √(l² + w²)). Then, you use this base diagonal and the height to find the space diagonal (d = √(d_base² + h²)), which simplifies to d = √(l² + w² + h²).
Can I use this for a cube?
Yes! A cube is a special type of rectangular prism where all sides (length, width, and height) are equal. Simply enter the side length for all three inputs, and the calculator will give you the cube's space diagonal.
Related articles

About the author
Muhammad Ali. Muhammad Ali is a full-stack developer and founder of KruskalCode. He builds SaaS platforms and automation systems with React and Laravel, and helps teams ship fast, scalable tools.
Need a custom calculator, dashboard, or automation workflow? Reach out to KruskalCode.