Rafter Length Calculator
Find the rafter length you need to cut, from the horizontal run, roof pitch, and overhang, using the Pythagorean theorem.
Reviewed by the ToolNestr Editorial Team — July 2026
How the rafter length calculator works
A common rafter forms the hypotenuse of a right triangle: the run is the horizontal leg, from the outside wall to the center of the ridge, and the rise is the vertical leg, how much the roof climbs over that run. The rise is found from the pitch — the rise-per-12-inches ratio — multiplied by the actual run and divided by 12.
With both legs known, the Pythagorean theorem gives the rafter length: the square root of the run squared plus the rise squared. That is the length from the top of the wall plate to the centerline of the ridge. The overhang, the part of the rafter that extends past the wall to form the eave, is added on separately along the same slope angle, since it is not part of the run-to-ridge triangle.
This is standard IRC/IBC rafter geometry — the same right-triangle relationship every span table and framing square is built on. In the field, carpenters typically shorten the final cut by half the ridge board's thickness on each side so the two opposing rafters meet cleanly at the ridge; that small trim happens after laying out this theoretical length.
Rafter sizing and span limits follow IRC Chapter 8 (Roof-Ceiling Construction) and the AWC span tables referenced by Section R802.
Enter the run
Half the building's span, in feet, from wall to ridge centerline.
Set the pitch
The rise per 12 inches of run, such as 6 for a 6-in-12 roof.
Add the overhang
Include your eave overhang for the full rafter cut length.
The formula explained
Rise
rise = run × pitch⁄12. A 12 ft run at 6 in 12: 12 × 6⁄12 = 6 ft.
Run-to-ridge length
= √(run² + rise²) = √(144+36) = √180 = 13.42 ft.
With overhang
An 18″ (1.5 ft) overhang along the slope: 1.5⁄cos(26.57°) = 1.68 ft. Total = 13.42 + 1.68 = 15.1 ft.
Worked example
A 28 ft wide building (14 ft run) at 8 in 12 pitch, 12″ overhang.
Real-world context
A garage addition with a 32 ft span (16 ft run) at a moderate 5 in 12 pitch with a 24-inch overhang is a common permit-ready scenario. The rise works out to 16 × 5⁄12 = 6.67 ft, giving a run-to-ridge length of √(256+44.4) = 17.33 ft, and with the overhang added along the 22.6° slope, the total cut length comes to 19.5 ft — long enough that most lumberyards would special-order 20 ft dimensional stock rather than splice shorter boards.
A steep 9 in 12 roof over a compact 20 ft span (10 ft run) with a 16-inch overhang shows how pitch, not span, drives length on smaller structures. The rise is 7.5 ft, the run-to-ridge length is exactly √(100+56.25) = 12.5 ft, and at a 36.9° angle the overhang adds relatively more slope length per inch than a shallow roof would, bringing the total to 14.17 ft.
A wide 40 ft span (20 ft run) at a shallow 4 in 12 pitch with an 18-inch overhang is typical of ranch-style additions. Rise is 6.67 ft, the main rafter length is 21.08 ft, and the gentle 18.4° angle means the overhang barely stretches beyond its flat 1.5 ft measurement, landing the total near 22.66 ft — a length that pushes into engineered I-joist or LVL territory rather than standard dimensional lumber for many species and grades.
Lumberyards typically stock dimensional rafter stock in 2 ft increments — 12, 14, 16, 18, 20, 22, and 24 ft lengths — so once the calculator returns a total, framers round up to the next available stock length rather than ordering an exact custom cut. This is also the point where many builders decide whether trussed rafters make more economic sense than site-built stick framing, since factory trusses become more competitive as calculated span and rise increase.
Common misconceptions
"Run means the full width of the building." It is half that. For a simple gable roof, the run is measured from the outside wall to the centerline of the ridge — for a 24 ft wide building, the run is 12 ft, not 24 ft. Entering the full span instead of half of it roughly doubles the calculated rafter length.
"The rafter length calculation already accounts for the ridge board and birdsmouth cuts." It does not. This calculator gives the theoretical centerline-to-centerline length. Real-world cuts get shortened by half the ridge board's thickness at the top and adjusted at the birdsmouth notch where the rafter meets the wall plate — both are field adjustments made after this baseline length.
Related calculators
Frequently asked questions
How do I calculate rafter length?
A rafter is the hypotenuse of a right triangle formed by the horizontal run and the vertical rise. Find the rise by multiplying the run by the pitch (rise per 12 inches, divided by 12), then use the Pythagorean theorem: rafter length equals the square root of run squared plus rise squared.
What is roof run versus roof span?
The span is the total width of the building; the run is half the span for a simple gable roof, since the rafter travels from the outside wall to the center ridge. Enter the run — half the span — not the full building width.
Do I need to add anything for the overhang?
Yes. This calculator finds the length from the wall plate to the ridge. Add your desired eave overhang separately, since it extends the rafter tail beyond the wall and is not part of the run-to-ridge span.
Does this account for the ridge board thickness?
No, this gives the theoretical centerline length. In the field, carpenters shorten the actual cut by half the ridge board thickness on each rafter so the pair meets correctly at the ridge — a small adjustment made after this length is found.
Sources & references
This tool uses standard formulas and reference values from:
- • American Concrete Institute — ACI 318, Building Code Requirements for Structural Concrete. concrete.org
- • ICC — International Residential Code (IRC), span, footing and framing tables. codes.iccsafe.org
- • APA – The Engineered Wood Association, allowable span and load guidance.
Estimates for planning only. Span, load and code values vary by jurisdiction — verify against your local adopted code and a licensed engineer before building.