Diagonal of a Cuboid: Formula Derivation and Examples

#Diagonal of a Cuboid
TL;DR
The diagonal of a cuboid joins two opposite corners through the inside, and its length is D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2} for a box of length aa, width bb and height cc. It comes from using the Pythagoras theorem twice.
Ashish Chauhan·reviewed byShikha SharmaLast updated on December 2, 202614 min read

Key Points

  • Space (body) diagonal: D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2}. A cuboid has 4, all the same length.
  • Face diagonal: uses two edges only, for example a2+b2\sqrt{a^2 + b^2}. A cuboid has 12.
  • Derivation: floor diagonal d=a2+b2d = \sqrt{a^2 + b^2}, then D=d2+c2D = \sqrt{d^2 + c^2}.
  • Cube with edge ss: face diagonal s2s\sqrt{2}, space diagonal s3s\sqrt{3}.
  • The space diagonal is the longest straight line that fits inside the box.

The Longest Thing That Fits in a Box

A box 40 cm long, 30 cm wide and 120 cm tall can hold a 130 cm rod, longer than any edge. Tilted from a bottom corner to the opposite top corner, it slides in with nothing to spare.

  • The line the rod lies along is the diagonal of the cuboid.
  • Its length depends only on the box's three measurements.
  • The maths is the Pythagoras theorem, used twice.
the space diagonal of a 4 by 3 by 12 cuboid is 13, longer than every edge
A tall box 4 by 3 by 12 drawn in 3D with an orange space diagonal running from a bottom corner to the opposite top corner, labelled D = 13, beside the working D² = 4² + 3² + 12² = 169, so D = 13.

What Is the Diagonal of a Cuboid?

The diagonal of a cuboid usually means its space diagonal (or body diagonal): the straight line joining two corners that do not share a face.

D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2}
  • A cuboid (or rectangular prism) is a box with 6 rectangular faces, 12 edges and 8 corners: a brick, a matchbox, a room.
  • Its space diagonal passes through the inside of the box, across all three dimensions at once.
  • That makes it the longest straight line the cuboid holds. The derivation below shows where the formula comes from.

Labels used on this page and in the tool:

  • aa = length, bb = width, cc = height;
  • dd = the diagonal of the floor (the bottom face);
  • DD = the space diagonal.

Many textbooks write ll, bb, hh instead: l2+b2+h2\sqrt{l^2 + b^2 + h^2} is the same formula.

What Are the Two Types of Diagonals in a Cuboid?

A cuboid holds two kinds of diagonal, and telling them apart is the first real step.

  • Face diagonal: joins opposite corners of one face and lies flat on it. It is just the diagonal of a rectangle. There are 12.
  • Space diagonal: joins corners that share no face and runs through the inside. There are 4, all equal.
Face diagonal Space diagonal
Joins opposite corners of one face opposite corners of the whole box
Lies flat on the surface through the inside
Uses two edges all three edges
Length a2+b2\sqrt{a^2 + b^2}, a2+c2\sqrt{a^2 + c^2} or b2+c2\sqrt{b^2 + c^2} a2+b2+c2\sqrt{a^2 + b^2 + c^2}
How many 12 (two on each of 6 faces) 4
each face diagonal of a cuboid uses two edges while the space diagonal uses all three and is the longest
A 6 by 8 by 10 box with three face diagonals drawn on its visible faces (top 10, front about 11.66, side about 12.81) and an orange space diagonal of about 14.14 through the inside.

A face diagonal knows only one flat rectangle; the space diagonal knows the whole box, which is why the rod depends on it.

How Do You Derive the Diagonal of a Cuboid Formula?

The formula comes from the Pythagoras theorem twice: in a right triangle, the longest side (the hypotenuse) squared equals the sum of the other two sides squared.

Step 1: across the floor

The floor is a rectangle with sides aa and bb. Its diagonal dd is the hypotenuse:

d2=a2+b2d^2 = a^2 + b^2

Step 2: from the floor up to the far corner

  • From the end of dd, the vertical edge cc rises at a right angle to the floor, so also to dd.
  • That makes an upright right triangle with legs dd and cc and hypotenuse DD:
