3² + 4² = 5²

3-4-5 Rule Calculator

Square a deck, foundation, or room: get the diagonal to measure, the biggest 3-4-5 triangle that fits, and whether your two measured diagonals mean the corners are square.

Last reviewed:

Square a corner with the 3-4-5 rule

The 3-4-5 rule checks a corner with nothing but a tape measure: mark 3 ft along one side and 4 ft along the other, and if the marks are exactly 5 ft apart, the corner is 90°. A whole deck, foundation, or room gets one more check: when every corner is square, its two diagonals are the same length.

Enter the two sides below, in feet and inches or metric. The calculator gives the diagonal to measure, the biggest 3-4-5 triangle that fits in a corner and, once you've measured both diagonals, whether the corners are square. It's set up with a 12 ft by 16 ft deck.

Enter the rectangle

The two sides of the deck, foundation, or room, measured along its edges.

Length
Width

Check the corners (optional)

Measure both diagonals, corner to corner, and enter them here.

Diagonal 1
Diagonal 2

Results

Diagonal to measure
20 ft

Both diagonals of a 16 ft × 12 ft rectangle measure this when every corner is 90°.

3-4-5 triangle that fits
12 ft, 16 ft, 20 ft 3-4-5 × 4

Mark 12 ft along the 12 ft side and 16 ft along the 16 ft side, both from the same corner. When the corner is square, the two marks are exactly 20 ft apart.

Corners
Out of square

The diagonals are 3/4 in apart, more than 1/8 in. The two corners at the ends of diagonal 1 are about 0.19° under 90°, and the other two about 0.19° over. Push the ends of diagonal 1 toward each other until both diagonals read 20 ft.

3-4-5 rule calculator diagram: a 12 ft by 16 ft deck with 20 ft diagonals A 16 ft by 12 ft rectangle with both diagonals drawn, each 20 ft when the corners are square, and a 3-4-5 triangle in one corner with legs 12 ft and 16 ft and a 20 ft hypotenuse. Both diagonals: 20 ft 16 ft 12 ft 20 ft 16 ft 12 ft

How it’s worked out

L is the long side, W the short side, and d₁ and d₂ the measured diagonals, all in decimal feet.

  1. Diagonal
    d = √(L² + W²)
    = √(16² + 12²) = √400
    = 20 ft
  2. 3-4-5 triangle
    k = min(12 ÷ 3, 16 ÷ 4)
    = min(4, 4) = 4 ft
    3k = 12 ft, 4k = 16 ft, 5k = 20 ft
  3. Corner check
    d₁ − d₂ ≈ 20.0313 − 19.9688 ≈ 0.0625 ft = 3/4 in
    cos θ = (d₁² − d₂²) ÷ (4 × L × W)
    ≈ (20.0313² − 19.9688²) ÷ (4 × 16 × 12) ≈ 0.0033
    θ ≈ 89.81°, so each corner is about 0.19° off square

Why a 3-4-5 triangle has a right angle

The sides 3, 4 and 5 fit the Pythagorean theorem: 3² + 4² = 9 + 16 = 25 = 5². The theorem also runs in reverse, as Euclid proved in Proposition 48 of Book I of the Elements: when the squares on two sides add up to the square on the third, the angle between those two sides is exactly 90°. So three lengths of 3, 4 and 5 can only close into a triangle with a right angle where the 3 and the 4 meet. The Pythagorean theorem calculator runs the same test on any three sides.

Multiplying all three sides by the same number keeps the shape, since (3k)² + (4k)² = 25k² = (5k)². That's why 6-8-10, 9-12-15 and 12-16-20 work just as well, in feet, meters, or any other unit, as long as all three are measured in the same one.

Worked example: squaring a 12 ft by 16 ft deck

A deck's ledger board runs 16 ft along the house, and the deck reaches 12 ft out into the yard. Its diagonal is √(16² + 12²) = √(256 + 144) = √400 = 20 ft. Since 12-16-20 is 3-4-5 four times over, each half of the deck is one big 3-4-5 triangle, and the corner check and the diagonal check use the same 20 ft.

  1. From one end of the ledger, run a string line out from the house for the 12 ft side.
  2. Mark 16 ft along the ledger and 12 ft along the string, both measured from that same corner.
  3. Swing the string until the two marks are exactly 20 ft apart. The corner is now square.
  4. Lay out the other side the same way, then measure both diagonals of the frame, corner to corner. Each should read 20 ft.

Say they read 20 ft 0 3/8 in and 19 ft 11 5/8 in instead. They're 3/4 in apart, so the frame has racked into a slight parallelogram. The two corners at the ends of the longer diagonal are about 0.19° under 90°, and the other two are the same amount over. That's enough to put the far end of a 16 ft side 5/8 in out of line. Push the ends of the long diagonal toward each other until both read 20 ft. The long one comes down about 3/8 in and the short one grows by about the same. The calculator above is loaded with these readings.

Which 3-4-5 triangle to use

Use the biggest one that fits. Misread the 5 ft diagonal of a 3-4-5 ft triangle by 1/8 in and the corner ends up about 0.25° off, which puts the far end of a 16 ft side about 13/16 in out of line. The same 1/8 in on the 20 ft diagonal of a 12-16-20 ft triangle is only about 0.06°, or about 3/16 in at the end of that side. The calculator picks the biggest triangle whose legs fit along the sides, in whole feet or tenths of a meter.

