Dimensions Of A Rectangle Calculator - P And A Length Solver

Dimensions of a rectangle calculator - enter perimeter and area to recover length, width, diagonal, aspect ratio, and the is-square check using the quadratic.

Updated: June 18, 2026 • Free Tool

Dimensions Of A Rectangle Calculator

Total edge length of the rectangle (2 * (length + width)). Must be positive.

Area enclosed by the rectangle (length * width). Must be positive and no larger than P^2/16.

Results

Length (a)
0units
Width (b) 0units
Area (A) 0units²
Perimeter (P) 0units
Diagonal (d) 0units
Aspect ratio (a / b) 0
Is the rectangle a square? 0

What Is a Dimensions of a Rectangle Calculator?

A dimensions of a rectangle calculator takes the two summary values you already know about a rectangle - the perimeter P and the area A - and uses the standard rectangle identities plus the quadratic formula to recover the length and width at once. Type the perimeter and the area in the matching unit, and the page returns the length, width, diagonal, aspect ratio, and an is-square flag so you can use the recovered sides immediately.

  • Textbook and homework problems: Solve the classic 'given P and A, find the sides' problem on a quadratic worksheet or in a chapter on simultaneous rectangle identities.
  • Flooring and room sizing: Estimate a missing wall length when only the room floor area and the perimeter of skirting boards are known, before ordering flooring or trim.
  • Fencing and frame estimators: Back-solve the long side of a fence run, picture frame, or raised bed when only the perimeter of the boundary and the enclosed area are known.
  • Cut lists and panel planning: Recover the long side of a plywood panel or rectangular blank when only the panel area and the perimeter of the cut are known.

The result uses the convention length >= width, so the larger root of the quadratic is reported as the length and the smaller root as the width. When the discriminant is exactly zero, both roots coincide and the rectangle collapses to a square.

For a form that also accepts an aspect ratio in place of the area, the Length Width Area Rectangle Calculator is the next click.

How the Dimensions of a Rectangle Calculator Works

The calculator inserts the two identities A = a*b and P = 2(a+b) into one another, which leaves a quadratic in a alone, and then solves it with the standard quadratic formula. The discriminant (P/2)^2 - 4*A is shown in the formula box because it tells you whether the (P, A) pair can describe a real rectangle at all.

a^2 - (P/2)*a + A = 0 => a = (P/2 + sqrt((P/2)^2 - 4*A)) / 2, b = P/2 - a
  • P: Perimeter of the rectangle (2*(a+b)), in the chosen linear unit.
  • A: Area of the rectangle (a*b), in the matching square unit.
  • a, b: The two side lengths. The convention here is a = max root (length), b = min root (width), so a >= b.
  • D: Discriminant (P/2)^2 - 4*A; D >= 0 is required for a real rectangle and D = 0 means a = b (square).
  • d: Diagonal of the recovered rectangle, sqrt(a^2 + b^2), used as a sanity check.

The same arithmetic handles every case where P and A describe a real rectangle. When the discriminant is negative, the calculator reports the impossible-pair message so the user can re-check the inputs instead of seeing a NaN.

Worked example: 3-4-5 right triangle from P = 14 and A = 12

P = 14, A = 12.

D = (14/2)^2 - 4*12 = 49 - 48 = 1. Length = (7 + sqrt(1))/2 = 4, Width = 7 - 4 = 3. Diagonal = sqrt(4^2 + 3^2) = 5.

Length = 4, Width = 3, Diagonal = 5, Aspect ratio = 1.3333, Is square = No.

The discriminant is the small square difference between P^2/4 and 4*A. In this example it lands at exactly 1, which is why the recovered 3 and 4 happen to form the 3-4-5 Pythagorean triple; for most integer (P, A) pairs the recovered diagonal is irrational.

According to Wolfram MathWorld, the rectangle with sides a and b has area A = a*b, perimeter P = 2(a+b), and diagonal d = sqrt(a^2 + b^2)

According to Wolfram MathWorld, a quadratic equation ax^2+bx+c = 0 has the solution x = (-b +/- sqrt(b^2 - 4ac)) / (2a), and a non-negative discriminant is required for real roots

For the Pythagorean step that turns the recovered sides into the diagonal, the Diagonal Of Rectangle Calculator works once length and width are known.

