3D Pythagorean Theorem Calculator

Enter the length, width and height of a box to get its space diagonal, or the diagonal and two sides to find the third, with the working, exact answers, all three face diagonals and a drawing.

By the PythagoreanTheorem.net teamUpdated Free · no sign-up

Fill in any three boxes. The calculator solves for the one you leave empty: the space diagonal from the three dimensions, or a missing dimension from the diagonal.

d = 17

Exact answer.

  • Base diagonal15
  • Front diagonal4√13 ≈ 14.4222
  • Side diagonal√145 ≈ 12.0416
  • Diagonal’s angle with base28.07°
  • Volume864
  • Surface area552
l = 12w = 9h = 8d = 17e = 15

Step-by-step solution

  1. Write the 3D Pythagorean theorem: d2 = l2 + w2 + h2
  2. Substitute the three dimensions: d2 = 122 + 92 + 82
  3. Square each one: d2 = 144 + 81 + 64
  4. Add: d2 = 289
  5. Take the square root: d = √289 = 17
Decimals (2.5), fractions (3/4) and roots (√2) all work. All lengths must be in the same unit.

The space diagonal of a box with length l, width w and height h is d = √l2 + w2 + h2. It is the longest straight line that fits inside the box, running from one corner to the opposite corner. This 3D Pythagorean theorem calculator finds it, or works backward from the diagonal to a missing dimension.

How to use the box diagonal calculator

  1. Measure the box. You need its length, width and height in the same unit. Which dimension you call length or width does not change the diagonal.
  2. Type any three of the four values. Leave the diagonal empty to find it. To find a missing dimension instead, enter the diagonal and the other two dimensions and leave that box empty.
  3. Read the results. You get the answer in exact form when there is one, the decimal, the working, the three face diagonals, the angle between the space diagonal and the floor, the volume and the surface area.

The calculator remembers which three boxes you typed in most recently, so you can switch from "find the diagonal" to "find the height" just by typing in a different box.

The 3D Pythagorean theorem in two steps

The formula looks new, but it is the ordinary Pythagorean theorem used twice. First cross the floor of the box, then climb to the far top corner. Both moves are right triangles.

Step 1: across the floor (seen from above) Step 2: up to the far corner l = 12 w = 9 e = 15 e = √(12² + 9²) = 15 → e = 15 h = 8 d = 17 d = √(15² + 8²) = 17
The floor diagonal e is the hypotenuse of the first triangle and a leg of the second. Combining the two steps gives d² = l² + w² + h².

In symbols: the floor diagonal satisfies e2 = l2 + w2. The height stands straight up from the floor, so it meets e at a right angle, and d2 = e2 + h2. Substituting the first equation into the second removes e:

d2 = l2 + w2 + h2  d = √l2 + w2 + h2

To find a missing dimension, rearrange: h = √d2 − l2 − w2. The diagonal must be the longest of the four lengths, and d2 must be larger than the other two squares added together, otherwise no such box exists. The 3D Pythagorean theorem lesson explains the geometry in more detail, and the same formula measures the distance between two points in space in the distance calculator.

Worked examples

Example 1: the diagonal of a shipping box

A box measures 12 in by 9 in by 8 in. How long is its space diagonal?

d= √122 + 92 + 82 = √144 + 81 + 64= √289 = 17

The space diagonal is exactly 17 in. This is the example loaded in the calculator.

Example 2: the longest pole that fits in a room

A room is 12 ft long, 10 ft wide and 8 ft high. What is the longest straight pole that fits inside?

d= √122 + 102 + 82 = √144 + 100 + 64= √308 = 2√77 ≈ 17.55

About 17.55 ft, reaching from a floor corner to the opposite ceiling corner. On the floor alone the longest line is only √244 ≈ 15.62 ft.

Example 3: find a missing height

A box has a space diagonal of 13 cm, a length of 4 cm and a width of 3 cm. How tall is it?

h= √132 − 42 − 32 = √169 − 16 − 9= √144 = 12

The box is 12 cm tall. Enter 4, 3 and 13 and leave the height empty to check.

Example 4: decimal measurements

A storage crate is 1.2 m by 0.8 m by 0.5 m.

d = √1.44 + 0.64 + 0.25 = √2.33 ≈ 1.5264

The diagonal is about 1.53 m, rounded to the nearest centimeter.

Will it fit? Using the space diagonal

