How to calculate rafter length
- Measure the span — the distance between the outside faces of the bearing walls.
- Find the run: half the span, minus half the ridge board thickness.
- Multiply the run by the pitch factor (the hypotenuse of a right triangle with 12 in of run and your rise).
- Add the overhang, also multiplied by the pitch factor, then pick the next standard lumber length.
Rafter formula
Rafter length = (Span ÷ 2 − Ridge thickness ÷ 2) × Pitch factor
Overhang length = Horizontal overhang × Pitch factor
Worked example: 24 ft span at 6/12
Run = 12 ft − 0.75 in = 11.94 ft. The 6/12 pitch factor is 1.118, so the rafter is 11.94 × 1.118 = 13.35 ft to the wall. A 12 in overhang adds 1.12 ft along the slope, for 14.46 ft in total — buy 16 ft lumber. The ridge sits 6 ft above the wall plates, and the plumb cut angle is 26.6°.
Pitch factors and angles
| Pitch | Angle | Pitch factor | Rafter length per foot of run |
|---|---|---|---|
| 3/12 | 14.0° | 1.031 | 12.37 in |
| 4/12 | 18.4° | 1.054 | 12.65 in |
| 5/12 | 22.6° | 1.083 | 13.00 in |
| 6/12 | 26.6° | 1.118 | 13.42 in |
| 7/12 | 30.3° | 1.158 | 13.89 in |
| 8/12 | 33.7° | 1.202 | 14.42 in |
| 9/12 | 36.9° | 1.250 | 15.00 in |
| 10/12 | 39.8° | 1.302 | 15.62 in |
| 12/12 | 45.0° | 1.414 | 16.97 in |
The last column is what framing squares print as "length of common rafter per foot of run". See roof pitch explained for how to measure an existing roof.
Plumb, seat and birdsmouth cuts
- Plumb cut — the vertical cut at the ridge and at the tail. Its angle from the rafter edge equals the pitch angle; set a speed square to the rise (for example "6" on the common scale).
- Seat (level) cut — the horizontal part of the birdsmouth that sits on the wall plate, at 90° minus the pitch angle to the rafter's edge.
- Birdsmouth depth — a common rule of thumb is to cut no more than about one-third of the rafter depth, leaving enough wood above the plate to carry the load.
How many rafters do you need?
Rafters per side = building length × 12 ÷ spacing in inches, rounded up, plus one for the end. Double it for both sides of a gable roof. A 40 ft building at 16 in on center needs 31 per side, or 62 in total. Add gable-end overhang framing and extra pieces for any dormers or openings.
Rafter size and code
Length is geometry; size is engineering. The required rafter size (2×6, 2×8, 2×10…) depends on span, spacing, lumber species and grade, roof and snow loads, and whether there is a ceiling attached. Use the rafter span tables in the International Residential Code (Section R802) or your local code, or have the roof designed. Rafters must also be tied together (ceiling joists or rafter ties) or the ridge must be a structural beam to stop the walls spreading.
Frequently asked questions
How do you calculate rafter length?
Divide the span by 2, subtract half the ridge thickness, and multiply by the pitch factor √(1 + (rise ÷ 12)²). Add the overhang times the same factor.
What is the rafter length for a 24 ft span at 6/12 pitch?
About 13.35 ft from ridge to wall with a 1½ in ridge board, or about 14.46 ft with a 12 in overhang. Buy 16 ft lumber.
What is the angle of a 6/12 roof?
About 26.6°. A 4/12 roof is 18.4°, an 8/12 roof is 33.7° and a 12/12 roof is 45°.
How far apart should rafters be?
Most residential rafters are 16 in or 24 in on center. The spacing affects the rafter size required by code span tables.
Does rafter length include the overhang?
This calculator shows both: the line length from ridge to the outside of the wall, and the total including the overhang measured along the slope.
Sources & standards
This calculator's formulas and default values are based on the following codes, standards and published data. Codes are adopted and amended locally, so check with your building department for permitted work. See how we build and check our calculators.
- International Residential Code (IRC) R802: roof framing, including rafter span tables R802.4.1(1)–(8) and rafter ties.
- American Wood Council, Span Tables for Joists and Rafters and the National Design Specification (NDS).
- Right-triangle geometry: pitch factor = √(1 + (rise ÷ 12)²); angle = arctan(rise ÷ 12).