About the Rectangle Calculator
A rectangle is fully determined by two independent measurements. This rectangle calculator accepts any useful pair — length and width, a side and the area, a side and the perimeter, a side and the diagonal, or even area with perimeter, area with diagonal, or perimeter with diagonal — and solves for everything else: both sides, area, perimeter, diagonal, the angle the diagonal makes with the long side, and the aspect ratio.
Use it for homework, for room and flooring layouts, for checking a frame or deck is square (the two diagonals must match the value shown), for working out a TV or monitor’s width and height from its diagonal, or for fencing a plot when you know the area and the amount of fence.
When you enter two values that leave the sides undetermined up to order (such as area and perimeter), the longer side is reported as the length. Some pairs are impossible — for example a perimeter of 20 cannot enclose an area of 30 — and the calculator tells you when that happens.
With the default inputs, the area (l × w) is 48. Change any value above to recalculate instantly.
How to use the rectangle calculator
- 1Pick the two values you already know.
- 2Enter them in the same length unit.
- 3Read the area, perimeter, diagonal and both side lengths.
- 4Use the diagonal to square up a frame, slab or deck.
Formula and method
Area, perimeter and diagonal all follow from the two sides; the diagonal is the hypotenuse of the right triangle formed by the length and width (Pythagorean theorem). With one side known, the other comes straight from the second value: W = A ÷ L, W = P ÷ 2 − L or W = √(d² − L²).
When neither side is known, the calculator solves a pair of equations. Area and perimeter give L + W = P/2 and L × W = A, so L and W are the roots of t² − (P/2)t + A = 0. Area and diagonal use (L + W)² = d² + 2A and (L − W)² = d² − 2A. Perimeter and diagonal use L × W = ((P/2)² − d²) ÷ 2 and (L − W)² = 2d² − (P/2)².
- L, W
- Length and width (L is the longer side when solved)
- A
- Area
- P
- Perimeter
- d
- Diagonal
Worked examples
8 × 6 rectangle
An 8 by 6 rectangle has area 48 and perimeter 2 × 14 = 28. Its diagonal is √(64 + 36) = 10 — the classic 3-4-5 triangle scaled by 2 — at about 36.87° to the long side.
Area 24 and perimeter 20
L + W = 10 and L × W = 24, so the sides are the roots of t² − 10t + 24 = 0: 6 and 4. The diagonal is √52 ≈ 7.21.
Length 12 and diagonal 13
The width is √(13² − 12²) = √25 = 5 (a 5-12-13 triangle), giving an area of 60 and a perimeter of 34.
Perimeter 34 and diagonal 13
Half the perimeter is 17, so L × W = (289 − 169) ÷ 2 = 60 and L − W = √(338 − 289) = 7. That gives sides of 12 and 5.
Frequently asked questions
How do you find the diagonal of a rectangle?+
Use the Pythagorean theorem: d = √(L² + W²). A 9 by 12 rectangle has a diagonal of √(81 + 144) = √225 = 15.
How do I find the length and width from area and perimeter?+
Solve t² − (P/2)t + A = 0; the two roots are the length and width. For A = 40 and P = 26 the roots of t² − 13t + 40 are 8 and 5.
How do I find the width if I know the area and length?+
Divide the area by the length: W = A ÷ L. A 150 sq ft room that is 15 ft long is 10 ft wide.
Why does the calculator say no rectangle exists?+
Some pairs are impossible. A given perimeter can enclose at most (P/4)² of area (a square), and a diagonal must be longer than either side and at least the side sum divided by √2.
What is the aspect ratio of a rectangle?+
The long side divided by the short side, written as a ratio like 1.778 : 1 (which is 16:9). It describes the shape regardless of size, as used for screens and photos.