Skip to content
Omnikalc

Rafter length calculator: how long are the rafters for your roof?

Enter the building width, the roof pitch, the overhang and the spacing to get the rafter length, the rise, the angle, the number of rafters and the lumber to buy.

Updated on
Your inputs
ft

Value out of range

ft

Value out of range

in 12

Value out of range

ft

Value out of range

in

Value out of range

Results

Rafter length, ridge to tail

14.53 ft

Roof rise from the wall plate to the ridge
6.00 ft
Roof angle
26.6 °
Number of rafters (both sides)
62
Lumber length to buy for each rafter
16 ft
Total rafter lumber
992 linear ft

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.

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.

Frequently asked questions

How do you find the length of a rafter?

Multiply the horizontal run, which is half the span plus the overhang, by the square root of 1 plus the pitch ratio squared. A 6/12 pitch has a ratio of 0.5, so a 13 ft run gives 13 × 1.118 = 14.53 ft.

What does 6/12 pitch mean?

It means the roof rises 6 inches for every 12 inches it runs horizontally. A 6/12 roof has an angle of 26.6 degrees. Common pitches run from 4/12 for gentle roofs to 12/12 for steep ones.

Does the rafter length include the overhang?

Yes. The calculator measures the run from the ridge to the edge of the overhang, and the rafter tail extends the full length. The birdsmouth cut at the wall plate does not shorten the length along the top edge.

How many rafters do I need?

Divide the building length by the spacing, round up and add one for the end, then double it for two sides. With a 40 ft building and 16 inches on center, that is 31 per side, or 62 in all.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.