Rafter Calculator

Work out common rafter length for a gable roof from the span, pitch and overhang, with the roof angle, ridge height, board length and rafter count.

Outside of wall to outside of wall.
6 means 6 in of rise for every 12 in of run.
Measured level, from the wall out to the tail.
1 ½ in for a 2× ridge board.
Along the ridge, to count the rafters.

Result

Rafter length14 ft 5 9/16 in13 ft 4 3/16 in wall to ridge + 13 7/16 in overhang, along the slope.
Board to buy16 ftLeaves at least 6 in for the end cuts.
Roof angle26.6°Set a speed square to 6 on the common scale for the plumb cuts; on a miter saw they are a 26.6° miter.
Ridge height above the wall plates5 ft 11 ⅝ inRun 11 ft 11 ¼ in per side; slope factor 1.118.
Rafters4824 per side at 16 in on center, with one at each gable end.

How the calculator works

Enter the building's span from the outside of one wall to the outside of the other, the roof pitch as rise per 12 inches of run, the level overhang and the ridge board thickness.

  1. Run: span ÷ 2 − ridge thickness ÷ 2. The rafter stops at the face of the ridge board, not its center.
  2. Slope factor: √(1 + (pitch ÷ 12)²).
  3. Wall to ridge: run × slope factor, along the rafter's measuring line.
  4. Overhang: level overhang × slope factor.
  5. Rafter length: wall to ridge + overhang. The board to buy is the next stock length with at least 6 inches to spare for the ridge plumb cut and squaring the tail.
  6. Roof angle: arctan(pitch ÷ 12). Ridge height above the top of the walls is run × pitch ÷ 12.
  7. Rafters: (building length ÷ spacing, rounded up, + 1) × 2, one at each gable end on both sides.

Roof pitch chart

PitchAngleSlope factorRafter per foot of run
3 in 1214°1.03112 ⅜ in
4 in 1218.4°1.05412 ⅝ in
5 in 1222.6°1.08313 in
6 in 1226.6°1.11813 7/16 in
7 in 1230.3°1.15813 ⅞ in
8 in 1233.7°1.20214 7/16 in
9 in 1236.9°1.2515 in
10 in 1239.8°1.30215 ⅝ in
12 in 1245°1.41417 in

On a miter saw, the plumb cut at the ridge is a miter of the roof angle from square, and a speed square set to the pitch number on its common scale draws the same line.

Rafter length chart

With a 12-inch overhang and a 1 ½-inch ridge board. The board length leaves at least 6 inches for the cuts.

Span4 in 126 in 128 in 1212 in 12
12 ft7 ft 3 ¾ in (8 ft)7 ft 9 1/16 in (10 ft)8 ft 4 1/16 in (10 ft)9 ft 9 ¾ in (12 ft)
16 ft9 ft 5 1/16 in (10 ft)9 ft 11 15/16 in (12 ft)10 ft 8 ⅞ in (12 ft)12 ft 7 11/16 in (14 ft)
20 ft11 ft 6 ⅜ in (14 ft)12 ft 2 ¾ in (14 ft)13 ft 1 ¾ in (14 ft)15 ft 5 ⅝ in (16 ft)
24 ft13 ft 7 ⅝ in (16 ft)14 ft 5 9/16 in (16 ft)15 ft 6 9/16 in (18 ft)18 ft 3 9/16 in (20 ft)
28 ft15 ft 8 15/16 in (18 ft)16 ft 8 7/16 in (18 ft)17 ft 11 7/16 in (20 ft)21 ft 1 ½ in (22 ft)
32 ft17 ft 10 ¼ in (20 ft)18 ft 11 ¼ in (20 ft)20 ft 4 ¼ in (22 ft)23 ft 11 7/16 in (over 24 ft)

Example: a 12 × 16 ft shed at 5 in 12