The most common real question behind this calculation is whether something long and thin fits inside a box, a car trunk or a room. Three rules cover it:

  • If the object is shorter than the longest side, it fits lying flat. No theorem needed.
  • If it is shorter than a face diagonal, it fits lying flat across that face. The calculator lists all three face diagonals, √l2 + w2, √l2 + h2 and √w2 + h2.
  • If it is shorter than the space diagonal, it fits only when tilted from a bottom corner to the opposite top corner. If it is longer than the space diagonal, it does not fit at all.

Example 5: does a 20-inch umbrella fit?

The box is 16 in by 12 in by 6 in. Its longest face diagonal is √162 + 122 = √400 = 20 in, exactly the length of the umbrella, so lying flat it would be a squeeze with no room for the handle. The space diagonal is

d = √162 + 122 + 62 = √436 = 2√109 ≈ 20.88

Tilted corner to corner, the umbrella fits with almost an inch to spare.

More fitting and packing questions, with full solutions, are on the word problems page.

Watch outThe space diagonal assumes a thin object and an empty, perfectly rectangular space. Real objects have thickness and real trunks have curved walls, so leave a margin.

Cubes: the √2 and √3 shortcut

When all three dimensions are equal, the box is a cube with side s, and the formulas collapse into two memorable results. A face diagonal is √s2 + s2 = s√2, the same as the diagonal of a square and the hypotenuse of a 45-45-90 triangle. The space diagonal is √s2 + s2 + s2 = s√3.

s s s√2 s√3 Face diagonal s√2 ≈ 1.414 s Space diagonal s√3 ≈ 1.732 s
In a cube the floor diagonal is s√2 and the space diagonal is s√3, because (s√2)² + s² = 3s².

For a cube with 5 cm edges the face diagonal is 5√2 ≈ 7.07 cm and the space diagonal is 5√3 ≈ 8.66 cm. The space diagonal makes an angle of about 35.26° with the floor of any cube, whatever its size.

Boxes with whole-number diagonals

Most boxes have an irrational diagonal. The ones that come out whole are called Pythagorean quadruples, the 3D cousins of Pythagorean triples. These are all the primitive ones (no common factor) with a diagonal up to 17:

lwhdCheck
12231 + 4 + 4 = 9
23674 + 9 + 36 = 49
14891 + 16 + 64 = 81
447916 + 16 + 49 = 81
269114 + 36 + 81 = 121
6671136 + 36 + 49 = 121
3412139 + 16 + 144 = 169
2514154 + 25 + 196 = 225
21011154 + 100 + 121 = 225
11212171 + 144 + 144 = 289
89121764 + 81 + 144 = 289

Multiply any row by a whole number to get another box with a whole diagonal. The 12 × 9 × 8 box in the calculator is the 8-9-12-17 row in a different order. Teachers can use these to write 3D problems with clean answers; ready-made ones are on the 3D Pythagorean theorem worksheet.

Common mistakes

  • Stopping at the floor diagonal. √l2 + w2 is only the first step. The space diagonal also includes h2.
  • Adding the lengths instead of their squares. For the 12 × 9 × 8 box, 12 + 9 + 8 = 29, but the diagonal is 17.
  • Mixing units. A box that is 2 ft by 18 in by 10 in must be converted to one unit first: 24 in by 18 in by 10 in.
  • Subtracting in the wrong order when solving for a side. Always start from d2, the largest square. More on this on the common mistakes page.

Frequently asked questions

What is the 3D Pythagorean theorem?

It says that the diagonal d of a rectangular box satisfies d2 = l2 + w2 + h2. It comes from applying a2 + b2 = c2 twice, once across the floor and once from the floor diagonal up to the opposite top corner.

What is the difference between a face diagonal and a space diagonal?

A face diagonal crosses one flat face of the box, so it uses two dimensions, such as √l2 + w2. A space diagonal goes through the inside of the box from one corner to the opposite corner and uses all three. A box has 12 face diagonals (2 on each of 6 faces) and 4 space diagonals, and the 4 space diagonals all have the same length.

How do you find the diagonal of a cube?

Multiply the side length by √3. A cube with 10 cm edges has a space diagonal of 10√3 ≈ 17.32 cm. Its face diagonals are 10√2 ≈ 14.14 cm.

Can I find the height of a box from its diagonal?

Yes, if you also know the length and width. Use h = √d2 − l2 − w2: enter the diagonal, the length and the width and leave the height empty. The result only exists when d2 is bigger than l2 + w2.

Does the formula work for shapes that are not boxes?

It works for any two points in space, which is why it doubles as the 3D distance formula. For a cylinder, the longest straight line inside runs across the circular base and up, so use the diameter and the height: √dbase2 + h2. For slanted shapes such as pyramids, split the problem into right triangles one step at a time.

Keep exploring