Rafter line length is the run × the slope factor, where run is half the span less half the ridge. For a 24 ft span at 6/12: run 11 ft 11¼ in × 1.118 = 13 ft 4 3/16 in (4.07 m), plus 13 7/16 in (34 cm) for a 12 in overhang. Cut it from a 16 ft board.
How to measure for the calculator
The tool works out common rafters for a simple gable roof: two equal slopes meeting at a ridge board.
- Building width: outside face of one wall's top plate to the outside face of the other. Use the framing, not the siding; the rafter heel lines up with that face.
- Pitch: inches of rise per 12 in of level run. On an existing roof, touch one end of a level to the underside of a rafter, hold it level, and measure straight up from the 12 in mark. In cm mode the pitch is in degrees.
- Eave overhang: the level distance from the wall to the end of the tail, measured flat, not along the slope.
- Ridge thickness: 1½ in for a 2x ridge board.
- Rafter size and spacing: from your plan or the span tables (below). A 2x8 is 7¼ in (184 mm) deep (PS 20-20, Table 3).
- Building length: along the ridge, for the count. Gable overhang rafters are not included.
The math, with your numbers
A common rafter is the long side of a right triangle: run is the level leg, rise the upright leg, and by Pythagoras the line length is the square root of run² + rise². It is the same triangle as a stair stringer in the stair calculator. The slope factor, sqrt(12×12 + rise×rise) ÷ 12, does it in one step: at 6/12 every foot of run takes 1.118 ft of rafter.
- Half the ridge comes off the run, measured level, because the rafter stops at the ridge face, not its center (Swanson Tool Co.).
- The tail adds overhang × slope factor.
- The board is longer than the rafter by depth × rise ÷ 12, because the plumb cuts at both ends lean.
Lengths run along the measuring line, from the outside top corner of the plate to the ridge. Between two plumb cuts both edges are the same length, so you can hook the tape on the top edge.
Rafter length per foot of run
Multiply the run in feet by the last column to get the line length in inches. In metric, multiply the run by the slope factor.
| Pitch | Angle | Slope factor | Rafter per ft of run |
|---|---|---|---|
| 3/12 | 14.0° | 1.0308 | 12.37 in |
| 4/12 | 18.4° | 1.0541 | 12.65 in |
| 5/12 | 22.6° | 1.0833 | 13.00 in |
| 6/12 | 26.6° | 1.1180 | 13.42 in |
| 7/12 | 30.3° | 1.1577 | 13.89 in |
| 8/12 | 33.7° | 1.2019 | 14.42 in |
| 9/12 | 36.9° | 1.2500 | 15.00 in |
| 10/12 | 39.8° | 1.3017 | 15.62 in |
| 11/12 | 42.5° | 1.3566 | 16.28 in |
| 12/12 | 45.0° | 1.4142 | 16.97 in |
Computed by Remodel Fit; the per-foot values match the framing square table in Swanson's Blue Book.
Worked example: a 24 × 40 ft garage at 6/12
These are the calculator's starting values: 12 in overhang, 2x8 rafters at 16 in on center, 1½ in ridge.
- Run: 12 ft less ¾ in = 11 ft 11¼ in (3.639 m). Rise: 12 ft × 6 ÷ 12 = 6 ft.
- Line length: 143.25 in × 1.118 = 13 ft 4 3/16 in (4.068 m). The 13 7/16 in tail makes it 14 ft 5 9/16 in.
- Board: plus 7¼ × 6 ÷ 12 = 3 5/8 in for the leaning cuts, or 14 ft 9 3/16 in. A 14 ft board is short, so buy 16 ft.
- Count: 480 ÷ 16 = 30 spaces, so 31 rafters a side, 62 in all.
The birdsmouth: how deep the seat cut can be
The birdsmouth is the notch that seats a rafter on the wall: a level seat cut on the top plate and a plumb heel cut against its outside face. The 2021 International Residential Code (IRC) limits it three ways:
- Bearing: at least 1½ in on wood or metal, 3 in on masonry or concrete (R802.6, quoted on The Building Code Forum).
- Depth: a notch at the end of a rafter may be at most one-fourth of its depth (R802.7.1; same limit in R502.8.1, ICC CodeNotes; LADBS).
- Overhangs: a notched rafter may overhang at most 24 in and must keep at least 3½ in of depth (R802.7.1.1, Building Code Trainer).
The calculator starts with a 3½ in seat, the width of a 2x4 plate, and shortens it in 1/16 in steps until the notch, measured square to the rafter edge, is at most a quarter of the depth. That leaves at least 4 1/8 in of a 2x6, so the 3½ in rule is met too. Steeper roofs get shorter seats.
| Rafter | Depth | Max notch | Seat at 4/12 | 6/12 | 8/12 | 12/12 |
|---|---|---|---|---|---|---|
| 2x6 | 5½ | 1 3/8 | 3½ | 3 1/16 | 2 7/16 | 1 15/16 |
| 2x8 | 7¼ | 1 13/16 | 3½ | 3½ | 3¼ | 2 9/16 |
| 2x10 | 9¼ | 2 5/16 | 3½ | 3½ | 3½ | 3¼ |
| 2x12 | 11¼ | 2 13/16 | 3½ | 3½ | 3½ | 3½ |
Inches. Depths from the AWC span tables; seats rounded down to 1/16 in. All exceed the 1½ in minimum bearing.
Ridge board or ridge beam
IRC R802.3: a ridge board must be at least 1 in nominal thick and no shallower than the cut end of the rafter (2021 IRC text, in the 2021 Seattle Residential Code). That cut end is the plumb cut, depth ÷ cos(angle): 8 1/8 in for a 2x8 at 6/12, so the ridge is a 2x10. Hence the habit of buying the ridge one size deeper; steep roofs need two.
| Rafter | 4/12 | 6/12 | 8/12 | 10/12 | 12/12 |
|---|---|---|---|---|---|
| 2x6 | 2x8 | 2x8 | 2x8 | 2x8 | 2x10 |
| 2x8 | 2x10 | 2x10 | 2x10 | 2x12 | 2x12 |
| 2x10 | 2x12 | 2x12 | 2x12 | 2x14 | 2x14 |
| 2x12 | 2x14 | 2x14 | 2x16 | 2x16 | deeper |
Shallowest 2x ridge that covers the plumb cut. A 2x14 is 13¼ in and a 2x16 15¼ in deep (PS 20-20); few yards stock them, so 2x12 rafters often get an engineered ridge.
A ridge board is not a beam. Ceiling joists or rafter ties at the plates stop the walls spreading; the ridge only gives the rafters something to push against. Where no ties run across, as under a cathedral ceiling, R802.3 requires an engineered ridge beam carried by a wall or column at each end. Below 3/12, ridges, hips and valleys must be designed as beams (R802.4.4), and opposing rafters must line up within 1½ in (R802.4.2).
What this calculator does not do: size the rafters
It gives geometry, not strength. Whether a 2x8 can span 12 ft depends on species, grade, snow or live load, dead load, spacing and whether a ceiling hangs from the rafters.
IRC Tables R802.4.1(1) to (8) cover a 20 psf roof live load and ground snow loads of 30, 50 and 70 psf, each with the ceiling attached or not. Spans are measured along the horizontal projection: the run, not the rafter length (2021 IRC R802.4.1; AWC). For other species, grades or loads, use the free AWC span calculator.
Check your local code, and an engineer for spans. Towns adopt different IRC editions and set their own snow and wind loads. Size rafters from your local tables, and have a design professional check spans near a table limit, cathedral ceilings, ridge beams, roofs under 3/12 and overhangs past 24 in.
What to buy
- Rafters: one board each, end rafters included, in the shortest stock length with 1 in to spare. Lumber is trimmed to at least its nominal length (PS 20-20, 5.3.2), so a 16 ft board is never short. There is little cutting waste; buy a spare or two for split or badly bowed boards.
- Lengths: Lowe's sells lumber "usually" in 8 to 16 ft (Lowe's) and lists 20 ft 2x6 to 2x12 (20 ft lumber). Past 20 ft, ask the yard or use engineered rafters.
- Ridge board: the size above, as long as the building plus the gable overhangs.
- Rafter ties or ceiling joists: at least 2x4, in the lower third of the attic, nailed per IRC Table R802.5.2 (Knox County handout; AWC).
- Collar ties, if used: upper third, at least 1x4, at most 4 ft apart; ridge straps may replace them (R802.4.6). They do not replace rafter ties.
- Hurricane ties: IRC Table R802.11 gives the uplift each rafter-to-wall joint must resist (STRUCTURE), and FEMA says toenails alone are not acceptable for uplift in high-wind regions (FEMA 499). One per rafter: 62 here.
- Sheathing and walls: see the plywood calculator and the stud calculator.
Questions people ask
How do you calculate rafter length?
Multiply the run by the slope factor. Run is half the span less half the ridge; at 6/12 the factor is 1.118. A 24 ft span gives 143.25 × 1.118 = 13 ft 4 3/16 in, plus overhang × 1.118 for the tail.
Do I subtract the ridge board?
Yes, half its thickness, measured level. A 1½ in ridge takes ¾ in off the run, about 13/16 in off a 6/12 rafter.
How deep can I cut a birdsmouth?
At most one-fourth of the rafter depth (IRC R802.7.1), keeping at least 3½ in on an overhanging rafter (R802.7.1.1). On a 2x8 that is 1 13/16 in.
What size rafter do I need for a 24 ft span?
It depends on load, species and grade: check IRC Tables R802.4.1(1) to (8) or the AWC calculator, using the run, about 12 ft, as the span.
What angle is a 6/12 roof?
26.6°. The slope factor is 1.118 (13.42 in per foot of run) and the seat cut is 63.4° off square.
Does this roof rafter calculator do hip roofs?
Only the common rafters. A hip or valley rafter takes 18.00 in per foot of run at 6/12, against 13.42 in for a common (Swanson).
Sources
- International Code Council, 2021 IRC chapter 8; its text did not load for us, so we read the copies below. CodeNotes: cutting, drilling and notching
- City of Seattle, 2021 Seattle Residential Code, chapter 8 (IRC R802.3, R802.4.1, R802.4.2, R802.4.4, R802.4.6)
- The Building Code Forum, 2021 IRC R802.6 quoted; Building Code Trainer, birdsmouth cut, R802.7.1.1
- LADBS, cutting and notching bulletin; Knox County, rafter handout (2018 IRC)
- American Wood Council, Span Tables for Joists and Rafters, span calculator, 2018 IRC changes
- STRUCTURE magazine, Wood roof detailing for wind uplift (2022); FEMA, Fact Sheet 17, connectors (Louisiana DNR copy)
- NIST, PS 20-20 American Softwood Lumber Standard
- Lowe's, nominal and actual lumber sizes, 20 ft lumber
- Swanson Tool Co., roof pitch reference, cutting a common rafter
Checked October 7, 2026. Slope factors and tables computed by Remodel Fit; metric converted from inches.