Rectangle Area and Perimeter Calculator

Enter any two of a rectangle's defining quantities and this calculator returns the rest: area, perimeter, diagonal, aspect ratio and the missing side. It handles the straightforward pairing of length and width, the everyday case where you know the area and one side, and the quadratic case where only the area and perimeter are known — which has two solutions, one solution, or none at all. Work in any unit you like; lengths come back in the unit you typed and areas in its square.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
What you knowPick the pair you actually have; the other fields are ignored.Length and width
Length (or the known side)The side you measured. Used in every mode except area and perimeter.12
WidthThe second side, in the same unit as the length.8
AreaIn square units of the same unit you use for the sides.96
PerimeterThe distance all the way round: 2 × (length + width).40

It returns

  • Area — Square units of whatever linear unit you entered.
  • Perimeter
  • Diagonal — Corner to corner — the number to check when you are squaring a layout.
  • Length
  • Width
  • Aspect ratio (long : short) — Longer side divided by shorter side; 1.0000 is a square.

The formula

A=LW,P=2(L+W),d=L2+W2
L,W=P2±(P2)24A2

In plain text: A = L·W; P = 2(L + W); d = √(L² + W²); from A and P: x² − (P/2)x + A = 0

  • AArea (units²)
  • PPerimeter (units)
  • LLength — the longer side by convention (units)
  • WWidth — the shorter side (units)
  • dDiagonal, corner to corner (units)

Because L and W both sum to P/2 and multiply to A, they are the two roots of x² − (P/2)x + A = 0. Real roots exist only when (P/4)² ≥ A.

Updated Category Plane Shapes: Area & Perimeter Verified against published test cases Reading time 9 min

Four quantities, two degrees of freedom

A rectangle is fixed by two numbers. Give it a length and a width and everything else follows: the area is their product, the perimeter is twice their sum, the diagonal comes from Pythagoras, and the aspect ratio is the larger divided by the smaller. What makes the shape worth a calculator is that the two numbers you are handed are often not the length and the width.

A landscaper knows the area of turf ordered and the width of the roll. A framer knows the perimeter of trim already bought and one wall length. A student is given the area and perimeter and asked for the sides. Each of those is a different algebraic problem, and the last one is a genuine quadratic that can have two answers, one answer, or none.

The diagonal deserves more attention than it usually gets, because it is the practical test for whether a rectangle is actually rectangular. Measuring both diagonals of a deck frame or a door opening and finding them equal is the only field check that proves all four corners are 90°. The Pythagorean theorem calculator covers that relationship on its own, and the distance formula calculator does the same job from coordinates.

Why area and perimeter give a quadratic

The first three formulas are direct. A = L·W counts unit squares along a row and multiplies by the number of rows. P = 2(L + W) walks the boundary once. d = √(L² + W²) is Pythagoras applied to the right triangle formed by two adjacent sides and the diagonal.

The interesting case is being given A and P. Notice that L + W = P/2 and L·W = A. Two numbers whose sum and product you know are exactly the roots of a quadratic: any monic quadratic can be written as x² − (sum)x + (product). So L and W are the roots of x² − (P/2)x + A = 0, giving L, W = [P/2 ± √((P/2)² − 4A)] / 2.

The discriminant (P/2)² − 4A carries real information. It is positive when two distinct rectangles fit, zero when the only fit is the square, and negative when nothing fits. Setting it to zero gives A = (P/4)², which says that for a fixed perimeter the square has the largest possible area. Ask for more area than that and no rectangle can deliver it — the calculator reports the ceiling rather than returning a complex number. This is the discrete case of the isoperimetric problem, whose continuous answer is the circle.

Aspect ratio is simply the larger side over the smaller. It is scale-free, so a 3:2 photograph is 3:2 whether it is 6 inches wide or 6 feet, which is why print and display sizes are quoted that way.

Worked example: area 96 and perimeter 40

A room is quoted as 96 square feet of floor with 40 linear feet of skirting board. What are its dimensions?

  1. Half the perimeter. P/2 = 40/2 = 20. This is L + W.
  2. Write the quadratic. x² − 20x + 96 = 0.
  3. Discriminant. 20² − 4 × 96 = 400 − 384 = 16. Positive, so two real sides exist.
  4. Roots. x = (20 ± √16)/2 = (20 ± 4)/2, so x = 12 and x = 8.
  5. Check. 12 × 8 = 96 ✓  2(12 + 8) = 40 ✓
  6. Diagonal. d = √(12² + 8²) = √(144 + 64) = √208 = 14.4222 ft.
  7. Aspect ratio. 12/8 = 1.5000, that is 3:2.

Now test the ceiling. With P = 40 the largest area any rectangle can have is (40/4)² = 100 square feet, reached by the 10 × 10 square. The room asked for 96, comfortably under, which is why two solutions exist. Had the brief said 96 feet of skirting and 96 square feet of floor, the discriminant would be 24² − 384 = 192, giving sides of (24 ± 13.8564)/2 = 18.9282 and 5.0718 — still valid, but a much narrower room.

What the numbers tell you once you have them

Read the aspect ratio first when the rectangle is going to hold something. Standard photographic prints sit near 1.5 (3:2) and 1.25 (5:4); most televisions and monitors are 1.7778 (16:9); a sheet in the ISO A series is √2 ≈ 1.4142, the unique ratio that stays the same when you fold the sheet in half. If your computed ratio is far from the ratio of what goes into the space, you will be trimming or leaving margin.

Read the diagonal when the rectangle has to be built or has to fit through something. Two equal diagonals prove square corners; a difference of a quarter inch across a 10-foot frame means the corner angles are off by roughly 0.1°, which is enough to bind a door. The diagonal is also the number that decides whether a sheet of plywood turns a stairwell.