Key Concepts Behind the Dimensions of a Rectangle

Four short ideas explain why the recovery step is exact, what the discriminant means, and how the recovered sides connect to the rest of rectangle geometry.

Rectangle identities

A rectangle with sides a and b has area a*b, perimeter 2(a+b), and diagonal sqrt(a^2 + b^2). These three identities are the only equations needed to recover a and b from any two known values.

Quadratic back-solve

Substituting b = P/2 - a into A = a*b yields a^2 - (P/2)*a + A = 0. Solving this quadratic with the standard formula gives both candidate sides at once.

Discriminant and feasibility

The discriminant D = (P/2)^2 - 4*A must be non-negative for any rectangle to exist. D = 0 means the rectangle is a square; D < 0 means the (P, A) pair is geometrically impossible.

Square collapse

When the two roots of the quadratic coincide, a = b = P/4, the diagonal collapses to P*sqrt(2)/4, and the is-square flag reads Yes.

These four ideas are the building blocks for the rest of the rectangle geometry chain. If you have the perimeter, the area, and the recovered sides, you can back-solve the perimeter of a fixed area, the area of a fixed perimeter, or the diagonal of a similar rectangle with the same identities.

When the area is fixed and the perimeter varies, the Perimeter Of A Rectangle With Given Area shows the reverse relationship - what perimeter results from a chosen aspect ratio.

How to Use This Dimensions of a Rectangle Calculator

Five short steps cover the textbook case, the impossible-pair edge, and the square collapse, from entering the perimeter and area to reading the recovered sides.

  1. 1 Decide which two values you know: This calculator needs the perimeter P and the area A. If you only have one side and a summary value, switch to a length-first calculator such as length-of-a-rectangle.
  2. 2 Enter the perimeter and area: Type the perimeter in the linear unit (m, ft, in, cm) and the area in the matching square unit (m^2, ft^2, in^2, cm^2). The defaults are P = 14 and A = 12, so the page opens in the 3-4-5 example state.
  3. 3 Read the recovered length and width: The primary results panel shows the length (a, the larger root) and the width (b, the smaller root). The calculator also echoes the area, perimeter, diagonal, aspect ratio, and is-square flag below the primary panel.
  4. 4 Check the discriminant when the pair looks odd: If the recovered sides do not match the textbook answer, the (P, A) pair is probably impossible. The formula box shows the discriminant D = (P/2)^2 - 4*A, and D < 0 means no rectangle can have those values.
  5. 5 Use the square flag for the symmetric case: When the is-square flag reads Yes, the two sides are equal to P/4 and the diagonal collapses to P*sqrt(2)/4.

A room has a measured floor area of 24 m^2 and a baseboard run of 20 m (the perimeter). Entering P = 20 and A = 24 returns length = 6, width = 4, diagonal = 7.2111, aspect ratio = 1.5, and is-square = No, which is enough to order flooring, baseboard, and tile spacers without re-measuring the room.

When you only have the perimeter and an aspect ratio (not the area), the Length And Width Of Rectangle Given Perimeter Calculator covers that adjacent back-solve without changing units.

Benefits of Using This Dimensions of a Rectangle Calculator

Six reasons to use this page rather than re-doing the quadratic by hand, especially when the inputs come from a tape measure, a floor plan, or a textbook problem.

  • Saves the quadratic algebra: Removes the substitution step, the discriminant check, and the root selection so you get both candidate sides in a single click.
  • Catches impossible pairs early: Stops and reports when (P, A) cannot describe a real rectangle, instead of returning NaN or an imaginary length.
  • Surfaces the discriminant: Shows D = (P/2)^2 - 4*A in the formula box so you can see at a glance how close the pair is to the square collapse.
  • Returns the full picture at once: Length, width, diagonal, aspect ratio, and is-square flag all show up together so the next step (flooring, fencing, cutting) has every rectangle value it needs.
  • Honors the length >= width convention: Always reports the larger root as the length and the smaller as the width, matching the convention used by length, diagonal, and surface-area peers.
  • Pairs naturally with adjacent peers: Lines up with length-of-a-rectangle, perimeter-from-area, and golden-rectangle pages so a multi-step rectangle workflow stays on math-conversion.

