Rafter Length Calculator

Last Updated: October 22, 2026

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

Enter the run to the ridge center, the full width of an equal gable, or a shed roof’s full width.

For a 6/12 roof, enter 6.

Optional settings
Blank means 0; measure horizontally, not along the rafter.

Blank means 0. Half the thickness is deducted horizontally on an equal gable.

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 = √(Rise2 + Run2)

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 = √(1 + (Pitch / 12)2)
L = Run × Slope Factor

An overhang adds the same diagonal proportion past the wall. On an equal gable, a centered vertical ridge board reduces each horizontal wall-to-centerline run by half its thickness; the corresponding slope-line deduction is half the thickness times the slope factor.

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 finds common rafter line length from rise per 12, slope angle, or measured rise and run. It adds the sloped overhang and deducts the sloped equivalent of half the ridge thickness. The roof pitch mode derives pitch, angle and grade from measured rise and run. The count mode uses ceil(building length / maximum on-center spacing) + 1 positions per slope, then multiplies by the selected slopes. This includes both end positions and permits a shorter final bay; it does not include extra framing for openings, hips or valleys.

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 estimates positions on one roof slope at common maximum on-center spacings. It includes a position at both ends, with a shorter final bay when necessary, before counting the second slope of a gable.

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

Example Problems

Example 1. An equal-gable building is 24 feet wide with an 8/12 pitch and no overhang. The centerline run is 12 feet. Using the unrounded slope factor √(1 + (8/12)2) gives a centerline length of about 14.42 feet. Half of a 1.5-inch ridge board is 0.75 inch, or 0.0625 foot horizontally. The ridge-face line is (12 - 0.0625) times the slope factor, approximately 14.35 feet. This is a geometric line length, not a finished lumber cut dimension.

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 length modes using pitch or angle let you select a wall-to-centerline run or the full width of an equal gable; only the full-width selection is halved.

Does the calculator include the overhang in the rafter length? Yes. It reports the wall-to-ridge-face slope line and adds the sloped equivalent of the horizontal overhang. These geometric lengths do not specify a finished cut: birdsmouth, plumb cuts, fascia details, stock allowance and structural requirements must be checked separately.

Why does the ridge board change the length? Two rafters meet at the ridge, and the ridge board sits between them. For a centered vertical ridge board on an equal gable, half its thickness occupies part of each horizontal centerline run. Multiplying that deduction by the slope factor gives the line-length reduction. Unequal slopes and other framing arrangements need their actual geometry.

Rafter Length Calculator screenshot