Every rectangle conceals two right triangles. The diagonal is the hypotenuse they share, and once you spot that, the formula writes itself from the Pythagorean theorem. This calculator solves the full system — diagonal, width, height, both corner angles, area and perimeter — in any unit, with complete step-by-step working shown below the result.
The formula
Given a rectangle with width w and height h, the diagonal d is:
d = √(w² + h²)
Because the diagonal, width and height form a right triangle, the Pythagorean theorem applies exactly. The formula can be rearranged for any unknown:
- Width from diagonal and height: w = √(d² − h²)
- Height from diagonal and width: h = √(d² − w²)
Use the Solve for dropdown to pick which variable you want, and the calculator fills in the other two fields as known inputs.
Corner angles
The diagonal cuts each corner of the rectangle into two complementary angles:
- Angle α (diagonal to the base/width): α = arctan(h ÷ w)
- Angle β (diagonal to the side/height): β = arctan(w ÷ h)
Because the angles of the right triangle must sum to 180° and one corner is 90°, we always have α + β = 90°. This is a useful sanity check — if the two displayed angles do not add to 90°, something is wrong with the inputs.
How it works step by step
- You enter two of the three lengths (width, height, diagonal).
- The calculator squares both known values and either adds or subtracts them depending on the mode.
- It takes the positive square root to get the missing length.
- It evaluates arctan for both angles and optionally converts to radians.
- It computes area (w × h) and perimeter (2(w + h)) from the fully-known set of sides.
All arithmetic happens in your browser with JavaScript’s IEEE 754 double-precision floats. Results are rounded to 6 decimal places for display; the underlying computation is full precision.
Worked example
A flatscreen TV manufacturer labels a 55-inch screen by its diagonal. The physical panel measures 47.9 inches wide by 27.0 inches tall. Verify the diagonal:
- w² = 47.9² = 2294.41
- h² = 27.0² = 729.00
- w² + h² = 3023.41
- d = √3023.41 ≈ 54.99 inches — confirms the “55-inch” label
The angle at the base: α = arctan(27.0 ÷ 47.9) ≈ 29.41° The angle at the side: β = arctan(47.9 ÷ 27.0) ≈ 60.59° Check: 29.41 + 60.59 = 90.00° ✓
Area = 47.9 × 27.0 = 1293.3 in² and Perimeter = 2(47.9 + 27.0) = 149.8 in.
Quick reference table
| Width | Height | Diagonal | Angle α |
|---|---|---|---|
| 3 m | 4 m | 5 m | 53.13° |
| 5 m | 12 m | 13 m | 67.38° |
| 8 m | 6 m | 10 m | 36.87° |
| 1 ft | 1 ft | 1.4142 ft | 45.00° |
The 3-4-5 and 5-12-13 rows are Pythagorean triples — integer-length right triangles that appear constantly in construction, tiling, and screen specifications. The 1-1-√2 row is a square, where the diagonal angle is always exactly 45°.
Formula note
The derivation rests entirely on Euclid’s Pythagorean theorem (circa 300 BCE), stated for a right triangle with legs a, b and hypotenuse c as c² = a² + b². For a rectangle, the width and height are the two legs; the diagonal is the hypotenuse. No trigonometry is needed to find the diagonal length itself — it follows from pure algebra. Trigonometry (arctan) enters only when computing the corner angles, using the inverse tangent of the opposite-over-adjacent ratio for each angle in the right triangle.
Every calculation runs entirely client-side — no numbers are ever transmitted to a server.