Quick answer
The diagonal of a rectangle is d = √(l² + w²). For a 3 by 4 rectangle the diagonal is 5.
Enter the length and width. The calculator returns the diagonal.
Related tools: Rectangle Calculator: Area, perimeter and diagonal of a rectangle. Square Diagonal Calculator: Diagonal of a square. Diagonal Length Calculator: Diagonal of a rectangle or the space diagonal of a box.
How to use the Diagonal of a Rectangle Calculator
- Enter length (above 0).
- Enter width (above 0).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Length | A number | > 0 |
| Width | A number | > 0 |
Formula and method
Formula
d = √(l² + w²)
IEEE-754 double precision; shown to at most 6 decimal places.
Pythagorean theorem.
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: Length = 3; Width = 4.
| Result | Value |
|---|---|
| Diagonal | 5 |
Example 2
Inputs: Length = 1; Width = 1.
| Result | Value |
|---|---|
| Diagonal | 1.414214 |
The first line is the headline result (diagonal). IEEE-754 double precision; shown to at most 6 decimal places.
Why it works
The diagonal splits the rectangle into two right triangles with legs l and w, so the Pythagorean theorem gives the hypotenuse. Both diagonals of a rectangle are equal.
Applications
A door frame is square when both diagonals are equal. A 1.2 m by 2.4 m sheet of plywood has a diagonal of 2.683 m. Sides must be positive.
Screens, rooms and boxes
A rectangle 3 by 4 has a diagonal of 5. A 12 ft by 16 ft room measures 20 ft corner to corner, and a 1920 × 1080 pixel image has a diagonal of about 2,203 pixels.
For a box, the space diagonal is √(l² + w² + h²).
How the result changes with length
Holding every other input at the first worked example, this table changes only length. It shows how sensitive the answer is to that one value; each row was produced by running this calculator.
| Length | Diagonal |
|---|---|
| 1.5 | 4.272002 |
| 3 | 5 |
| 6 | 7.211103 |
| 12 | 12.649111 |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- Length: entering "0" shows "Length must be greater than 0." beside that field and no result.
Choosing between the Diagonal of a Rectangle Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Rectangle Calculator](/math/rectangle/) | length and width | Area |
| [Square Diagonal Calculator](/math/square-diagonal/) | side | Square Diagonal |
| [Diagonal Length Calculator](/math/diagonal-length-calculator/) | length and width | Diagonal |
| [Triangle Calculator](/math/triangle-calculator/) | side a, side b and side c | Area |
| [Circle Calculator](/math/circle-calculator/) | i know the and value | Area |
Background: geometry measurements
Geometry results carry units that depend on the quantity: a perimeter or length is in linear units such as cm, an area or surface area is in square units (cm²) and a volume is in cubic units (cm³). Use one length unit for every input, because the calculator multiplies the numbers as given.
Flat (2D) shapes have an area and a perimeter; solids (3D) have a surface area and a volume. Two familiar checks: a circle of radius r has area πr² and circumference 2πr, and a sphere has volume (4/3)πr³ and surface area 4πr².
Assumptions and limitations
- Sides must be positive
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for length to confirm this.
Frequently asked questions
How do I check a frame is square?
Measure both diagonals and compare.
What is the diagonal of a square with side 1?
A unit square has a diagonal of √(1² + 1²) = √2 ≈ 1.414.
What is the 3-4-5 rule?
A right triangle with sides 3, 4 and 5.
What is the diagonal of a 12 ft by 16 ft room?
√(144 + 256) = 20 ft.
What about a three-dimensional box?
Use √(l² + w² + h²) for the space diagonal.
What does the Diagonal of a Rectangle Calculator calculate?
Diagonal length of a rectangle. It returns Diagonal.
What formula does the Diagonal of a Rectangle Calculator use?
d = √(l² + w²). Pythagorean theorem.
What do I need to enter in the diagonal of a Rectangle Calculator?
You enter Length and Width.
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. Sides must be positive.
What is an example of a diagonal of a Rectangle result?
With length 3 and width 4, the diagonal is 5.
Related calculators
- Rectangle Calculator — Area, perimeter and diagonal of a rectangle.
- Square Diagonal Calculator — Diagonal of a square.
- Diagonal Length Calculator — Diagonal of a rectangle or the space diagonal of a box.
- Triangle Calculator — Area, perimeter, angles and type of a triangle from its three sides.
- Circle Calculator — Radius, diameter, circumference and area of a circle from any one of them.
- Circumference Calculator — Circumference of a circle.
Sources
- Standard Euclidean geometry formulas (e.g. NIST Digital Library of Mathematical Functions §4, CRC Standard Mathematical Tables)
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.