Rafter Length Calculator

Last Updated: June 23, 2026

Calculate rafter length from roof pitch, run, and overhang, plus slope angle and the number of rafters for a gable or shed roof.

Rafter Length Calculator

Common rafter length
Required: the roof slope (pitch, angle, or rise and run) and the horizontal run. The run is the level distance from the outside wall to the center of the ridge, usually half the building width. Overhang and ridge thickness are optional.

A 6 means a 6/12 roof (6 rise for every 12 of run).

Run is taken as half of this width.

Level overhang beyond the wall. Leave blank for none.

Roof pitch and slope angle
Required: the vertical rise and the horizontal run. This returns the pitch as rise in 12, the slope angle, the grade, and the rafter length for that run.
Number of rafters
Required: the building length along the ridge and the rafter spacing on center. This returns how many rafters are needed.

Use the same unit as the length (for 16 in centers in feet, enter 1.333).

Half of this is removed from the run. Use 0 or blank to ignore.

Rafter Length Formula

A common rafter follows the diagonal of a right triangle, so its length comes from the Pythagorean theorem using the roof rise and the run. The run is the horizontal distance from the outside of the wall to the center of the ridge, which is half the building span on a gable roof.

L = sqrt(Rise^2 + Run^2)

The rise is set by the pitch, which is the number of inches the roof climbs for every 12 inches of run.

Rise = Run * (Pitch / 12)

Because rise stays in fixed proportion to run, you can skip finding the rise first and multiply the run by a slope factor instead.

Slope Factor = sqrt(1 + (Pitch / 12)^2)
L = Run * Slope Factor

An overhang adds the same diagonal proportion past the wall, and a ridge board shortens the bearing run by half its thickness.

Overhang Length = Eave Run * Slope Factor
Slope Angle = arctan(Pitch / 12)
  • L = rafter length along the slope
  • Rise = vertical height the roof gains over the run
  • Run = horizontal distance from wall to ridge center (half the span on a gable roof)
  • Pitch = rise in inches per 12 inches of run (for example 6 in a 6/12 roof)
  • Slope Factor = multiplier that converts a horizontal run into slope length
  • Eave Run = horizontal overhang past the wall
  • Slope Angle = roof angle from horizontal, in degrees

The calculator has three modes. The common rafter length mode takes your pitch and run, adds any overhang, and subtracts half the ridge thickness to return the bearing length plus the total length with the tail. The roof pitch and slope angle mode converts between pitch, angle, and a measured rise and run so you can describe the slope whichever way you have it. The number of rafters mode divides the building length by the on-center spacing, adds one for the starting rafter, and multiplies by the number of roof sides to estimate how many rafters you need.

Common Roof Pitches, Angles, and Slope Factors

Use this table to check a result or to look up the slope factor for a standard pitch. Multiply your run by the slope factor to get the rafter length without doing the full square root by hand.

PitchSlope AngleSlope Factor
3/1214.0 deg1.031
4/1218.4 deg1.054
6/1226.6 deg1.118
8/1233.7 deg1.202
10/1239.8 deg1.302
12/1245.0 deg1.414

The next table shows how many rafters a single roof side needs at common on-center spacings, before adding the second side of a gable. It assumes one extra rafter for the starting end.

Building Length16 in OC24 in OC
20 ft1611
30 ft2416
40 ft3121

Example Problems

Example 1. A gable building is 24 feet wide with an 8/12 pitch and no overhang. The run is half the span, so 12 feet. The slope factor for 8/12 is 1.202. The rafter length is 12 multiplied by 1.202, which equals 14.42 feet. Subtract half of a 1.5 inch ridge board, about 0.075 feet of run times 1.202, and the bearing length is roughly 14.34 feet.

Example 2. You want the slope angle for a 6/12 roof. The angle is the arctangent of 6 divided by 12, which is the arctangent of 0.5. That gives 26.6 degrees, matching the pitch table above.

FAQ

Is the run the full building width or half of it? On a standard gable roof, each rafter spans only half the building, so the run is half the span. The calculator lets you enter either the run directly or the full building width and it will halve the width for you.

Does the calculator include the overhang in the rafter length? Yes. When you enter an overhang, the tool reports both the bearing length, which is the part resting on the wall and ridge, and the total length including the tail, so you know how long to cut the board.

Why does the ridge board change the length? Two rafters meet at the ridge, and the ridge board sits between them. Half of its thickness takes up part of the run on each side, so the bearing run is shortened by half the ridge thickness to keep the roof the correct overall width.

Rafter Length Calculator