Rectangle calculator
Area, perimeter, diagonal and aspect ratio of a rectangle, plus a square calculator, in any unit you choose.
Result
Area (w × h)
-
- Perimeter, 2(w + h)
- -
- Diagonal, √(w² + h²)
- -
- Aspect ratio
- -
Square (special rectangle)
A square is a rectangle where every side is the same length.
- Area, s²
- -
- Perimeter, 4s
- -
- Diagonal, s√2
- -
- Circumradius, s√2 / 2
- -
- Inradius, s / 2
- -
How it works
A rectangle is a quadrilateral with four right angles, whose area equals width times height (A = w × h) and whose diagonal length comes from the Pythagorean theorem as √(w² + h²).
- Pick a unit (optional)
Purely a label on the results; enter width and height in that same unit.
- Enter width and height
Zero and decimals are both fine; negative numbers are not.
- Read the results
Area, perimeter, diagonal and the simplified aspect ratio.
Area, perimeter and diagonal
Area = width × height; perimeter = 2(width + height). For a 10 by 5 rectangle, area is 50 square units and perimeter is 30 units. The diagonal connects opposite corners and, by the Pythagorean theorem, equals √(w² + h²); for 6 by 8 it is √(36 + 64) = √100 = 10 units, always longer than either side and shorter than their sum.
Aspect ratio
The aspect ratio expresses width to height as two integers with no common factor. A 1920 by 1080 rectangle has a greatest common divisor of 120, giving an aspect ratio of 16:9, the kind of figure used for screen resolutions, photography and document layout.
Squares
A square is a rectangle where width and height are equal. Besides area (s²), perimeter (4s) and diagonal (s√2), a square has a circumradius, the radius of the circle that passes through all four corners, equal to s√2 / 2, and an inradius, the radius of the largest circle that fits inside, equal to s / 2.
Negative and zero dimensions
Width and height cannot be negative: a length below zero has no physical meaning, so the calculator flags it instead of showing a negative area. Zero is accepted for either dimension, which collapses the rectangle to a line and gives an area of zero.
Worked examples: TV screens and shapes with the same perimeter
TVs are sold by their diagonal, the one dimension that does not tell you how wide the set is. With the aspect ratio of 16:9, width = diagonal × 16 ÷ √(16² + 9²) and height = diagonal × 9 ÷ √(16² + 9²), where √337 is about 18.36.
| Screen diagonal | Width (inches) | Height (inches) | Screen area (square inches) |
|---|---|---|---|
| 43 inch | 37.5 | 21.1 | 790 |
| 50 inch | 43.6 | 24.5 | 1,068 |
| 55 inch | 47.9 | 27.0 | 1,293 |
| 65 inch | 56.7 | 31.9 | 1,805 |
| 75 inch | 65.4 | 36.8 | 2,404 |
| 85 inch | 74.1 | 41.7 | 3,087 |
The table is why a 65 inch set is not "a bit bigger" than a 55 inch one: its area is 40% larger.
Perimeter and area also move independently. Fencing 20 units of perimeter into a rectangle gives very different areas depending on its shape, and the square wins:
| Width x height (perimeter 20) | Area |
|---|---|
| 5 x 5 | 25 |
| 6 x 4 | 24 |
| 7 x 3 | 21 |
| 8 x 2 | 16 |
| 9 x 1 | 9 |
For a room 4.2 m by 3.6 m, the area is 15.12 square meters for flooring or paint coverage, and the perimeter is 15.6 m, the length for baseboards before subtracting door openings. Two different quantities, two different formulas.
Frequently asked questions
How do you calculate the area and perimeter of a rectangle?
Area = width × height; perimeter = 2(width + height). For a rectangle 10 by 5: area = 50 square units, perimeter = 30 units. The calculator also shows the diagonal, √(10² + 5²) = √125, about 11.18 units, and the aspect ratio, 2:1 in this case.
What is the diagonal of a rectangle and how is it calculated?
The diagonal connects opposite corners of the rectangle. By the Pythagorean theorem, diagonal = √(w² + h²). A 6 by 8 rectangle has diagonal = √(36 + 64) = √100 = 10 units. The diagonal is always longer than either side and shorter than the sum of both sides.
How does a square relate to a rectangle?
A square is a special rectangle where all four sides are equal (w = h). The calculator includes a dedicated square section: area = s², perimeter = 4s, diagonal = s√2, circumradius (the circle through the corners) = s√2 / 2, and inradius (the largest circle that fits inside) = s / 2. For s = 5, area = 25, perimeter = 20, diagonal is about 7.07.
What is the aspect ratio of a rectangle?
The aspect ratio expresses the proportional relationship between width and height as two integers with no common factor. For a 1920 by 1080 rectangle, the greatest common divisor is 120, giving aspect ratio 16:9. Aspect ratios are widely used in screen resolutions, photography, and document layout.
Can I enter decimal values, and does a negative or zero dimension work?
Yes to decimals: the calculator accepts any non-negative real number for width and height, including decimals, and every result updates as you type. Zero is accepted and gives an area of zero. Negative numbers are not accepted, since a negative length has no physical meaning; the calculator flags the field instead of showing a negative area.