Trigonometry for Roof Pitch and Rafter Length: A Builder's Field Guide

· 12 min read ·trigonometry roof pitch rafter
Following this guide saves you about 15 minutes vs figuring it out manually.
Advertisement

Trigonometry for Roof Pitch and Rafter Length: A Builder's Field Guide

Last reviewed: 2026-05-08 — ScoutMyTool Editorial

A framing crew shows up with a stack of 2×8s, a roof plan that says "8/12 pitch, 16-foot run," and a circular saw. Before any cuts get made, somebody has to compute the rafter length to within an eighth of an inch and the plumb-cut angle to within a quarter of a degree. That conversion — from "X over 12" pitch shorthand to a real angle and a real piece of lumber — is pure right-triangle trigonometry, the same sine, cosine, and tangent every carpenter learned and many forgot. The fastest way to check your math is the tangent calculator, but the formulas are short enough to do on a Speed Square in the field.

This guide covers the pitch-to-angle conversion, the rafter-length formula, hip and valley rafters, the most common pitches by angle, and the code references that govern minimum slopes.

Pitch in X/12 Notation

American framers write roof pitch as rise/run with the run fixed at 12 inches. So a "6/12 pitch" rises 6 inches over every 12 inches of horizontal run. A "12/12 pitch" rises 12 inches per 12 — a 45-degree roof. The 12 in the denominator is a convention; it is not a unit. The numerator is the variable.

Because rise and run form the two legs of a right triangle, the slope angle θ at the eave satisfies:

tan(θ) = rise / run = X / 12

To recover the angle, take the arctangent (also called inverse tangent or tan⁻¹):

θ = arctan(X / 12)

The DLMF entry on §4.21 trigonometric identities and the NIST DLMF chapter on §4.24 inverse trigonometric functions define these formally. The tangent calculator does the lookup directly.

Common pitches:

Pitch tan(θ) Angle θ
3/12 0.250 14.04°
4/12 0.333 18.43°
6/12 0.500 26.57°
8/12 0.667 33.69°
9/12 0.750 36.87°
10/12 0.833 39.81°
12/12 1.000 45.00°

The 9/12 row produces a clean 36.87° because (3, 4, 5) is a Pythagorean triple — a 9-12-15 triangle scales the same way and is the carpenter's favourite.

8/12 pitch, 16-ft run, common rafter eave ridge bird's mouth run = 16 ft rise = 10.67 ft (8/12 × 16) L = 16 / cos(33.69°) L = 19.23 ft θ = 33.69° tan(θ) = rise/run = 8/12 = 0.667 → θ = arctan(0.667) = 33.69° (cf. NIST DLMF §4.24)
The right-triangle decomposition every common rafter uses. 8/12 pitch on a 16-ft run gives a 33.69° slope angle and a 19.23-ft theoretical rafter length. Inverse-tangent identity per the NIST DLMF §4.24 inverse trigonometric functions.

Common-Rafter Length

