Skip to main content
MathFree · no sign-up

Rectangle Calculator

Area, perimeter and diagonal — or a missing side from any one of them.

Updated

What do you know?

m

m

Area, perimeter and diagonal

12

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. 1

    Two sides

    Enter the width and height when both edge lengths are available.

  2. 2

    Side and area

    Divide the area by the known side to obtain the other side.

  3. 3

    Side and perimeter

    Subtract the known side from half the perimeter.

  4. 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.

Finding a side from the diagonal
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 measurementsWorking for the missing sideCalculated outcome
Sides w = 8, h = 5A = 8 × 5; P = 2(8 + 5); d = √(8² + 5²)A = 40; P = 26; d = √89
Side w = 6, area A = 42h = 42 ÷ 6 = 7A = 42; P = 2(6 + 7) = 26; d = √85
Side w = 9, perimeter P = 30h = 30 ÷ 2 − 9 = 6A = 54; P = 30; d = √117 = 3√13
Side w = 5, diagonal d = 13h = √(13² − 5²) = √144 = 12A = 60; P = 34; d = 13
Side w = 4, area A = 4h = 4 ÷ 4 = 1A = 4; P = 10; d = √17
Side w = 7, perimeter P = 28h = 28 ÷ 2 − 7 = 7A = 49; d = 7√2; square = true
Side w = 10, perimeter P = 20P/2 = 10 and w = 10, so h = 0Impossible: width is at least half the perimeter
Side w = 9, diagonal d = 8d² − w² = 8² − 9² = 64 − 81 = −17Impossible: diagonal is shorter than the side
Exact radicals are retained; all sides must be positive and all length measurements must use one unit.

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 = h
Area alone does not fix the sidesThree rectangles all of area 24: 2 by 12, 4 by 6, and 8 by 3. Their perimeters are 28, 20 and 22.SAME AREA, DIFFERENT RECTANGLES2 × 12area 24perimeter 284 × 6area 24perimeter 208 × 3area 24perimeter 22
Three rectangles of identical area drawn to scale — 2 by 12, 4 by 6 and 8 by 3 — with perimeters of 28, 20 and 22 to show that area alone fixes neither side.

The 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.

  1. Supports the standard area, perimeter and diagonal relationships for a rectangle.

    RectangleWolfram MathWorld

  2. Supports the treatment of side, diagonal and perimeter measurements as lengths.

    SI Units – LengthNational Institute of Standards and Technology

  3. 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 811National Institute of Standards and Technology