BuildingFigures

Rafter Length Calculator

Enter the building width and roof pitch in feet or metres. You get each rafter's length to the nearest ⅛ in (or millimetre), the birdsmouth cut with a code check, the ridge height, a step-by-step marking guide, the board length to buy, and how many rafters the roof needs.

Quick answer: rafter length = run × √(1 + (pitch ÷ 12)²), where the run is half the building width minus half the ridge board. A 24 ft wide 6/12 roof with a 1 ft overhang needs rafters 14 ft 5⅝ in long, so buy 16 ft boards, and cut the plumb cut at 26.6°.

The rafter updates as you type.

Your roof
Outside wall to outside wall.
Inches of rise per foot. 6 means 6/12.
Pitch given as
Level distance past the wall.
A 2x board is 1½ in thick.
Birdsmouth and heights
Rafter size
Real depth: a 2×8 is 7¼ in. 0 skips the birdsmouth.
2×4 wall 3½ in, 2×6 wall 5½ in.
Floor to top of the wall plate, for the ridge height. 0 skips it.
Rafter count
Along the ridge. Leave 0 to skip the count.
Rafter spacing (on center)
Cost

Your rafters

​rafter length, with overhang
​

Lengths

Wall to ridge
​
Overhang tail
​
Run
​
Rise to peak
​

Cuts

Plumb cut
​
Seat cut
​
Slope factor
​

Birdsmouth

Seat
​
Heel cut
​
Notch depth
​
HAP
​

Heights

Ridge above wall plate
​
Ridge above floor
​
Tail plumb cut
​

Order

Rafters
​
Board length
​
Cost
​

