Diagonal Calculator

Square up footings, decks, slabs and walls: the exact diagonal, a 3-4-5 check triangle sized to your layout, and the correction when your diagonals don't match.

Layout Dimensions

Tip

Stand at one width side facing the layout. Diagonal 1 runs from your near-left corner to the far-right corner; diagonal 2 runs from near-right to far-left. Enter both to get the correction.

Results

Diagonal when square

-

3-4-5 check triangle

-

Diagonal to width / to length

-

Diagonal difference

-

Slide far side by

-

Corner error

-

Layout (to scale)

Squaring a layout with diagonals

Every rectangle is two right triangles back to back, and the diagonal is their shared hypotenuse. That makes the Pythagorean theorem the fastest squareness check on a job site: set the side lengths, then pull a tape corner to corner both ways. When both diagonals match the calculated number, every corner is 90°.

diagonal = √(width² + length²)

correction = (d₁² − d₂²) ÷ (4 × width)

Step by step

  1. Set one side as your fixed baseline (usually the side that must be parallel to a property line or an existing building).
  2. Measure the width and length off that baseline and stake or mark all four corners.
  3. Measure both diagonals. If they match the calculated diagonal, you are done.
  4. If they differ, keep the baseline fixed and slide the far side along its own length by the correction, toward the short diagonal's far corner. Re-measure.

Worked example: a 12 × 16 ft deck

Diagonal = √(12² + 16²) = √400 = 20 ft. This is a 3-4-5 triangle scaled by 4 (12-16-20), so it comes out exact. Suppose the tape reads 20' 3-9/16" one way and 19' 8-3/8" the other (20.298 ft and 19.698 ft). The correction is (20.298² − 19.698²) ÷ (4 × 12) = (412.0 − 388.0) ÷ 48 = 0.5 ft = 6 in. Slide the far ledger 6 in toward the short diagonal and both will read 20 ft.

Why the correction formula works

Slide the far side sideways by x and the rectangle becomes a parallelogram. Its diagonals are d₁² = w² + l² + 2wx and d₂² = w² + l² − 2wx. Subtract and everything cancels except 4wx, which gives x = (d₁² − d₂²) ÷ 4w with no approximation. The same parallelogram appears in the law of cosines, which is where those ± 2wx terms come from.

Common diagonals

LayoutDiagonal (ft)Diagonal (ft-in)
8 × 10 ft12.80612' 9 11/16"
10 × 12 ft15.62015' 7 7/16"
12 × 16 ft20.00020' 0"
12 × 20 ft23.32423' 3 7/8"
16 × 20 ft25.61225' 7 3/8"
20 × 24 ft31.24131' 2 7/8"
24 × 24 ft33.94133' 11 5/16"
24 × 30 ft38.41938' 5"
24 × 36 ft43.26743' 3 3/16"
30 × 40 ft50.00050' 0"

Rounded to the nearest 1/16 in.

The 3-4-5 method for a single corner

When you only have one corner to set, such as a wall plate meeting another or the first corner of a footing, use a 3-4-5 triangle instead of full diagonals. The calculator sizes it to your layout: for 12 × 16 ft it gives 12 – 16 – 20, the biggest multiple that fits. Large triangles are more accurate, because a 1/8 in tape error is a smaller fraction of 20 ft than of 5 ft. For the full field method, see how to square the footings for a house.

Frequently Asked Questions

How do I calculate the diagonal of a rectangle?

Use the Pythagorean theorem: diagonal = √(width² + length²). A 12 ft × 16 ft deck has a diagonal of √(144 + 256) = √400 = 20 ft exactly. When both diagonals of your layout measure that number, all four corners are 90°.

Why does measuring diagonals prove a layout is square?

A four-sided shape with equal opposite sides is a parallelogram, and a parallelogram's diagonals are equal only when its corners are right angles. If one diagonal is longer, the corners at its ends are less than 90° and the shape is leaning toward that diagonal.

What is the 3-4-5 rule?

Any triangle with sides in the ratio 3:4:5 has a right angle between the 3 and 4 sides, because 3² + 4² = 5². Measure 3 units along one string line, 4 units along the other, and adjust until the distance between the marks is exactly 5 units. Use the largest multiple that fits (6-8-10, 9-12-15, 12-16-20): bigger triangles make small measuring errors matter less.

My diagonals are different. How far do I move the corner?

Slide the far side sideways by (d1² − d2²) ÷ (4 × width), where d1 and d2 are the two measured diagonals and width is the side you are sliding. For a 12 ft wide layout with diagonals of 20 ft 3-9/16 in and 19 ft 8-3/8 in, that is 6 inches. The ratio between the shift and the diagonal difference changes with the shape of the layout, so the exact formula saves a second trip around it.

How close do the diagonals need to be?

It depends on the work. For concrete footings and foundations, within 1/4 in over a typical house footprint is a common target. Deck and wall framing is usually held to 1/8 in, and cabinet or tile layout to 1/16 in. The tighter the finish that follows, the tighter the layout needs to be.

Does this work in metric?

Yes. The math is unit-free, so choose millimetres or metres and enter all measurements in that unit. Imperial results are shown in feet, inches and sixteenths; metric results are shown as decimals.

Related Guides

View all articles

Deepen your understanding of triangles and trigonometry with our guides and tutorials:

Formulas and results last reviewed . How we check accuracy · Corrections log · Report an error

Advertisement

Related Calculators

All calculators