Geometry
How To Calculate The Diagonal Of A Rectangle
The diagonal of a rectangle is the straight line between two opposite corners, and the Pythagorean theorem makes it easy to find from the two side lengths. This page shows how to square and add the sides, take the square root, and interpret the result alongside the perimeter, the area and the diagonal-to-length ratio. The worked examples start with the classic 6 by 8 rectangle whose diagonal is exactly 10.
Last updated
Quick Answer
d = √(l² + w²)
- d
- Diagonal — the distance between opposite corners
- l
- Length of the rectangle
- w
- Width of the rectangle
- P
- Perimeter, 2(l + w)
Square the length and the width, add the squares, then take the square root to get the diagonal. The perimeter is twice the sum of the sides and the area is their product. Dividing the diagonal by the length shows how much longer the corner-to-corner path is than one of the edges.
What Is The Diagonal Of A Rectangle?
The diagonal of a rectangle is the straight line joining two opposite corners. Every rectangle has two of them, and they cross at the centre of the shape, each one splitting the other into two equal halves. Because the corners are right angles, a diagonal is the longest straight line you can draw inside the rectangle. Knowing its length is useful whenever a measurement is needed from corner to corner rather than along an edge. It is a single number that captures how far the shape reaches from one corner to the opposite one, and it comes out the same whichever of the two diagonals you choose to measure.
Each corner of a rectangle is a right angle, so a diagonal together with two adjacent sides forms a right-angled triangle. The diagonal plays the role of the hypotenuse, and the two sides are the perpendicular legs. The Pythagorean theorem therefore gives d² = l² + w², or equivalently d = √(l² + w²). No trigonometry is needed; the right angle is enough to fix the relationship completely and to guarantee that both diagonals have the same length.
Take the default rectangle with a length of 6 and a width of 8. Squaring gives 36 and 64, whose sum is 100, and the square root of 100 is 10. The diagonal is therefore exactly 10 units, a scaled version of the familiar 3-4-5 right triangle. Because the numbers work out exactly, this example is a good way to check that a calculation has been set up correctly before moving to less tidy dimensions where the answer is a long decimal.
Two other quantities are often wanted alongside the diagonal. The perimeter is twice the sum of the sides, 2(l + w), which for the default rectangle is 28 units. The area is the product l × w, giving 48 square units. The diagonal, perimeter and area answer different questions: the first is a corner-to-corner distance, the second the length of the boundary, and the third the space enclosed. Confusing them is a common source of wrong answers.
Dividing the diagonal by one of the sides produces a dimensionless ratio that describes the shape rather than its size. For the default rectangle d/l = 10/6 = 1.6666666666666667, meaning the corner-to-corner path is about two thirds longer than the length edge. This ratio does not change if the rectangle is scaled up or down, so it is a convenient way to compare the proportions of rectangles of very different physical sizes without worrying about units. A long thin rectangle has a ratio just above one, while a square reaches the maximum possible value of √2, so the number also reveals how balanced the shape's proportions are.
Scaling both sides by the same factor k multiplies the diagonal by k as well, because the squares inside the formula each grow by k² and the square root undoes that growth. The perimeter also scales by k, while the area scales by k². Doubling the sides of the default rectangle gives a diagonal of 20 and a perimeter of 56, but an area of 192, four times the original. Keeping these three scaling behaviours distinct prevents many errors in geometry and in practical estimates.
The calculation turns up whenever a rectangular space must be crossed diagonally. A screen size is quoted as the diagonal of its rectangle, a room may need a diagonal cable run, a fence may be braced with a diagonal strut, and a rectangular box has a face diagonal that is the starting point for the three-dimensional version of the problem. In each case the two perpendicular side lengths are the natural inputs and the diagonal is the quantity to be found, so the same short formula applies again and again. Even when the final goal is a three-dimensional measurement, the face diagonal calculated here is normally the first step of the working.
Both side lengths must be positive, and a zero side collapses the rectangle into a line whose diagonal is simply the other side. A square is the special case l = w, where the diagonal becomes l√2, about 1.414213562373095 times the side. For a square of side 9 the diagonal is 12.727922061357855. The diagonal-to-length ratio therefore ranges from just above 1 for a very long thin rectangle up to √2 for a square, and it never falls below 1 because the hypotenuse is always the longest side.
The diagonal also fixes an angle: it makes an angle arctan(w/l) with the length edge, so its direction can be recovered from the same two sides. The two diagonals of a rectangle are equal in length and bisect one another at the centre, a property not shared by a general parallelogram. This is why knowing that a shape really is a rectangle matters — applying the formula to a slanted parallelogram gives the wrong answer, because its corners are not right angles and the triangle formed is not right-angled.
Formula
d = √(l² + w²)
Formula page →The diagonal is the hypotenuse of a right-angled triangle whose legs are the two sides. Square each side, add the squares and take the positive square root.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| l | Length of the rectangle | length | One of the two perpendicular sides. |
| w | Width of the rectangle | length | The side at right angles to the length. |
| d | Diagonal | length | Straight-line distance between opposite corners. |
P = 2(l + w)
Formula page →The boundary consists of two lengths and two widths, so add the two sides and double the result.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| l | Length of the rectangle | length | The longer horizontal side in the usual drawing. |
| w | Width of the rectangle | length | The side perpendicular to the length. |
| P | Perimeter | length | Total distance around the outside of the rectangle. |
A = l × w
Formula page →The area is the product of the two side lengths, measured in square units. It grows quadratically when both sides are scaled.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| l | Length of the rectangle | length | First dimension of the rectangle. |
| w | Width of the rectangle | length | Second dimension of the rectangle. |
| A | Area | area | Space enclosed by the rectangle. |
How To Calculate The Diagonal Of A Rectangle
- 1
Write down the two side lengths
Identify the length and the width and make sure both are in the same unit. With the default inputs the length is 6 and the width is 8. If one side is given in centimetres and the other in metres, convert first, because adding squares of mismatched units produces a meaningless diagonal.
- 2
Square each side
Multiply each side by itself. For the default rectangle the length squared is 36 and the width squared is 64. Squaring is what turns the two perpendicular legs into the terms of the Pythagorean theorem, so do this before adding anything together.
- 3
Add the two squares
Sum the squared sides to get the square of the diagonal. Here 36 + 64 = 100. This number is d², not the diagonal itself, so it is always larger than the diagonal for any rectangle with positive sides. Skipping the final square root is a frequent slip.
- 4
Take the square root
Find the positive square root of the sum to obtain the diagonal. For the default rectangle √100 = 10. For a square of side 9 the sum is 162 and the diagonal is 12.727922061357855. The diagonal is always longer than either side but shorter than the sum of the two sides.
- 5
Find the related quantities and check
Compute the perimeter as 2(l + w), the area as l × w and the diagonal-to-length ratio as d/l. For the default rectangle these are 28, 48 and 1.6666666666666667. Sanity-check that the diagonal exceeds the longer side and is less than l + w; otherwise the sides were added before being squared.
Examples
Example 1: Length 6, width 8
- length
- 6
- width
- 8
| Step | Calculation | Result |
|---|---|---|
| Length squared | 6 × 6 | 36 |
| Width squared | 8 × 8 | 64 |
| Sum of squares | 36 + 64 | 100 |
| Perimeter | 2 × (6 + 8) | 28.0 |
| Diagonal | √(36 + 64) | 10.0 |
Result: The diagonal is 10.0 units, the perimeter is 28.0 units, the area is 48.0 square units and the diagonal is 1.6666666666666667 times the length.
Example 2: Length 5, width 12
- length
- 5
- width
- 12
| Step | Calculation | Result |
|---|---|---|
| Length squared | 5 × 5 | 25 |
| Width squared | 12 × 12 | 144 |
| Sum of squares | 25 + 144 | 169 |
| Perimeter | 2 × (5 + 12) | 34 |
| Diagonal | √(25 + 144) | 13.0 |
Result: The diagonal is 13.0 units, the perimeter is 34 units, the area is 60 square units and the diagonal-to-length ratio is 2.6.
Example 3: Length 9, width 9 (a square)
- length
- 9
- width
- 9
| Step | Calculation | Result |
|---|---|---|
| Length squared | 9 × 9 | 81 |
| Width squared | 9 × 9 | 81 |
| Sum of squares | 81 + 81 | 162 |
| Perimeter | 2 × (9 + 9) | 36 |
| Diagonal | √(81 + 81) | 12.727922061357855 |
Result: The diagonal is 12.727922061357855 units, the perimeter is 36 units, the area is 81 square units and the diagonal-to-length ratio is about 1.414213562373095.
Calculator
Diagonal
10
- Perimeter
- 28
- Area
- 48
- Diagonal to length ratio
- 1.6667
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
Prefer a full-width tool? Open the The Diagonal Of A Rectangle calculator page.
Common Mistakes
Adding the sides before squaring
Computing (l + w)² instead of l² + w² adds an extra 2lw term and makes the diagonal too large. For the default rectangle that error gives 14 rather than 10. Square each side separately first, then add the two results.
Forgetting the square root
The sum of the squares is the square of the diagonal, not the diagonal itself. Reporting 100 for a 6 by 8 rectangle confuses d² with d. Always finish by taking the positive square root of the sum.
Confusing the diagonal with the perimeter or area
The diagonal is a single distance across the rectangle, the perimeter is the boundary length and the area is the enclosed region. They have different formulas and different units. Reading the wrong quantity from a problem leads to answers that are not even dimensionally comparable.
Mixing units between the two sides
If the length is in metres and the width in centimetres, the squares cannot be added meaningfully. Convert both sides to the same unit before doing anything else, and express the resulting diagonal in that same unit. An answer quoted in the wrong unit can be out by a factor of a hundred.
Applying the formula to a non-rectangle
The Pythagorean step relies on a right angle at each corner. A general parallelogram has slanted corners, so its diagonals are not equal and this formula does not apply. Confirm the shape really is a rectangle before using d = √(l² + w²).
Assuming the diagonal is shorter than a side
The diagonal is the hypotenuse of the triangle formed by the two sides, so it is always longer than either side and shorter than their sum. An answer that is less than the length indicates a square or square-root step has been misapplied.
FAQ
Why does the Pythagorean theorem apply to a rectangle?
Every corner of a rectangle is a right angle, so two adjacent sides and a diagonal form a right-angled triangle. The sides are the perpendicular legs and the diagonal is the hypotenuse, which is exactly the configuration the theorem describes.
Are the two diagonals of a rectangle equal?
Yes. Both span the same length and width, so each has length √(l² + w²). They also bisect one another at the centre of the rectangle. This equality is a defining property of rectangles and does not generally hold for other parallelograms.
What is the diagonal of a square?
Set l = w in the formula to get d = √(2l²) = l√2. For a square of side 9 the diagonal is 12.727922061357855. The diagonal-to-side ratio is therefore √2, about 1.414213562373095, no matter how large the square is.
How do I find a side when I know the diagonal and the other side?
Rearrange d² = l² + w² to isolate the unknown side. For example, w = √(d² − l²). With a diagonal of 10 and a length of 6, the width is √(100 − 36) = √64 = 8. Subtract the known square before taking the root.
Is the diagonal longer than the sides?
Always. The diagonal is the hypotenuse of the right-angled triangle formed by the two sides, and the hypotenuse is the longest side of a right-angled triangle. It is longer than either side but shorter than their sum, which is a useful check on any result.
How does this extend to a three-dimensional box?
Add the square of the height as well: the space diagonal of a rectangular prism is √(l² + w² + h²). The face diagonal calculated here is the intermediate step, since combining it with the height gives the full corner-to-corner distance through the solid.
References
- [1]Wikipedia, Pythagorean theorem — https://en.wikipedia.org/wiki/Pythagorean_theorem
- [2]Wikipedia, Rectangle — https://en.wikipedia.org/wiki/Rectangle
- [3]Wikipedia, Diagonal — https://en.wikipedia.org/wiki/Diagonal
