Rectangle Calculator
Calculate a rectangle's area, perimeter, and diagonal length. Enter length and width to get all three measurements instantly, with exact decimal precision.
How It's Calculated
Formula
\text{Area} = l \times w
\text{Perimeter} = 2(l + w)
\text{Diagonal} = \sqrt{l^2 + w^2}A rectangle is fully described by two measurements: length and width. From those two numbers, three other quantities follow directly. Area is the amount of two-dimensional space enclosed by the rectangle, found by multiplying length by width. Perimeter is the total distance around the outside, found by adding length and width and doubling the result (since each side has a matching opposite side). Diagonal is the straight-line distance between two opposite corners, found with the Pythagorean theorem — the diagonal is the hypotenuse of a right triangle formed by the length and width. A square is simply a rectangle where length and width are equal, so this calculator handles squares correctly as a special case. Enter length and width to get area, perimeter, and diagonal at once.
Worked Examples
Standard case: length 6, width 8
- Area = l × w = 6 × 8 = 48
- Perimeter = 2(l + w) = 2 × (6 + 8) = 2 × 14 = 28
- Diagonal = √(l² + w²) = √(36 + 64) = √100 = 10
Square as a rectangle: length 5, width 5
- Area = l × w = 5 × 5 = 25
- Perimeter = 2(l + w) = 2 × (5 + 5) = 2 × 10 = 20
- Diagonal = √(l² + w²) = √(25 + 25) = √50 ≈ 7.0711
Frequently Asked Questions
Does this calculator work for squares too?
Yes. A square is a rectangle where length and width happen to be equal — the same three formulas (area, perimeter, diagonal) apply without any special-case handling. Enter the same value for both length and width.
Why is the diagonal calculated with the Pythagorean theorem?
The diagonal splits a rectangle into two right triangles. The two sides of the rectangle form the two legs of each triangle, and the diagonal is the hypotenuse — so the Pythagorean theorem (a² + b² = c²) applies directly: diagonal = √(length² + width²).
What happens if I enter a length or width of zero?
Zero is not a valid side length for a rectangle — a shape with a zero-length side has no area and isn't a rectangle. The calculator requires both length and width to be greater than zero and will not return a result for zero or negative values.
Can length and width be decimal values?
Yes. Length and width accept fractional values (e.g. 3.5 or 2.25), and the calculator computes area, perimeter, and diagonal to full decimal precision rather than rounding intermediate steps.
Does it matter which side I call 'length' and which I call 'width'?
No. Area and perimeter are symmetric in length and width, and the diagonal formula squares both sides before adding them, so swapping which side you label length versus width produces identical results.