Mark and cut one rafter

    Show my calculation

      Download PDF opens your browser's print window. Choose "Save as PDF" as the printer.

      Planning estimate for common rafters on a simple gable roof. Rafter size, spacing, birdsmouth depth and connections are set by your local building code and loads. Check with your building department, and measure the real building before cutting.

      How the rafter length is worked out

      A common rafter is the long side of a right triangle. The level side is the run and the upright side is the rise.

      1. Run: half the building width, minus half the ridge board thickness, because each rafter stops at the face of the ridge.
      2. Slope factor: √(1 + (pitch ÷ 12)²). For a 6/12 roof that's √1.25 = 1.118.
      3. Rafter length: run × slope factor, measured from the outside of the wall to the ridge.
      4. Overhang tail: the level overhang × slope factor, added to the end of the rafter.

      Lengths here are measured along the top edge of the rafter on the line from wall to ridge. Leave a little extra and trim the tail on site, since walls and ridge boards are rarely exactly on plan.

      Rafter length by roof pitch

      Slope factor, angle and rafter length for a 12 ft run
      PitchAngleSlope factorRafter for a 12 ft run
      3/1214.0°1.03112 ft 4⅜ in
      4/1218.4°1.05412 ft 7¾ in
      5/1222.6°1.08313 ft
      6/1226.6°1.11813 ft 5 in
      7/1230.3°1.15813 ft 10¾ in
      8/1233.7°1.20214 ft 5⅛ in
      9/1236.9°1.25015 ft
      10/1239.8°1.30215 ft 7½ in
      12/1245.0°1.41416 ft 11⅝ in

      Multiply your own run by the slope factor for any pitch in the table.

      Birdsmouth cut: seat, HAP and the code limit

      The birdsmouth is the notch that lets the rafter sit flat on the wall plate. Its seat is level and usually as wide as the plate. Its heel is plumb and sits against the outside of the wall. The rafter left above the seat is the HAP (height above plate).

      • Heel cut = seat × pitch ÷ 12
      • Notch depth (square to the rafter edge) = seat × sin(roof angle)
      • HAP = rafter depth ÷ cos(roof angle) − heel cut

      The 2021 IRC limits notches at the ends of a rafter to one-fourth of its depth (R502.8.1, applied to rafters by R802.7.1) and asks for at least 1½ in of bearing on wood (R802.6). The calculator checks both and gives the largest seat that keeps the notch within a quarter of the depth. The table shows that largest seat:

      Largest birdsmouth seat that keeps the notch within one-fourth of the rafter depth
      Rafter4/126/128/1212/12
      2×6 (5.5 in)4¼ in3 in2⅜ in1⅞ in
      2×8 (7.25 in)5⅝ in4 in3¼ in2½ in
      2×10 (9.25 in)7¼ in5⅛ in4⅛ in3¼ in
      2×12 (11.25 in)8⅞ in6¼ in5 in3⅞ in

      Where the table is below the plate width, the rafter bears on only part of the plate. Below 1½ in, use a deeper rafter or a different bearing detail. Some codes and inspectors treat birdsmouth cuts differently, so check locally.

      Worked example

      A garage 24 ft wide and 30 ft long, 6/12 pitch, 1 ft overhang, 1½ in ridge board, rafters 16 in on center:

      • Run: 24 ÷ 2 − 1½ in ÷ 2 = 11 ft 11¼ in
      • Slope factor: √(1 + 0.5²) = 1.118
      • Wall to ridge: 11 ft 11¼ in × 1.118 = 13 ft 4⅛ in
      • Overhang: 1 ft × 1.118 = 1 ft 1⅜ in, total 14 ft 5⅝ in, so buy 16 ft boards
      • Cuts: plumb 26.6°, seat 63.4°
      • Count: 360 in ÷ 16 in = 22.5 → 23 spaces + 1 = 24 per side, 48 rafters
      • Birdsmouth on a 2×8 with a 3½ in seat: heel 1¾ in, notch 1⅝ in deep (22% of the depth), HAP 6⅜ in
      • Ridge: 6 ft 6 in above the wall plate, 14 ft 6 in above the floor on 8 ft walls

      Common questions

      How do you calculate rafter length?

      Multiply the run by the slope factor: rafter length = run × √(1 + (pitch ÷ 12)²). The run is half the building width minus half the ridge board. A 24 ft wide 6/12 roof with a 1½ in ridge has an 11 ft 11¼ in run, so each rafter is 13 ft 4⅛ in from the wall to the ridge, plus 1 ft 1⅜ in for a 1 ft overhang: 14 ft 5⅝ in in total.

      How many rafters do I need?

      Divide the building length in inches by the spacing (16 or 24 in on center), round up and add one for the end. Do that for each side of a gable roof. A 30 ft building at 16 in on center needs 24 rafters per side, 48 in total.

      What angle do I cut a rafter?

      The plumb cut at the ridge is cut at the roof's pitch angle: 26.6° for a 6/12 roof. The seat cut, where the rafter sits on the wall, is square to it at 63.4°. On a rafter square, set the common scale to the rise (6 for 6/12) to mark the plumb line.

      How deep can a birdsmouth cut be?

      The IRC (2021, R502.8.1, which R802.7.1 applies to rafters) limits notches at the ends of a member to one-fourth of its depth, and R802.6 needs at least 1½ in of bearing. On a 2×8 (7¼ in deep) at 6/12, a 3½ in seat cuts 1⅝ in deep, 22% of the rafter, which is within the limit. Codes and inspectors can treat birdsmouth cuts differently, so check with yours.

      What is HAP on a rafter?

      HAP is the height above plate: the plumb distance from the birdsmouth seat up to the top edge of the rafter. It is the same on every rafter, so it keeps the roof plane flat. A 2×8 at 6/12 with a 3½ in seat has a HAP of 6⅜ in.

      How do I convert roof pitch from degrees?

      Rise per 12 = 12 × tan(angle). A 30° roof is 6.93/12 and a 45° roof is 12/12. The calculator accepts pitch as X/12, degrees or the total rise.

      What size lumber should I use for rafters?

      That depends on the span, the rafter spacing, the wood species and grade, and the snow and dead loads where you live. Rafter span tables in your local building code set it, so this calculator gives lengths and angles but does not size the lumber.

      Which board lengths can I buy?

      Dimensional lumber is usually stocked from 8 to 24 ft in 2 ft steps. The calculator picks the shortest of those that fits. Longer rafters usually mean engineered lumber or a different roof design, so ask your supplier.

      Sources