Carpentry & roofing

Rafter Calculator

Work out common rafter length for a gable roof from the building span and roof pitch — with overhang, ridge board allowance, plumb cut angle and how many rafters to buy.

  • Free
  • No sign-up
  • Pitch, angle & cut lengths
  • Instant results
ft
in
in
in
ft

You need

0
ft rafter length incl. overhang
  • Rafter length to wall (ft)0
  • Overhang length along slope (ft)0
  • Lumber length to buy0
  • Total rise to ridge (ft)0
  • Pitch angle / plumb cut (°)0
  • Seat (level) cut angle (°)0
  • Rafters needed (both sides)0

Lengths are measured along the top edge of the rafter (line length). Size rafters with your local code span tables or an engineer.

How to calculate rafter length

  1. Measure the span — the distance between the outside faces of the bearing walls.
  2. Find the run: half the span, minus half the ridge board thickness.
  3. Multiply the run by the pitch factor (the hypotenuse of a right triangle with 12 in of run and your rise).
  4. Add the overhang, also multiplied by the pitch factor, then pick the next standard lumber length.

Rafter formula

Pitch factor = √(1 + (rise ÷ 12)²)
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

PitchAnglePitch factorRafter length per foot of run
3/1214.0°1.03112.37 in
4/1218.4°1.05412.65 in
5/1222.6°1.08313.00 in
6/1226.6°1.11813.42 in
7/1230.3°1.15813.89 in
8/1233.7°1.20214.42 in
9/1236.9°1.25015.00 in
10/1239.8°1.30215.62 in
12/1245.0°1.41416.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.

  1. International Residential Code (IRC) R802: roof framing, including rafter span tables R802.4.1(1)–(8) and rafter ties.
  2. American Wood Council, Span Tables for Joists and Rafters and the National Design Specification (NDS).
  3. Right-triangle geometry: pitch factor = √(1 + (rise ÷ 12)²); angle = arctan(rise ÷ 12).

Last updated November 12, 2026. Results are estimates; always confirm quantities with your supplier before ordering.

Related calculators

Guides for this project