D2=d2+c2D^2 = d^2 + c^2

Step 3: substitute and finish

Replace d2d^2 with a2+b2a^2 + b^2:

D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2}
Symbol Meaning Units
DD Length of the space diagonal cm, m (length units)
aa Length of the cuboid cm, m
bb Width (breadth) of the cuboid cm, m
cc Height of the cuboid cm, m

For a 4 by 3 by 12 box: d=16+9=5d = \sqrt{16 + 9} = 5 and D=25+144=13D = \sqrt{25 + 144} = 13. It climbs at about 67.4°67.4° to the floor, since tan⁡θ=125\tan\theta = \tfrac{12}{5}.

the space diagonal comes from Pythagoras twice, first across the floor and then up to the far corner
Two views of a 4 by 3 by 12 box. Left: the floor shaded with its diagonal d = 5. Right: an upright right triangle inside the box with legs d = 5 and c = 12 and hypotenuse D = 13, rising at 67.4 degrees to the floor.

Does it matter which face you start from?

No. Go up the front wall first and then across, or any other route: every one gives D2=a2+b2+c2D^2 = a^2 + b^2 + c^2. A second route is a handy check.

A second way: the 3D distance formula

  • Put one corner at (0,0,0)(0, 0, 0) with the edges along the axes. The opposite corner is (a,b,c)(a, b, c).
  • The distance between two points in space is
(x2−x1)2+(y2−y1)2+(z2−z1)2\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}
  • From (0,0,0)(0, 0, 0) to (a,b,c)(a, b, c) that is exactly a2+b2+c2\sqrt{a^2 + b^2 + c^2}.
  • The flat version, the distance between two points on a grid, has one fewer square.
the space diagonal of a cuboid is the 3D distance from one corner to the opposite corner
A 5 by 2 by 2 box placed on x, y and z axes with one corner at the origin O and the opposite corner at P(5, 2, 2), joined by an orange diagonal of length √33, about 5.74.

Try It Yourself

In the tool, move the sliders for aa, bb and cc. The orange dashed line is the floor diagonal dd and the green line is DD. Make cc tiny and watch DD shrink to dd.

Properties of the Space Diagonals

The four space diagonals share some neat facts.

  • All four are the same length: each crosses the full length, width and height once.
  • They all cross at the centre and cut each other in half there, because the box is symmetric about its centre.
the four space diagonals of a cuboid are equal and meet at its centre
A 6 by 4 by 3 box with all four space diagonals drawn in different colours, crossing at a dot marked centre, each of length √61, about 7.81.
  • It is the longest straight line inside the box. Two points in the box differ by at most aa, bb and cc along each direction, so they are at most DD apart.
  • It beats every edge and face diagonal: a third positive square under the root always adds length.
  • For a long, thin box, only just. A 1 by 1 by 10 box has D=102≈10.10D = \sqrt{102} \approx 10.10, just 1% more than its longest edge.
  • In a cube, DD is 3≈1.73\sqrt{3} \approx 1.73 times the edge, the biggest gain any box gives.

Edge cases worth checking

  • A flat box: let cc shrink to 0 and the formula becomes a2+b2\sqrt{a^2 + b^2}; let bb shrink too and it is just aa, a line segment.
  • A cube with edge ss: face diagonal s2s\sqrt{2}, space diagonal s3s\sqrt{3}, the same pattern as the diagonal of a square. It always rises at about 35.26°35.26°.

Examples of the Diagonal of a Cuboid

The examples move from a cube to a real packing decision and a backwards problem. Surds stay exact; decimals are rounded to two places.

Example 1

Find the face diagonal and the space diagonal of a cube with edge 5 cm.

  1. Face diagonal: 25+25=52≈7.07\sqrt{25 + 25} = 5\sqrt{2} \approx 7.07 cm.
  2. Space diagonal: 25+25+25=53≈8.66\sqrt{25 + 25 + 25} = 5\sqrt{3} \approx 8.66 cm.
