What this calculator does
The rafter length calculator finds the exact length of lumber needed for a common roof rafter, based on the horizontal run it spans, the roof’s pitch, and any eave overhang.
The formula
Pitch is expressed as rise per 12 inches of run (a 6/12 pitch rises 6 inches for every 12 inches horizontal). Rise is found as (pitch / 12) x run, and rafter length is found with the Pythagorean theorem: the square root of run squared plus rise squared. The overhang is added along the same slope angle, using the same slope factor, since the overhang continues at the same pitch beyond the wall line.
This gives the theoretical rafter length along the roof slope; actual lumber length should add a small margin for birdsmouth notches and ridge cuts. Always verify spans and spacing against your local building code’s rafter tables.