Rectangle Calculator
Area, perimeter and diagonal — or a missing side from any one of them.
Updated
m
m
Area, perimeter and diagonal
12m²
4 × 3 m.
- Width
- 4 m
- Height
- 3 m
- Area
- 12 m²
- Perimeter
- 14 m
- Diagonal
- 5 m
The diagonal is the practical measurement. Two sides being right does not make a frame square — only equal diagonals do, which is why a joiner measures corner to corner rather than trusting the edges.
In short
Which measurements can determine a rectangle?
Enter 2 sides, or enter 1 side with the area, perimeter or diagonal. The calculator returns both sides, area, perimeter and diagonal, then flags a square when the sides match. It names an impossible perimeter or diagonal case instead of returning NaN.
Area by itself does not determine the side lengths.
How to use the rectangle calculator
Choose the pair that fixes both sides
Two adjacent sides determine a rectangle directly. When only one side is known, one additional area, perimeter or diagonal measurement can determine the missing side. The calculator first solves that side and then returns area, perimeter and diagonal from the completed dimensions.
- 1
Two sides
Enter the width and height when both edge lengths are available.
- 2
Side and area
Divide the area by the known side to obtain the other side.
- 3
Side and perimeter
Subtract the known side from half the perimeter.
- 4
Side and diagonal
Use the right-angle relationship to recover the other side.
Area alone cannot reveal a rectangle’s dimensions. An area of 24 square units could come from sides 1 and 24, 2 and 12, 3 and 8, or infinitely many other positive pairs. Adding one side removes that ambiguity because the other must equal area divided by that side.
- Known side
- w = 5
- Known diagonal
- d = 13
- Square the values
- h² = 13² − 5²
- Subtract
- h² = 169 − 25 = 144
- Missing side
- h = √144 = 12
- Rectangle
- 5 × 12, area 60, perimeter 34
The calculated diagonal checks because √(5² + 12²) = √169 = 13.
The perimeter route has a strict limit. Half the perimeter must contain one copy of each side, so the known width must be less than half the perimeter. If it is at least half, no positive length remains for the other side and the calculator names that impossibility.
A rectangle’s diagonal is useful for checking a frame. After measuring two adjacent edges, calculate the diagonal they require. A corner-to-corner measurement that disagrees with that value shows that the measured corner and edges do not form the expected right triangle.
wh
Area
Product of the two sides
2(w + h)
Perimeter
Total boundary length
√(w² + h²)
Diagonal
Corner-to-corner length
The square flag is based on the solved dimensions, not on the input mode. A rectangle found from side 7 and perimeter 28 has a second side of 28/2 − 7 = 7, so its equal sides make it a square.
Do
- Use the full perimeter rather than a semiperimeter.
- Compare a measured diagonal with the calculated corner-to-corner length.
- Write the area in square units after multiplying the sides.
Don't
- Expect area alone to identify a unique rectangle.
- Use a diagonal shorter than the known side.
- Accept a known side that consumes at least half the perimeter.
Measurements may be entered in any consistent length unit. The diagonal and perimeter retain that unit, while the area uses its square. Converting units before calculation avoids mixing quantities such as centimetres for one side and metres for the other.
Compare another four-sided figure
Use the trapezoid calculator when only one pair of opposite sides must remain parallel.
Open trapezoid calculator →Worked rectangle cases for every supported input pairing and named failure
| Known measurements | Working for the missing side | Calculated outcome |
|---|---|---|
| Sides w = 8, h = 5 | A = 8 × 5; P = 2(8 + 5); d = √(8² + 5²) | A = 40; P = 26; d = √89 |
| Side w = 6, area A = 42 | h = 42 ÷ 6 = 7 | A = 42; P = 2(6 + 7) = 26; d = √85 |
| Side w = 9, perimeter P = 30 | h = 30 ÷ 2 − 9 = 6 | A = 54; P = 30; d = √117 = 3√13 |
| Side w = 5, diagonal d = 13 | h = √(13² − 5²) = √144 = 12 | A = 60; P = 34; d = 13 |
| Side w = 4, area A = 4 | h = 4 ÷ 4 = 1 | A = 4; P = 10; d = √17 |
| Side w = 7, perimeter P = 28 | h = 28 ÷ 2 − 7 = 7 | A = 49; d = 7√2; square = true |
| Side w = 10, perimeter P = 20 | P/2 = 10 and w = 10, so h = 0 | Impossible: width is at least half the perimeter |
| Side w = 9, diagonal d = 8 | d² − w² = 8² − 9² = 64 − 81 = −17 | Impossible: diagonal is shorter than the side |
Why area alone leaves infinitely many answers
For every positive width w, the height 24/w produces area 24. Choosing w = 1 gives height 24, while w = 6 gives height 4. Because positive widths are not limited to whole numbers, the possible rectangles form an infinite family.
One known side changes the problem completely. If the area is A and the known side is w, the other side must be h = A/w. The pair is then fixed, so perimeter and diagonal can also be calculated.
Using the diagonal as a frame check
A rectangle with adjacent sides w and h requires a diagonal of √(w² + h²). For sides 5 and 12, that length is 13. A different corner-to-corner measurement indicates that the measured geometry does not match those perpendicular side lengths.
The formula, worked line by line
Let w and h be adjacent side lengths, A the area, P the perimeter and d the diagonal. Once both sides are known, every returned rectangle measurement follows directly.
When one side is missing, the appropriate inverse formula depends on whether the second input is area, perimeter or diagonal. Each supported pair determines one positive missing side when its measurements are geometrically compatible.
A = wh
P = 2(w + h)
d = √(w² + h²)
h = A/w
h = P/2 − w
h = √(d² − w²)
square = true when w = hThe perimeter formula contains two copies of each side. This is why the known side is subtracted from half the perimeter rather than from the entire perimeter.
The diagonal forms the hypotenuse of a right triangle whose legs are the rectangle’s sides. A diagonal shorter than a supplied side makes that geometry impossible.
Questions people ask
Sources
Where the constants and formulas on this page come from. Each line names the figure it backs.
Supports the standard area, perimeter and diagonal relationships for a rectangle.
Rectangle — Wolfram MathWorld
Supports the treatment of side, diagonal and perimeter measurements as lengths.
SI Units – Length — National Institute of Standards and Technology
Supports expressing rectangular area in squared units derived from the chosen length unit.
Guide for the Use of the International System of Units (SI), NIST SP 811 — National Institute of Standards and Technology
Related guides
How to Find the Volume of Hollow, Partial, and Composite Solids
A decomposition-first guide to pipes, frustums, domes, and partly filled tanks, with formulas and checks for avoiding geometric and unit errors.
August 12, 2026 · 12 min read
How to Compare Two Data Sets: Center, Spread, and Relative Difference
A practical workflow for deciding whether two sets are comparable, describing their typical values and variation, and reporting differences without overstating them.
August 11, 2026 · 10 min read
Putting JSON in a URL: Validate, Minify, Percent-Encode, or Base64url?
A decision guide for flattening, encoding, checking, and safely transporting JSON in a query string.
August 11, 2026 · 9 min read