Home / Rafter length calculator

Rafter length calculator

Get the length of common rafters for a gable roof from the building width, pitch and overhang, with cut angles and how many to buy.

Your roof

ft
Outside of wall to outside of wall
in
in
ft

How rafter length is calculated

A common rafter is the sloped side of a right triangle. Its horizontal leg is the run (half the building width), its vertical leg is the rise, and the rafter is the hypotenuse. The pitch factor turns the run straight into rafter length.

Run = span ÷ 2 − ridge thickness ÷ 2
Pitch factor = √(1 + (rise ÷ 12)²)
Rafter length = (run + overhang) × pitch factor

Example: a 24 ft wide building with a 6/12 pitch, a 1.5 inch ridge board and a 12 inch overhang. The run is 12 ft minus 0.75 inch, or 11.94 ft. Add the 1 ft overhang for 12.94 ft, and multiply by 1.118 to get about 14.47 ft, or 14 ft 5 5/8 in. Buy 16 ft boards.

Pitch factors and angles

PitchAnglePitch factorRise per foot of run
4/1218.43°1.0544 in
5/1222.62°1.0835 in
6/1226.57°1.1186 in
7/1230.26°1.1587 in
8/1233.69°1.2028 in
10/1239.81°1.30210 in
12/1245.00°1.41412 in

Before you cut

  • This gives the line length along the top edge of the rafter. The birdsmouth seat cut and tail cut are laid out on the board from there.
  • Cut one pattern rafter, test it at both ends of the building, and use it as a template once it fits.
  • Rafter size and spacing depend on span, snow load and lumber grade. Check your local code's span tables or have the roof engineered.

Frequently asked questions

How do I calculate rafter length?

Take half the building width (the run), subtract half the ridge board thickness, and multiply by the pitch factor, which is the square root of 1 plus (rise ÷ 12) squared. Add the overhang, also multiplied by the pitch factor.

What is the pitch factor?

It's how much longer a sloped rafter is than its horizontal run. For a 6/12 roof the factor is 1.118, so every foot of run needs 1.118 feet of rafter. Steeper roofs have larger factors.

What angle do I cut the rafter at?

The plumb cut at the ridge and at the tail is set to the roof angle, which is the arctangent of rise ÷ 12. A 6/12 roof is 26.57 degrees. On a speed square, you can simply pivot to the 6 on the common scale.

Should I measure the overhang horizontally?

Yes. Overhang is usually specified as horizontal distance past the wall. The calculator converts it to length along the rafter using the same pitch factor.

What lumber length should I buy?

Buy the next standard length longer than the total rafter length, because you need room for the plumb cuts. The calculator suggests a length from the common sizes of 8 to 24 feet in 2-foot steps.