StatGardenREF. DESK
Calculators/Geometry/Diagonal of a Rectangle
Geometry

Diagonal of a Rectangle calculator

The diagonal length of a rectangle from its two side lengths, using the Pythagorean theorem.

Published 21 August 2026

What this calculator does

The diagonal of a rectangle is the straight line connecting two opposite corners, cutting the rectangle into two right-angled triangles. Because the length and width meet at a right angle, that diagonal is simply the hypotenuse of a right triangle with those two sides.

The formula is the Pythagorean theorem applied directly: diagonal equals the square root of length squared plus width squared. It comes up constantly in practical settings, from checking whether a piece of furniture will fit through a doorway to squaring up a rectangular frame or foundation.

The formula

Formulad = √(length² + width²)

Square the length, square the width, add the two together, then take the square root of the total. The result is the straight-line distance between opposite corners of the rectangle.

TermMeaning
dDiagonal length, the hypotenuse of the right triangle formed by the length and width.
Length and widthThe two side lengths of the rectangle, meeting at a right angle.

The inputs explained

FieldWhat to enter
LengthThe longer side of the rectangle.
WidthThe shorter side of the rectangle.

When to use it

Checking if an item fits through an opening

A flat panel or piece of furniture that will not fit upright can sometimes still pass through a doorway or gap on the diagonal, so knowing the diagonal length tells you the true maximum straight-line dimension.

Squaring up a rectangular frame or foundation

A rectangle is only truly square-cornered if both diagonals are equal; measuring the diagonal against this calculated value is a standard way to check a frame, deck or foundation before fixing it in place.

Working out screen or panel size

Screens and panels are commonly specified by their diagonal measurement, so converting a rectangle's length and width into a diagonal, or checking a stated diagonal against known side lengths, uses this same calculation.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How the diagonal changes as length increases at a fixed width

A fixed width of 5, across a range of lengths.

Width 5
LengthDiagonal length
35.831
67.810
910.296
1213.000
1515.811
2020.616
The diagonal grows more slowly than the length once the length is already much larger than the width, since it is bounded below by the length itself and only ever adds a shrinking correction for the width.

How the diagonal changes as width increases at a fixed length

A fixed length of 12, across a range of widths.

Length 12
WidthDiagonal length
312.369
513.000
713.892
915.000
1216.971
1620.000
When width equals length, at 12 in this table, the rectangle is a square and the diagonal is length times the square root of 2.

Questions

Is this the same as a Pythagorean theorem calculation?

Yes. A rectangle's diagonal is exactly the hypotenuse of a right triangle whose two legs are the rectangle's length and width, so the underlying maths is identical to the general Pythagorean theorem.

Do both diagonals of a rectangle have the same length?

Yes, always, for any true rectangle. Both diagonals connect opposite corners and both form the hypotenuse of a congruent right triangle made from the same length and width.

How do I use the diagonal to check a shape is square-cornered?

Measure both diagonals of the actual object. If they match each other, and match the value this calculator gives for the intended length and width, the corners are true right angles; if the measured diagonals differ from each other, the shape is out of square.

Can the diagonal ever be shorter than the length or width?

No. The diagonal is always the longest straight line across a rectangle, since it is the hypotenuse of a right triangle, and a hypotenuse is always longer than either of the two legs that form it.

For a general Pythagorean theorem solver covering any right triangle, see the Pythagoras theorem hypotenuse calculator. For the area and perimeter of the same rectangle, see the volume of rectangle calculator.