Length and Width of a Rectangle given Perimeter Calculator

Enter a rectangle's perimeter and area to solve for its length and width using x² − (P/2)x + A = 0, plus the diagonal and aspect ratio.

Quick Facts

Perimeter formula
P = 2(L + W)
So the semi-perimeter s = P/2 = L + W.
Area formula
A = L × W
Length and width are the two roots of x² − sx + A = 0.
Solving for L and W
x = [s ± √(s² − 4A)] / 2
The larger root is the length, the smaller root is the width.

Your Results

Calculated
Length
-
Larger root of x² − sx + A = 0
Width
-
Smaller root of x² − sx + A = 0
Diagonal
-
d = √(L² + W²)
Aspect Ratio (L:W)
-
Length ÷ width

Ready

Enter a perimeter and area, then press Calculate.

Formula and Method for Finding Length and Width from Perimeter

A rectangle's perimeter alone does not pin down a unique length and width: P = 2(L + W) only fixes the sum L + W = P/2, and infinitely many length/width pairs share that same sum (a 1×9 rectangle and a 4×6 rectangle can both have a perimeter of 20). To recover an exact length and width you need one more piece of information. The most common and practical choice is the area, A = L × W, because it is usually known or easy to measure alongside the perimeter. This calculator takes perimeter and area together and solves for length and width.

How the calculation works

From P = 2(L + W) and A = L × W, let s = P/2 be the semi-perimeter, so L + W = s and L × W = A. Length and width are then the two roots of the quadratic equation x² − sx + A = 0. Applying the quadratic formula gives x = [s ± √(s² − 4A)] / 2. By convention, the larger root is called the length and the smaller root the width; if the two roots are equal, the rectangle is a square. The calculator also reports the diagonal, d = √(L² + W²), from the Pythagorean theorem, and the aspect ratio L ÷ W.

Common mistakes

  • Assuming perimeter alone is enough: it is not — you always need a second fact (area, diagonal, a known side, or a length-to-width ratio) to get a unique answer.
  • Area too large for the perimeter: for a fixed perimeter, area is maximized by a square, so the largest possible area is (P/4)². If your area input exceeds that, the discriminant s² − 4A goes negative and no real rectangle exists.
  • Mismatched units: enter the perimeter as a linear measurement and the area as that same unit squared (e.g., perimeter in feet, area in square feet) — mixing units before entering values produces a meaningless result.

Real-world applications

  • Land surveying and real estate use a known perimeter (fence length) and a quoted lot area to back out the plot's length and width.
  • Room and floor planning uses perimeter (baseboard or trim length) together with floor area (flooring quantity) to recover the room's dimensions.
  • Garden and framing layouts check whether a proposed length and width both satisfy a fencing budget (perimeter) and a planting area target.
  • Manufacturing and packaging use the same method to find panel or sheet dimensions from a target perimeter (trim/edge material) and surface area.

Frequently Asked Questions

How do you find the length and width of a rectangle from its perimeter?
Perimeter alone is not enough — infinitely many rectangles share the same perimeter, since only the sum L + W = P/2 is fixed. You need one more piece of information, most commonly the area. With perimeter P and area A, length and width are the two roots of x² − (P/2)x + A = 0, solved with the quadratic formula: x = [P/2 ± √((P/2)² − 4A)] / 2.
What does it mean if there is no valid rectangle for my perimeter and area?
It means the discriminant (P/2)² − 4A is negative, so no real-numbered rectangle has that exact perimeter and area combination. For a fixed perimeter P, the largest possible area is a square with area (P/4)²; if your area input exceeds that, lower the area or raise the perimeter.
How is the diagonal found once length and width are known?
Use the Pythagorean theorem: d = √(L² + W²), since the diagonal is the hypotenuse of the right triangle formed by one length side and one width side.
Which root is the length and which is the width?
By convention the larger root of x² − (P/2)x + A = 0 is taken as the length and the smaller root as the width. If the two roots are equal, the rectangle is actually a square.