The page is most useful as a check, not as a replacement for understanding the formula. Use it to confirm a homework answer, sanity-check a measurement, or pre-validate a (P, A) pair before you hand it to a longer script.

For a 3D box that starts from the same pair of sides, the Surface Area Of A Rectangle Calculator extends the result with depth to give the panel and lid areas.

Factors That Affect the Recovered Dimensions

Five inputs and edge cases change which side the calculator reports, whether the result collapses to a square, or whether the (P, A) pair can describe a rectangle at all.

Discriminant sign

When D = (P/2)^2 - 4*A is negative, no real rectangle exists with those values. The calculator reports an impossible-pair message instead of a number.

Discriminant magnitude

D close to zero means a nearly-square rectangle (a and b almost equal). D large means a long thin rectangle with a very different aspect ratio from 1:1.

Square collapse at D = 0

When D is exactly zero, both quadratic roots coincide at P/4. The two sides are equal and the is-square flag reads Yes.

Pythagorean triple coincidence

The diagonal is a useful sanity check. It comes out to a clean integer only when the recovered sides form a Pythagorean triple (such as 3-4-5, 5-12-13, or 7-24-25); for most integer side pairs the diagonal is irrational.

Unit consistency

Perimeter must be in the linear unit (m, ft, in) and area in the matching square unit (m^2, ft^2, in^2). Mixing units produces nonsense sides.

  • This calculator assumes a rectangle, not a parallelogram. The recovered a and b are the rectangle's sides, not the parallelogram's.
  • Real measurements are noisy. A quoted P of 14.0 m and an A of 12.0 m^2 will recover a = 4 and b = 3 exactly, but a re-measure of 14.1 and 12.2 will drift the recovered sides by a few hundredths of a unit.

Treat the recovered sides as a back-solve, not a measurement. When the discriminant is non-integer, the two sides do not form a Pythagorean triple and the page rounds the diagonal to four decimal places.

According to Encyclopaedia Britannica, a rectangle is a quadrilateral with four right angles, and its opposite sides are equal so its perimeter is twice the sum of length and width

When the recovered aspect ratio lands near 1.618, the Golden Rectangle Calculator checks whether the rectangle is the golden ratio as well.

Dimensions of a rectangle calculator interface with perimeter and area inputs and length, width, area, perimeter, diagonal, aspect ratio, and is-square outputs
Dimensions of a rectangle calculator interface with perimeter and area inputs and length, width, area, perimeter, diagonal, aspect ratio, and is-square outputs

Frequently Asked Questions

Q: What is the dimensions of a rectangle formula?

A: The rectangle identities are A = a*b, P = 2(a+b), and d = sqrt(a^2 + b^2). When P and A are known, the substitution b = P/2 - a turns A = a*b into the quadratic a^2 - (P/2)*a + A = 0, which solves for a and b.

Q: How do you find the dimensions of a rectangle from area and perimeter?

A: Pick this calculator's P + A mode, enter the perimeter and the area, and read the length and width that come back. The calculator checks the discriminant D = (P/2)^2 - 4*A first, so an impossible pair shows up as a clear error instead of a NaN.

Q: When is the dimensions of a rectangle back-solve impossible?

A: The back-solve is impossible whenever D = (P/2)^2 - 4*A is negative, which is the same as P^2 < 16*A. That condition means the (P, A) pair cannot describe any real rectangle, so the calculator reports the impossible-pair message instead of returning a side length.

Q: What does the is-square flag mean?

A: The is-square flag reads Yes when the discriminant is exactly zero, which means both roots of the quadratic coincide at P/4. In that case the length and the width are equal, the diagonal collapses to P*sqrt(2)/4, and the rectangle is a square.

Q: Can you find the dimensions of a rectangle from area and one side?

A: Yes, but this page is the wrong tool for it. If you know the area and one side, the missing side is just A / side. The length-of-a-rectangle page covers that adjacent back-solve with the matching area + length, perimeter + length, and diagonal + length inputs.

Q: How accurate is this dimensions of a rectangle calculator?

A: The result is exact up to the displayed four-decimal precision. Any small difference between the calculator output and a hand calculation comes from rounding the displayed values, not from the underlying quadratic or the rectangle identities.