Once you have the angle, the rafter length L (the hypotenuse of the rise-run triangle, measured from the ridge cut to the bird's-mouth cut along the top edge) is:

L = run / cos(θ)

or equivalently, by the Pythagorean theorem:

L = √(rise² + run²)

Both forms give the same number; cosine is faster on a calculator, the Pythagorean form is faster in your head. The cosine calculator handles the first form, and the sine calculator is the right choice when you know the rise and the angle and want the rafter (L = rise / sin(θ)). For an area-based check on the gable triangle the triangle-area calculator closes the loop.

The line you compute is the theoretical rafter length, ridge to outside of plate. From that line you subtract half the ridge-board thickness for the plumb cut and add the rafter overhang (tail) for the eave. The classic reference is the Architectural Graphic Standards, 12th edition (Wiley, 2016), and the U.S. Forest Service's Wood HandbookFPL-GTR-282 — covers the lumber-engineering side.

Hip and Valley Rafters

Hip rafters and valley rafters run diagonally across the framing plan from a corner of the building to the ridge, and they ride on a longer effective run than the common rafter. For a square corner — a hip roof with equal pitches on both sides — the run of the hip is the diagonal of a square whose side equals the common-rafter run:

run_hip = run_common · √2 ≈ run_common · 1.4142

The rise is the same as the common rafter, so the hip-rafter angle is shallower:

θ_hip = arctan(rise / run_hip) = arctan((X/12) / √2)

For an 8/12 common, tan(θ_hip) = (8/12)/√2 ≈ 0.4714, so θ_hip ≈ 25.24°. The hip-rafter length follows the same hypotenuse rule:

L_hip = run_hip / cos(θ_hip) = √(rise² + run_hip²)

Valleys are the inverse — they run inward from a corner where two roof planes meet — but the geometry is identical. Most framers use the second-row scales on a framing square (the "hip and valley" scale) to skip the trigonometry, but the underlying numbers are the ones above.

Advertisement

Code Minimums and Safety

Roof slope is not just an aesthetic choice. The 2021 International Residential Code, Section R905, sets minimum slopes for each common roof covering. Asphalt shingles, for example, are not permitted below 2:12 pitch (about 9.46°), and below 4:12 the code requires a double underlayment. The full IRC text is published by the International Code Council and adopted in modified form by most U.S. states; the ICC Digital Codes library hosts the current edition.

Steeper pitches change the safety regime, too. The U.S. Occupational Safety and Health Administration's standard 29 CFR 1926.501 requires fall protection at 6 feet on any roof, and steep roofs (above 4:12) carry stricter guardrail and personal-fall-arrest requirements. The U.S. Department of Energy also publishes guidance on cool roofs that interacts with pitch — low-slope roofs benefit most from reflective coatings.

How the Calculator Works

The tangent calculator takes a pitch in X/12 form and returns the slope angle by computing arctan(X/12) in degrees. Pair it with the cosine calculator to convert your run into a rafter length: L = run / cos(θ). The sine calculator is the alternate path when you have a rise and an angle. For checking the area of a gable end (useful when ordering siding or sheathing) the triangle-area calculator takes base and height and returns ½ · base · height directly.

Worked Examples

1. 6/12 pitch, 14-foot run, common rafter. Angle θ = arctan(6/12) = arctan(0.500) = 26.57°. Rise = 14 · 0.500 = 7 ft. Rafter length L = √(7² + 14²) = √(49 + 196) = √245 ≈ 15.652 ft, or about 15 ft 7-13/16 in. Cross-check: L = 14 / cos(26.57°) = 14 / 0.8944 ≈ 15.652 ft. Same answer.

2. 8/12 pitch, 16-foot run, common rafter. Angle θ = arctan(8/12) = arctan(0.667) = 33.69°. Rise = 16 · 0.667 = 10.667 ft. Rafter length L = √(10.667² + 16²) = √(113.78 + 256) = √369.78 ≈ 19.230 ft, or about 19 ft 2-3/4 in. The rule of thumb that "an 8/12 rafter is about 1.20 times the run" comes straight out of 1/cos(33.69°) ≈ 1.2019.

3. 12/12 pitch, 12-foot run, hip rafter. Common-rafter angle θ = 45°. Hip run = 12 · √2 ≈ 16.971 ft. Hip angle θ_hip = arctan(12/16.971) = arctan(0.7071) = 35.26°. Hip-rafter length = √(12² + 16.971²) = √(144 + 288) = √432 ≈ 20.785 ft, or about 20 ft 9-7/16 in. The common rafter on the same plan is √(12² + 12²) = √288 ≈ 16.971 ft, so the hip is roughly 22 % longer than the common — a useful field check.

Common Pitfalls

Mixing up rise and run. "X/12" means rise over run. Putting the 12 on top gives you the complement of the slope angle, not the slope.

Forgetting to subtract the ridge. The theoretical length runs to the centre of the ridge board. Real cuts subtract half the ridge thickness (typically 3/4 in for a 1.5-in ridge) along the slope direction, which means you actually subtract (ridge_thickness/2) / cos(θ).

Calculator in the wrong angle mode. A scientific calculator set to radians will return arctan(0.667) ≈ 0.5880 rad, not 33.69°. Always confirm "DEG" before you cut. The NIST DLMF entry on §4.21 uses radians; carpentry uses degrees.

Treating the slope length as the horizontal length. Underestimating shingle quantity is the usual symptom. Roofing material is sold by the square (100 sq ft of slope area), and the slope area is greater than the footprint area by a factor of 1/cos(θ).

Ignoring overhang. The bird's-mouth-to-tail addition is part of the cut; if you order rafters at the theoretical length you will be short by the overhang on every common.

Skipping the building code. The 2021 IRC R905 minimum slopes are not advisory. Below 2:12 you cannot use standard asphalt shingles at all; the ICC Digital Codes listing is the controlling reference.

Frequently Asked Questions

Q: What is the difference between roof pitch and roof slope?

A: Roofers and code officials use the words almost interchangeably. Strictly, slope is the ratio rise/run (a unitless number or X/12), and pitch is sometimes used to mean rise/span (rise over the full width of the building). The IRC and most U.S. trade literature use "slope" for the X/12 ratio.

Q: How do I convert from a roof angle in degrees back to X/12?

A: Compute X = 12 · tan(θ). A 30-degree roof gives X = 12 · 0.5774 ≈ 6.93, so call it a 7/12. The tangent calculator does the conversion in one step.

Q: Why is 12/12 the threshold for "steep" in the building code?

A: The OSHA standard at 29 CFR 1926.501 defines a steep roof as one with a slope greater than 4:12, not 12:12. Above that pitch, fall-protection requirements escalate and most insurers charge a higher premium for installation.

Q: Do hip rafters always run at √2 times the common run?

A: Only when the corner is a right angle and both adjoining roof planes share the same pitch. On a non-square hip or a roof where the two pitches differ, the hip run is the geometric diagonal of the actual corner footprint, which the Architectural Graphic Standards covers in its hip-and-valley layout chapter.

Q: What is the lowest-slope roof I can shingle?

A: 2:12 (about 9.46°) under the 2021 IRC for asphalt shingles, with a double underlayment required from 2:12 to 4:12. The full Section R905 text is on the ICC Digital Codes site.

Q: How does roof pitch affect snow-load design?

A: Steeper pitches shed snow faster, so snow-load reduction factors apply per the ASCE 7 Minimum Design Loads standard and §1608 of the International Building Code. Above 70°, the slope-factor reduces the design snow load to zero. Pitches below ~30° receive little or no reduction. Local code amendments often supersede the base ASCE 7 numbers.

Q: Why do framing squares have an extra "hip and valley" scale?

A: Because hip and valley rafters run at √2 longer per unit of common run on a square corner (see the body section above). Rather than ask the carpenter to recompute, the framing square's second row of stamped per-foot-of-run length numbers handles the diagonal automatically. The Stanley Tools Speed Square user manual (and equivalents from Swanson, Empire, etc.) covers the layout.

A Final Note

This article is general construction-math educational content. Actual rafter cuts on permitted residential and commercial work in the United States require compliance with the locally-adopted edition of the IRC/IBC and inspection by the authority having jurisdiction.

For related guides, see how surveyors use sine and cosine, how to calculate percent change, markup vs margin, and the days-between-two-dates complete guide.

Sources & References

Advertisement