The walls are 12 feet apart outside to outside and 16 feet long, the roof pitch is 5 in 12, the overhang is 12 inches and the ridge is a 2×8, 1 ½ inches thick. Rafters go 16 inches on center.

  1. Run: 144 ÷ 2 − 1.5 ÷ 2 = 71 ¼ inches.
  2. Slope factor: √(1 + (5 ÷ 12)²) = 1.083.
  3. Wall to ridge: 71.25 × 1.083 = 77 3/16 inches, or 6 ft 5 3/16 in.
  4. Overhang: 12 × 1.083 = 13 inches along the slope.
  5. Rafter length: 77 3/16 + 13 = 90 3/16 inches, or 7 ft 6 3/16 in. That leaves under 6 inches on an 8-foot board, so buy 10-foot boards, or shorten the overhang a little to use 8-footers.
  6. Ridge height: 71.25 × 5 ÷ 12 = 29 11/16 inches above the top plates, plus the height of the rafter above its seat cut.
  7. Rafters: 192 ÷ 16 = 12 spaces, so 13 rafters per side and 26 in all. At 24 inches on center it would be 18.

Tips

  • Cut one pattern rafter. Lay out the ridge plumb cut, the birdsmouth and the tail on one board, test it on both walls, then trace it for the rest.
  • Measure the span at several places. Walls are rarely perfectly parallel. Use the actual span at each rafter pair if they differ by more than ¼ inch.
  • Crown up. Sight down each board and install it with the bow, the crown, facing up so the roof load straightens it.
  • Mark with a speed square. Pivot it on the board's edge to the pitch number on the common scale and draw the plumb line.
  • Size rafters from the code tables. Span tables give the largest span for each size, spacing, species, grade and snow load.

Frequently asked questions

How do you calculate rafter length?

Take half the building span, subtract half the ridge board's thickness to get the run, then multiply the run by the slope factor, √(1 + (pitch ÷ 12)²). For an overhang, multiply its level distance by the same factor and add it. A 24-foot span at 6 in 12 with a 1 ½-inch ridge has a 143 ¼-inch run and a 160 3/16-inch rafter before the overhang.

What length rafters do I need for a 24-foot span?

At 6 in 12 with a 12-inch overhang, each rafter is about 14 feet 5 ½ inches, so buy 16-foot boards. At 4 in 12 it is 13 feet 7 ⅝ inches, also 16 feet with room for the cuts, and at 12 in 12 it is 18 feet 3 9/16 inches, which takes a 20-foot board.

What angle is a 6/12 roof pitch?

26.6 degrees. A 4/12 pitch is 18.4 degrees, 8/12 is 33.7 degrees, 9/12 is 36.9 degrees and 12/12 is 45 degrees. The angle is the arctangent of rise ÷ run, so 6 ÷ 12 = 0.5 and arctan 0.5 = 26.6°.

How far apart should rafters be?

Usually 16 or 24 inches on center, so 4-by-8 roof sheathing lands on a rafter at every edge. Rafter size depends on the span, the spacing, the wood species and grade, and the snow and dead loads, so pick it from the rafter span tables in your local building code.

What is a birdsmouth cut?

The notch near the bottom of a rafter where it sits on the wall. It has a level seat cut that rests on the top plate and a plumb heel cut against the outside of the wall. Keep it shallow; the seat only needs to bear fully on the plate, and local code limits how deep a notch can be.

What is the slope factor?

The length along the rafter for each unit of level run, √(1 + (pitch ÷ 12)²). It is 1.118 for 6 in 12, so each foot of run takes 13 7/16 inches of rafter. Framing squares print the same number in the rafter table as "length of common rafter per foot of run".

Last updated October 20, 2026.

Stair Calculator
Risers, treads, total run and stringer length from the total rise.
Board Foot Calculator
Board feet, cost and waste for a list of boards, hardwood or softwood.
Deck Board Calculator
Deck boards, linear feet, joists and screws for any deck size.
Fraction to Decimal Chart (Inches)
Every 64th of an inch as a decimal and in mm, with a two-way converter.
How to Read a Tape Measure
Tap any mark on an interactive tape to see its fraction, decimal and mm.
Plywood Calculator
Plywood and OSB sheets for subfloors, walls and roofs, with cost.