Rafter Calculator
Enter the span, roof pitch and overhang to get the rafter length to the nearest sixteenth of an inch, the roof angle and how many rafters to cut. A rafter calculator finds the length of a common rafter from the building span and the roof pitch using the Pythagorean theorem.
Ordering trusses instead? Trusses are engineered by the manufacturer, not sized with this calculator. To add up the lumber, see the total board length calculator.
Rafter length from run and pitch
Half the building span is the run. Multiply the run by the slope factor for your pitch to get the rafter length to the ridge, then add the overhang. At a 6 in 12 pitch the factor is about 1.118, so a 12 foot run gives roughly 13.4 feet. The sections below work a full example and define each term.
Worked example: a 24 ft span at 6 in 12
The run is half the span, 12 ft, minus half of a 1.5-inch ridge board (0.0625 ft), which is 11.9375 ft or 11′ 11 1/4″. A 6 in 12 pitch means the roof rises 6 inches for every 12 inches of run, so the rise is 11.9375 × 6 ÷ 12 = 5.969 ft, and the roof angle is 26.6 degrees.
The rafter length is √(11.9375² + 5.969²) = 13.347 ft, or 13′ 4 3/16″ to the wall line. A 12-inch level overhang adds 1 ft × 1.118 = 1.118 ft along the slope, so the total is 14.465 ft, or 14′ 5 9/16″. With rafters 16 inches on center along a 30 ft building, you need (22 + 1) × 2 = 46 rafters.

Words used on this page
- Span: the width of the building from outside wall to outside wall.
- Run: the level distance from the wall to the center of the ridge.
- Rise: how high the roof climbs over the run.
- Overhang: how far the rafter extends past the wall, measured level.
Slope factors by pitch
The table lists common roof pitches with their angle and slope factor, plus the rafter length for a 24 foot span. Steeper pitches have bigger factors: 4 in 12 is about 1.054, while 12 in 12 is about 1.414, the diagonal of a square.
The slope factor is the square root of 12 squared plus the rise squared, divided by 12.
| Pitch | Roof angle | Slope factor | Rafter length for a 24 ft span (12 ft run, no overhang) |
|---|---|---|---|
| 3 in 12 | 14.0° | 1.031 | 12′ 4 7/16″ |
| 4 in 12 | 18.4° | 1.054 | 12′ 7 13/16″ |
| 5 in 12 | 22.6° | 1.083 | 13′ 0″ |
| 6 in 12 | 26.6° | 1.118 | 13′ 5″ |
| 7 in 12 | 30.3° | 1.158 | 13′ 10 11/16″ |
| 8 in 12 | 33.7° | 1.202 | 14′ 5 1/16″ |
| 9 in 12 | 36.9° | 1.250 | 15′ 0″ |
| 10 in 12 | 39.8° | 1.302 | 15′ 7 7/16″ |
| 11 in 12 | 42.5° | 1.357 | 16′ 3 3/8″ |
| 12 in 12 | 45.0° | 1.414 | 16′ 11 5/8″ |

Shed roofs and rafter count
A shed roof has one slope, so the run is the full width between supports, not half. To count rafters, divide the wall length by the spacing, often 16 or 24 inches on center, add one, and double it for a gable roof.
A 10 foot shed run at 4 in 12 gives 10 × 1.054 = 10.54 feet, or 10′ 6 1/2″.
With rafters 16 inches on center along a 30 ft building, you need (22 + 1) × 2 = 46 rafters.

The length is measured along the top edge from the center of the ridge to the end of the overhang. It does not include the plumb cut, the seat cut or birdsmouth, collar ties, or the size of lumber. Rafter size and spacing must meet the span tables in your local code for the snow and dead loads in your area; this page gives geometry, not structural sizing, so follow local building code, span tables for your lumber, or a licensed engineer or builder. Results are an estimate; check quantities with your supplier.
Back to the Construction Calculator home page for more job calculators.
Was this page useful on the job?
Mark it as passed, or flag what needs fixing. We read every note.
Logged. Thank you for the note.