Read the area-to-perimeter ratio when material cost splits between surface and edge. A 10 × 10 room and a 20 × 5 room both cover 100 square feet, but the second needs 50 feet of skirting against the first's 40 — 25% more edge for the same floor. Long thin rooms cost more in trim, more in wall framing and more in heat loss per square foot of floor, and the table below shows exactly how fast that penalty grows.

Rectangles that all have a perimeter of 40

Holding the perimeter at 40 units, area peaks at the square and falls away symmetrically. Diagonals are √(L² + W²).
WidthLengthAreaDiagonalAspect ratio
1191919.026319.00
2183618.11089.00
4166416.49244.00
5157515.81143.00
8129614.42221.50
9119914.21271.22
101010014.14211.00

The square is the maximum-area case, A = (P/4)² = 100. Note how flat the peak is: moving from 10×10 to 8×12 costs only 4% of the area.

Errors that show up in real measurements

  • Adding length and width and calling it the perimeter. P = 2(L + W). Half the perimeter is the quantity that equals L + W, and forgetting the factor of two doubles or halves every downstream result.
  • Entering a length that exceeds half the perimeter. In perimeter-and-one-side mode this leaves a negative width, which is not a rectangle; the calculator flags it rather than returning a nonsense area.
  • Asking for more area than the perimeter allows. The ceiling is (P/4)². Above it there is no real solution, and a quadratic solver that ignores the sign of the discriminant will silently produce garbage.
  • Assuming a measured shape is rectangular. Four sides that pair up equal can still be a parallelogram. Only equal diagonals prove square corners.
  • Mixing feet and inches in one entry. Convert first. An aspect ratio above 20:1 usually means exactly this mistake, and the calculator warns when it sees one.
  • Using nominal instead of actual dimensions. A sheet sold as 4 × 8 or a stud sold as 2 × 4 rarely measures that; take the real numbers off the material.

Where the rectangle sits among the other quadrilaterals

A rectangle is the special parallelogram whose angles are all right angles. Skew the corners and the area becomes base × perpendicular height rather than the product of the sides, which the parallelogram area calculator handles. Make only one pair of sides parallel and you have a trapezoid, covered by the trapezoid area calculator. Make all four sides equal and it is a square, the point at which this calculator's diagonal formula reduces to s√2.

For an irregular four-sided plot, none of these apply. Take the corner coordinates and use the shoelace formula area calculator, which handles any simple polygon and is the method surveyors use. If your rectangle is a cross-section rather than a plan — a duct, a beam, a box — you will want volume and surface area instead; the rectangular prism calculator extends the same two dimensions into three.

One last practical note on the isoperimetric result. The square maximises area for a fixed perimeter among rectangles, but the peak is remarkably flat: a rectangle 20% off square keeps more than 99% of the square's area. That is why real rooms, fields and enclosures deviate freely from square without much penalty in area, while the penalty in edge length runs the other way and grows quickly, as the reference table shows.

Frequently asked questions

How do I find the length of a rectangle if I know the area and the width?

Divide: length = area ÷ width. A 96 square foot room that is 8 feet wide is 12 feet long. Select Area and one side and enter both. The only thing to watch is units — if the area is in square feet, the side must be in feet, not inches, or the answer is out by a factor of 12.

Can two different rectangles have the same area and perimeter?

No. Area and perimeter together determine the pair of sides uniquely, because they fix the sum and the product of L and W. The quadratic has two roots, but those two roots are the length and the width of one rectangle rather than two different rectangles. Two rectangles can share an area, or share a perimeter, but not both.

Why does my area and perimeter give no answer?

Because you asked for more area than that perimeter can enclose. The maximum is (P/4)², achieved by the square. A perimeter of 20 caps the area at 25 square units, so 100 is impossible. The calculator reports the ceiling and the square that reaches it so you can see how far off the figures are.

How do I calculate the diagonal of a rectangle?

Use d = √(L² + W²). For a 12 by 8 rectangle that is √(144 + 64) = √208 = 14.4222. For a square it simplifies to s√2 ≈ 1.4142s. The diagonal is the longest straight line that fits inside the rectangle, which is why it decides whether a panel will pass through an opening.

What aspect ratio is a standard sheet of paper?

ISO A-series paper is √2 ≈ 1.4142 : 1, the only ratio preserved when a sheet is halved across its long side. US Letter is 11/8.5 = 1.2941. Photographic prints are commonly 3:2 = 1.5 and 5:4 = 1.25, and widescreen displays are 16:9 = 1.7778.

Does a bigger area always mean a bigger perimeter?

No, and this trips people up. A 1 × 19 rectangle and a 10 × 10 square share a perimeter of 40, yet the square encloses 100 square units against 19. Among shapes with equal perimeter, area rises as the shape becomes more compact. To compare fairly you have to hold one of the two quantities fixed.

How do I check that a frame I built is actually square?

Measure both diagonals. If they are equal, the corners are 90°; if they differ, the frame is a parallelogram. Compare the measurement against the diagonal figure here for your intended sides. Pushing the longer diagonal's corners together until the two readings match is the standard way to rack a frame back into square.

What units should I enter?

Any single unit, used consistently. The tool does no conversion, so metres in gives metres and square metres out; inches in gives inches and square inches out. Convert feet-and-inches measurements to decimal in one unit before entering them — 7 ft 6 in becomes 7.5 ft or 90 in.

References

  • CRC Standard Mathematical Tables and Formulae, 33rd ed. — CRC Press
  • ISO 216: Writing paper and certain classes of printed matter — Trimmed sizes — International Organization for Standardization
  • Euclid's Elements, Book II (rectangles, squares and the geometric solution of quadratics) — Public domain