Length Of A Rectangle Calculator - Width, Area, Perimeter, or Diagonal
Use this length of a rectangle calculator to find the long side from any two of the width, area, perimeter, and diagonal of a rectangle, with all six input pairs handled in matching units.
Length Of A Rectangle Calculator
Results
What Is Length Of A Rectangle Calculator?
A length of a rectangle calculator finds the long side of any rectangle from any two of the width, area, perimeter, or diagonal. It uses A = l * w, P = 2(l + w), and d^2 = l^2 + w^2, so the same form handles all six input pairs without forcing the user to remember which two values go together.
- • Screen or paper sizing: Confirm the length of a rectangle from the short side and the area when sizing a 16:9 monitor, TV, or letter-size paper.
- • Floor plan checks: Recover the length of a rectangle from the area and perimeter, so the floor plan matches the room measurements.
- • Diagonal measuring without a tape: Use the corner-to-corner diagonal of a TV, frame, or mirror with one side, the area, or the perimeter to find the length via the Pythagorean theorem.
A rectangle has two pairs of parallel sides, four right angles, and two equal diagonals. The length is conventionally the longer side, although a vertical rectangle calls its vertical side the length. The three rules above still apply either way.
When only the area and the perimeter are known, the Length Width Area Rectangle Calculator recovers both rectangle sides from the same system of equations.
How Length Of A Rectangle Calculator Works
The calculator applies the rectangle rules that tie length, width, area, perimeter, and diagonal together. The right rule is picked by the selected solve mode, and the missing side plus the recovered width, diagonal, perimeter, and area are all returned for cross-checking.
- l, w: length and width of the rectangle, in the chosen linear unit
- A: area, equal to h * w in square units
- P: perimeter, equal to 2 * (h + w) in linear units
- d: diagonal, equal to sqrt(h^2 + w^2) in linear units
- l (in any mode): unknown side recovered from the two given values by the rule above
The width-based modes use h = A / w, h = P / 2 - w, and h = sqrt(d^2 - w^2). The non-width modes solve two-equation systems: A + P combines the area and perimeter formulas, A + D combines the area with the Pythagorean identity, and P + D combines the perimeter with the Pythagorean identity, each returning both rectangle sides from the two known values.
Example with width 4 and area 20 in Width + Area mode
Enter solveMode = Width + Area, width = 4, area = 20.
h = A / w = 20 / 4 = 5.00. P = 2 * (5 + 4) = 18.00. d = sqrt(5^2 + 4^2) = sqrt(41) = 6.40.
Length = 5.00 linear units. Width = 4.00 linear units. Perimeter = 18.00 linear units. Diagonal = 6.40 linear units. Area = 20.00 square units.
That fits a 5 x 4 inch photograph, a 5 x 4 foot whiteboard, or any rectangle that occupies 20 square units with a 4-unit short side. The same shape also solves from Area + Diagonal or Perimeter + Diagonal using the same area, perimeter, and diagonal.
According to Wolfram MathWorld, the area of a rectangle with sides a and b is A = a * b, the perimeter is P = 2 * (a + b), and the diagonal satisfies d^2 = a^2 + b^2.
For the diagonal and width path, the same Pythagorean relation is the rule that powers the Right Triangle Calculator, since the rectangle's diagonal is the hypotenuse of a right triangle with the two rectangle sides as legs.
Key Concepts Explained
These concepts decide which formula matches the two values the user measures.
Length Versus Width
Two perpendicular sides are conventionally called the length and the width. The length is usually the longer side, but a vertical rectangle calls its vertical side the length. The h = A / w rule works either way.
Area, Perimeter, and Diagonal
Area equals length times width, perimeter equals twice the sum of the two sides, and diagonal equals the square root of the sum of the squares of the two sides. Any two of {width, area, perimeter, diagonal} recover the missing side.
Pythagorean Theorem for the Diagonal
The diagonal is the hypotenuse of a right triangle with the two rectangle sides as legs. The Pythagorean theorem d^2 = l^2 + w^2 then gives d once l and w are known, or l once d and one other value is known.
Solving Two-Value Systems
Area + Perimeter combines l * w = A and 2(l + w) = P into a quadratic. Area + Diagonal sums and subtracts the two sides from sqrt(d^2 ± 2A). Perimeter + Diagonal uses (P / 2) and sqrt(2d^2 - P^2 / 4) the same way. Each returns both rectangle sides once its discriminant is non-negative.
A common slip is to treat the diagonal as the sum of the two sides, or to use the diagonal in place of the perimeter. The diagonal is shorter than the perimeter but longer than either side, so a perimeter formula will overstate the outer edge.
For a deeper look at how the area of common plane shapes is computed, the Area Calculator covers the area rule for rectangles, triangles, circles, and trapezoids in one place.
How to Use This Calculator
Pick the two rectangle values you already know, type them into the form, and read the long side plus the cross-checked diagonal, perimeter, and area.
- 1 Pick the linear unit first: Decide whether the width, perimeter, and diagonal go in inches, feet, centimeters, or meters. The area then goes in square units of the same linear unit.
- 2 Choose the solve mode: Width + Area, Width + Perimeter, or Width + Diagonal when the short side is known, or Area + Perimeter, Area + Diagonal, or Perimeter + Diagonal when it is not.
- 3 Enter the two known values: Type the width plus one of {area, perimeter, diagonal} for the width-based modes, or any two of {area, perimeter, diagonal} for the non-width modes.
- 4 Read the long side: The Length row in the result panel is the missing rectangle side, in the linear unit the user typed.
- 5 Cross-check the other rows: Confirm the width matches, the perimeter and area match, and the diagonal squares to the sum of the squares of the two sides.
A 5 x 4 inch photograph has area 20 square inches, perimeter 18 inches, and diagonal sqrt(41) = 6.40 inches. The same shape solves from Width + Diagonal with width 3 and diagonal 5, returning length 4 in the 3-4-5 right triangle.
When the calculator returns a length equal to the width, the rectangle is actually a square, and the Square Area Calculator handles the equal-side special case in its own form.
Benefits of Using This Calculator
A calculator that accepts any two known values is more useful than a single-formula tool, because real rectangles rarely come with all three numeric values pre-printed.
- Six solve modes in one form: Width + Area, Width + Perimeter, Width + Diagonal, Area + Perimeter, Area + Diagonal, and Perimeter + Diagonal all share the same form, so the user does not pick a separate calculator for each input pair.
- Pythagorean paths built in: Width + Diagonal uses the Pythagorean theorem directly, while Area + Diagonal and Perimeter + Diagonal combine the Pythagorean identity with the area or perimeter formula to recover both sides without the width.
- All five rectangle values returned: Length, width, diagonal, perimeter, and area show up together, so the same inputs can be cross-checked against a spec sheet or a floor plan.
The three non-width modes are the most fragile, because some pairs of area, perimeter, and diagonal cannot come from a real rectangle. The calculator checks the discriminant on each path and returns a clear error when the values are inconsistent.
For quick integer right triangles that fit the Width + Diagonal mode, the Pythagorean Triples Calculator lists common triples like 3-4-5, 5-12-13, and 8-15-17 in one table.
Factors That Affect Your Results
A rectangle calculator is built on textbook rules, but a few choices decide whether the returned length matches the real rectangle.
Unit consistency
Every linear input must use the same unit. The area goes in square units of that linear unit, and the result is in the same linear unit. Mixing inches and feet, or feet and meters, will produce an answer that is off by a power of 12 or by a factor of about 3.281.
Diagonal must clear the two-value threshold
Width + Diagonal needs d at least equal to w, Area + Diagonal needs d at least sqrt(2A), and Perimeter + Diagonal needs d at least P / (2 * sqrt(2)). A diagonal below the right threshold for the selected mode is geometrically impossible, and the calculator rejects it.
Area and perimeter must be a real rectangle pair
The Area + Perimeter system requires the discriminant P^2 - 16 * A to be non-negative. Below that threshold, no real positive rectangle sides exist, and the calculator rejects the pair with a clear error.
- • The calculator only handles 2D rectangles, not 3D. For a diagonal in three dimensions, the Pythagorean-based modes no longer apply.
- • Real rectangles are rarely perfect right-angled shapes: photographs have rounded corners, walls are out of square, and glass panels taper. The geometric length is an estimate, not a survey-grade measurement.
- • Rounded display output can differ by a few hundredths from a hand calculation that rounds each step. The internal computation keeps full precision before the display rounds.
Width + Diagonal returns length = 0 when the diagonal equals the width, the degenerate case where the rectangle collapses to a line. The calculator still reports width, perimeter, and area for that case so the user sees the geometry has flatlined.
According to Wikipedia, the Pythagorean theorem states that for a right triangle with legs a and b and hypotenuse c, c^2 = a^2 + b^2.
According to Wikipedia, a rectangle is a quadrilateral with four right angles, so its diagonal is the hypotenuse of a right triangle with the two rectangle sides as legs, and the diagonal length is d = sqrt(l^2 + w^2).
When the user wants the third side of a general triangle rather than a rectangle, the Triangle Length Calculator applies the law of cosines on three known sides or angles.
Frequently Asked Questions
Q: What is the formula for the length of a rectangle?
A: The length of a rectangle is h = A / w when the area A and the width w are known, h = P / 2 - w when the perimeter P and the width w are known, and h = sqrt(d^2 - w^2) when the diagonal d and the width w are known. When only the area and the perimeter are known, the two sides are the two positive roots of t^2 - (P / 2) * t + A = 0. When only the area and the diagonal are known, l = (sqrt(d^2 + 2A) + sqrt(d^2 - 2A)) / 2, and when only the perimeter and the diagonal are known, l = (P / 2 + sqrt(2d^2 - P^2 / 4)) / 2.
Q: How do you find the length of a rectangle from area and width?
A: Divide the area by the width. The same h = A / w rule works for any rectangle, including a square where the length equals the width. The result is in the same linear unit the width was entered in, while the area is in the matching square unit.
Q: How do you find the length of a rectangle from perimeter and width?
A: Subtract the width from half of the perimeter, h = P / 2 - w. The rule comes from rearranging P = 2(l + w) for l. The length must be positive, so the perimeter has to be greater than twice the width or the inputs are inconsistent.
Q: How do you find the length of a rectangle from diagonal and width?
A: Take the square root of the difference of the squares, h = sqrt(d^2 - w^2). This is the Pythagorean theorem applied to the right triangle formed by the length, the width, and the diagonal, with the diagonal as the hypotenuse.
Q: Can you find the length of a rectangle from area, perimeter, and diagonal alone?
A: Yes. Area + Perimeter solves 2 * l^2 - P * l + 2 * A = 0 for both rectangle sides. Area + Diagonal uses l = (sqrt(d^2 + 2A) + sqrt(d^2 - 2A)) / 2, and Perimeter + Diagonal uses l = (P / 2 + sqrt(2d^2 - P^2 / 4)) / 2, with w recovered from the second half of each formula. Each mode requires a non-negative discriminant; otherwise the two values cannot come from a real rectangle.
Q: What units should I use for the length of a rectangle?
A: Use one linear unit for the width, the perimeter, and the diagonal, such as inches, feet, centimeters, or meters. The area then goes in square units of that linear unit, and the result is in matching units. Mixing units will give an answer that is off by a power of 12 or by a factor of about 3.281.