Layout Size Diagonal 3-4-5 triangle that fits
Raised garden bed 4 ft × 8 ft 8 ft 11 5/16 in 3-4-5 ft
Shed floor 8 ft × 10 ft 12 ft 9 11/16 in 6-8-10 ft
Patio 10 ft × 12 ft 15 ft 7 7/16 in 9-12-15 ft
Deck 12 ft × 16 ft 20 ft 12-16-20 ft
Garage slab 20 ft × 24 ft 31 ft 2 7/8 in 18-24-30 ft
House foundation 24 ft × 32 ft 40 ft 24-32-40 ft
Shed base 2.4 m × 3 m 3.842 m 2.1-2.8-3.5 m
Room 3 m × 4 m 5 m 3-4-5 m
Concrete slab 6 m × 9 m 10.817 m 6-8-10 m

Diagonals are rounded to the nearest 1/16 in or 1 mm. The triangle's short leg goes along the short side.

Checking a deck or foundation by its diagonals

The 3-4-5 rule squares one corner at a time. To check a whole rectangle at once, compare its diagonals:

  1. Make the opposite sides equal: both long sides the same length, and both short sides.
  2. Measure both diagonals between the same points on each corner, such as the outside corners of the frame or the spots where the string lines cross.
  3. If the diagonals match, every corner is 90°. If they don't, the longer one runs between the two corners that are under 90°: push those two corners toward each other until both diagonals read the same.

Step 1 is what makes the test work. A frame whose opposite sides are equal is a parallelogram, and with sides L and W and a corner angle θ, its diagonals are √(L² + W² + 2LW·cos θ) and √(L² + W² − 2LW·cos θ). They're equal only when cos θ = 0, at 90°, and then both are √(L² + W²). The calculator turns the gap between your two diagonals back into that angle with cos θ = (d₁² − d₂²) ÷ (4LW).

Skip step 1 and equal diagonals prove nothing: an isosceles trapezoid, with one long and one short parallel side, has equal diagonals and no right angles at all. To work out a sloped or odd-shaped layout from its sides and angles, use the right triangle calculator. Once a gate or frame is square, the diagonal brace calculator sizes a brace to keep it that way.

3-4-5 rule FAQ

What is the 3-4-5 rule for squaring corners?

It lays out or checks a 90° corner with only a tape measure. From the corner, measure 3 units along one side and 4 units along the other, and mark both points. If the marks are exactly 5 units apart, the corner is square. It works because 3² + 4² = 5², and by the converse of the Pythagorean theorem the angle between the 3 and the 4 must then be a right angle.

Does the 3-4-5 rule work in meters?

Yes. The rule is a ratio, so any unit works as long as all three measurements use the same one. In metric, 3-4-5 m suits a room or a slab, while 60-80-100 cm or 30-40-50 cm suit a small frame or a tile layout. Don’t mix units: 3 m, 4 m and 5 ft is not a right triangle.

What does it mean if the 5 measurement is off?

A reading over 5 means the corner is open, at more than 90°, and a reading under 5 means it is closed, at less than 90°. Keep one side fixed, swing the other in or out, and measure between the marks again until it reads exactly 5. On a 6-8-10 or 9-12-15 triangle, aim for 10 or 15 instead.

How do I find the diagonal of a rectangle?

Square the length and the width, add them, and take the square root: d = √(L² + W²). A 14 ft by 20 ft garage has a diagonal of √(196 + 400) = √596 ≈ 24.41 ft, which is 24 ft 4 15/16 in on a tape. Both diagonals of a rectangle are the same length, which is why comparing them shows whether its corners are square.

What is the 6-8-10 rule?

The same check with every number doubled: 6 along one side, 8 along the other, and 10 between the marks. Because 6² + 8² = 36 + 64 = 100 = 10², it gives exactly the same right angle as 3-4-5. Builders use 6-8-10, 9-12-15 or larger on a big layout because a small reading error throws the corner off less on a bigger triangle.

To find a diagonal from a side and an angle instead, use the hypotenuse calculator. See the full right triangle FAQ for more general questions.

Cite this page

To cite this calculator in schoolwork or a report, you can use this reference (APA style):

Right Triangle Calculators. (2026, October 10). 3-4-5 rule calculator. https://righttrianglecalculators.com/3-4-5-rule-calculator

References

The formulas and definitions on this page match these standard references.

  1. Joyce, David E. (ed.) “Euclid’s Elements, Book I, Proposition 48.” Clark University.
  2. Weisstein, Eric W. “Rectangle.” MathWorld, Wolfram Research.
  3. Weisstein, Eric W. “Parallelogram.” MathWorld, Wolfram Research.

Diagonal brace calculator

Brace length and cut angles for a gate, frame, or shelf, in feet and inches or cm.

Pythagorean theorem calculator

Find the missing side of a right triangle, or check if 3 sides form one.

Hypotenuse calculator

Find the hypotenuse from two legs, a leg and an angle, the area, or the perimeter.

Right triangle calculator

Find the area, sides, and angles of any right triangle from any 2 known values.

Isosceles right triangle calculator

Solve a 45-45-90 isosceles right triangle from a single known side.

Right triangle formulas

Every right-triangle formula in one reference sheet.

Right triangle FAQ

Answers to common right-triangle questions.