a cube with edge 5 has face diagonal 5 root 2 and space diagonal 5 root 3
A cube with edge 5 showing a blue face diagonal of 5√2 and an orange space diagonal of 5√3, with the working √(5² + 5²) = √50 = 5√2 and √(5² + 5² + 5²) = √75 = 5√3.

Final answer: 525\sqrt{2} cm and 535\sqrt{3} cm.

Example 2

A box measures 6 cm by 8 cm by 10 cm. A student says its diagonal is 10 cm. Is that right?

  1. 10 cm is the longest edge. The diagonal must be longer than any edge.
  2. Adding edges (24 cm) is also wrong: a straight line is shorter than a bent path.
  3. D=36+64+100=200=102D = \sqrt{36 + 64 + 100} = \sqrt{200} = 10\sqrt{2}.

Final answer: 102≈14.1410\sqrt{2} \approx 14.14 cm, between 10 and 24, as it must be.

Example 3

A room is 5 m long, 4 m wide and 3 m high. What is the longest straight pole that could fit in it?

  1. D=25+16+9=50=52≈7.07D = \sqrt{25 + 16 + 9} = \sqrt{50} = 5\sqrt{2} \approx 7.07 m.

Final answer: just over 7 m, from a floor corner to the opposite ceiling corner. The longest wall is only 5 m.

Example 4

A crate measures 40 cm by 30 cm by 120 cm. Will a thin 130 cm rod fit inside?

  1. D=1600+900+14400=16900=130D = \sqrt{1600 + 900 + 14400} = \sqrt{16900} = 130 cm.
a 130 cm rod just fits along the space diagonal of a 40 by 30 by 120 cm crate
A tall crate 40 by 30 by 120 cm with a blue rod lying along its space diagonal from a bottom corner to the opposite top corner, and the working D² = 1600 + 900 + 14400 = 16900, so D = 130 cm.

Final answer: yes, but only corner to corner along the diagonal; any thicker and it will not.

Example 5

A cuboid has length 2 m, width 3 m and space diagonal 7 m. Find its height.

  1. Work backwards: 72=22+32+c27^2 = 2^2 + 3^2 + c^2.
  2. 49=13+c249 = 13 + c^2, so c2=36c^2 = 36.

Final answer: c=6c = 6 m. Working backwards is where the formula is really tested.

Example 6

For a cuboid measuring 1 by 2 by 2, find the ratio of the space diagonal to the face diagonal of the largest face.

  1. Space diagonal: 1+4+4=3\sqrt{1 + 4 + 4} = 3.
  2. The largest face is 2×22 \times 2: its diagonal is 8=22\sqrt{8} = 2\sqrt{2}.
  3. 322=324≈1.06\frac{3}{2\sqrt{2}} = \frac{3\sqrt{2}}{4} \approx 1.06.

Final answer: about 1.061.06. The space diagonal always beats the largest face diagonal.

What Are the Most Common Mistakes With the Diagonal of a Cuboid?

Each mistake has a quick size check.

Mistake 1: Stopping at the floor diagonal

Where it slips in: Right after Step 1, when a2+b2\sqrt{a^2 + b^2} already looks like an answer.

Don't do this: Report d=a2+b2d = \sqrt{a^2 + b^2} as the cuboid's diagonal. It ignores the height.

The correct way: Use all three squares. If your line stays on the floor, add c2c^2.

Mistake 2: Adding the edges instead of their squares

Where it slips in: When rushing, as in Example 2.

Don't do this: Write D=a+b+cD = a + b + c, or a+b+c\sqrt{a + b + c}.

The correct way: Square each edge, add, then take one square root. Write the three squares on separate lines.

Mistake 3: Mixing units

Where it slips in: Boxes given as "1.2 m by 40 cm by 30 cm".

Don't do this: Square 1.2, 40 and 30 as they stand.

The correct way: Convert first: 120, 40 and 30 cm give D=130D = 130 cm.

Mistake 4: Forgetting the square root

Where it slips in: Long problems where D2D^2 is on the last line.

Don't do this: Answer "169 cm" for the 4 by 3 by 12 box.

The correct way: D2=169D^2 = 169, so D=13D = 13. The diagonal should be just a bit longer than the longest edge.

