Framing a gable roof starts with the length of the rafters: the sloping boards that run from the ridge to the wall plate and out over the eave. This calculator turns the building width, the roof pitch and the overhang into the length of a common rafter, the rise of the roof, the angle, and the number of rafters and lumber to order.
How the calculation works
- Run = half the building width
- Pitch ratio = rise per 12 inches ÷ 12
- Rafter length = (run + overhang) × √(1 + pitch ratio²)
- Rise = run × pitch ratio, and angle = arctan(pitch ratio)
- Rafters per side = building length ÷ spacing, rounded up, plus 1; both sides is twice that
- Lumber to buy = the rafter length rounded up to the next even foot
Example
A 24 ft wide building, 40 ft long, with a 6/12 pitch, a 1 ft overhang and rafters 16 in. on center. The run is 12 ft, and the rafter length is (12 + 1) × 1.118 = 14.53 ft. The roof rises 6 ft at an angle of 26.6°. You need 31 rafters on each side, or 62 in all, cut from 16 ft boards: 992 linear feet of lumber.
Why it matters
Rafters that are too short leave a gap at the ridge, and rafters that are too long waste lumber and make the roof sag at the tail. Knowing the exact length and count before buying avoids a second trip to the yard and lets you cut all the pieces from one pattern rafter. The same numbers feed the roofing estimate, because the roof surface follows the rafter length.
Good to know
This is a common rafter on a simple gable roof. The ridge board is thick, so the rafter is cut slightly short at the ridge, usually by half the ridge board’s thickness. Hip and valley rafters are longer, by a factor that depends on the pitch. Size the lumber, 2×6 or larger, for the span and snow load with a span table or an engineer. This tool is for planning and does not replace local code.
Related tools
The birdsmouth cut calculator finds the notch at the wall plate, the roof calculator estimates the roofing area, and the roof battens calculator counts the battens.