Roofs

How to calculate rafter length for a gable roof

Step by step: the run, the pitch factor, the overhang and the ridge board, with a worked 24 ft example, the cut angles on a speed square, rafter count and which board length to buy.

A common rafter runs from the top plate of the wall up to the ridge. Its length depends on three things: the run (half the width of the building), the pitch, and the overhang past the wall. This guide shows the calculation with real numbers. The roof pitch calculator does it in one step and also gives the cut angles, the rafter count and the roof area.

Short answer: rafter length = (run + overhang − half the ridge thickness) × √(1 + (pitch ÷ 12)²). For a 24 ft wide building at 6 in 12 with a 12 in overhang and a 1½ in ridge board, that is 14 ft 5 9/16 in, so you buy 16 ft boards.

What you need

Step 1: find the run

The run of one rafter is half the width: 24 ft ÷ 2 = 12 ft (144 in).

Step 2: find the pitch factor

The rafter is the long side of a right triangle, so its length per foot of run is √(1 + (pitch ÷ 12)²). For 6 in 12 that is √(1 + 0.25) = 1.118.

PitchFactorRafter per ft of run
4 in 121.05412 5/8 in
5 in 121.08313 in
6 in 121.11813 7/16 in
7 in 121.15813 7/8 in
8 in 121.20214 7/16 in
9 in 121.25015 in
10 in 121.30215 5/8 in
12 in 121.41416 15/16 in

Step 3: the rafter to the center of the ridge

144 in × 1.118 = 161 in, which is 13 ft 5 in measured along the top edge from the outside of the wall to the center line of the ridge. This is the theoretical length.

Step 4: take off half the ridge board

The rafter stops against the face of the ridge board, not at its center. Take off half the thickness, measured level, then multiply by the factor: (144 − 0.75) × 1.118 = 160.2 in.

Step 5: add the overhang

The overhang is level distance too, so it also gets the factor: (144 − 0.75 + 12) × 1.118 = 173.6 in, which is 14 ft 5 9/16 in from the tail (the long point of the plumb cut) to the long point of the ridge cut.

Step 6: choose the board length

Round up to the next common length. 14 ft 5 9/16 in needs a 16 ft board. A 14 ft board is too short. Lumber comes in even lengths, so a rafter longer than 20 ft needs a splice, a support in the middle or trusses, which means an engineered design.

The cuts

The calculator gives the angles for your pitch: for 6 in 12 the plumb cut is 26.6° off square, and the seat cut is 26.6° to the edge of the board.

How many rafters

Rafters are usually 16 or 24 in on center. The count per side is the roof length ÷ the spacing, plus 1. A 32 ft roof at 16 in has 32 × 12 ÷ 16 + 1 = 25 per side, so 50 rafters.

Hips and valleys

A hip or valley rafter is longer for the same run, because it also runs at 45° in plan. Per foot of common run its length is √(288 + pitch²) in. At 6 in 12 that is 18 in per foot, against 13 7/16 in for the common rafter.

Common mistakes

Video: roof pitch and rafter length with a 6 in 12 example (50 s). Watch on YouTube

Size of the rafter

This guide gives the length only. The size (2×6, 2×8, 2×10…) depends on the span, the spacing, the species and the snow and wind loads of your area. Use the IRC rafter span tables or ask your building department, and confirm everything before you cut.

Sources and further reading

Try it with your own numbers.

The roof pitch calculator gives the angle, the rise, the rafter length with its cut angles, the rafter count and the shingle bundles, with a drawing you can print.

This guide is general information, not engineering or legal advice. Building codes differ by location and edition, so confirm the rules with your local building department before you build.