Mistake 3 has a famous cousin. In 1999 NASA lost the Mars Climate Orbiter because one team gave thruster data in imperial units and another read it as metric.

Why Does the Diagonal of a Cuboid Matter?

"The shortest line across three dimensions at once."

That idea shows up far outside a worksheet.

  • Packing and shipping. Whether a pole, ski or pipe fits is decided by the space diagonal, not the longest edge.
  • Furniture and rooms. Tipping a wardrobe upright needs its diagonal across depth and height to be under the ceiling height.
  • Frames and braces. A corner-to-corner brace is a face or space diagonal; the wrong length leaves a frame that leans.
  • 3D graphics and games. Programs wrap objects in invisible boxes and use the diagonal for quick size and collision checks.

Conclusion

  • The diagonal of a cuboid is usually the space diagonal, D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2}; a face diagonal uses two squares.
  • It is Pythagoras twice, and the same fact as the 3D distance formula.
  • All 4 space diagonals are equal, meet at the centre and are the longest line in the box.
  • Keep units the same, square before adding, and finish with the square root.

Where Should You Practice the Diagonal of a Cuboid Next?

Measure a shoebox, predict its space diagonal, then check with a string stretched corner to corner. Then try these:

  1. Find the space diagonal of a cuboid measuring 9 cm by 12 cm by 8 cm.
  2. A cube has a space diagonal of 636\sqrt{3} cm. Find its edge length.
  3. A box is 24 cm by 32 cm by 30 cm. Find the longest straight rod that fits inside.
  4. Find the space diagonal of a 2 by 3 by 6 box.

Answers: (1) 17 cm. (2) 6 cm. (3) 50 cm. (4) 7. Stuck on 2? Compare s3s\sqrt{3} with 636\sqrt{3}, as in Example 1.

To work through 3D geometry with a teacher, explore Bhanzu's geometry tutor, a high school math tutor or math classes online.

Want a live Bhanzu trainer to help your child see 3D shapes clearly? Book a free demo class, online globally, or in person at our McKinney, TX center.

Read More

Research Behind This Article

  1. Euclid, Elements, Book I, Proposition 47 (the Pythagoras theorem, used twice), with commentary by D. E. Joyce, Clark University. mathcs.clarku.edu
  2. OpenStax, Calculus Volume 3, Section 2.2: Vectors in Three Dimensions (the distance formula in space). openstax.org
  3. NASA Science, Mars Climate Orbiter mission page. science.nasa.gov
  4. OpenStax, Prealgebra 2e, Section 9.3: Use Properties of Angles, Triangles, and the Pythagorean Theorem. openstax.org

Quick Quiz: Check Yourself

Three levels, questions with figures, instant feedback with the reason.

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the formula for the diagonal of a cuboid?
D=a2+b2+c2D = \sqrt{a^2 + b^2 + c^2}, where aa, bb and cc are the length, width and height. With ll, bb, hh it reads l2+b2+h2\sqrt{l^2 + b^2 + h^2}.
How many diagonals does a cuboid have?
16 in all: 12 face diagonals and 4 space diagonals.
Are all the diagonals of a cuboid equal?
The 4 space diagonals are. The face diagonals come in three lengths, unless the cuboid is a cube.
What is the diagonal of a cube with side s?
s3s\sqrt{3} for the space diagonal and s2s\sqrt{2} for a face diagonal.
Can the diagonal of a cuboid be negative?
No. It is a length, so the square root is always the positive value.
✍️ Written By
Ashish Chauhan
Ashish Chauhan
Math Curriculum Developer
Ashish Chauhan is a Mathematics and Science educator and curriculum developer with 6+ years of experience teaching students from Grades 3–12. He specializes in simplifying complex concepts through conceptual, student-centered learning and has worked across CBSE, PSEB, and international curricula. Beyond teaching, Ashish develops K–12 educational content, lesson plans, and assessments aligned with US learning standards. He holds a BS in PCM and an MS in Chemistry, bringing a strong STEM foundation to education and curriculum design.
🔬 Reviewed By
Shikha Sharma
Subject Matter Expert
Book a FREE Demo ClassBook Now →