Skip to content
TradeCalc

Rafter Length Calculator — Common, Hip & Valley (IRC R802.5)

Calculate common, hip, and valley rafter lengths from the building span and roof pitch. Enter the total span (wall-to-wall) and the X:12 pitch to get line lengths, ridge height, and the hip/valley √2 factor.

By TradeCalc, Roofer Calculators — Code-Referenced — IRC R802.5 (wood rafter framing requirements), IRC Table R802.5.1(1–8) (rafter span tables by species), IRC R802.5.2 (rafter ties and ridge strap requirements)

Related Calculators

How to Calculate Rafter Length from Span & Pitch

Span, Run, and the Half-Span Rule

In roof framing, span is the total wall-to-wall distance the roof covers. The run of a common rafter is half the span, because each pair of rafters meets at the ridge and carries half the load. A 24-ft span therefore has a 12-ft run. IRC R802.5 sets the structural requirements; the geometry here is the carpenter's layout math that predates the code.

The Common-Rafter Formula

θ = atan(rise / 12)   (roof angle)

Run = Span / 2   (horizontal, in ft)

Common rafter = Run / cos θ = Run × √(12² + rise²) / 12

Hip / valley rafter = Common × √2

Ridge rise = Run × (rise / 12)

  • Span = wall-to-wall building width (ft)
  • rise = pitch rise per 12" run (in) — e.g. 6 for 6:12
  • √2 = 1.4142, the diagonal of a square plan corner (45° hip)

The √2 factor on the hip/valley rafter comes from the corner of the building being a 45° plan angle: the hip travels diagonally across a square plan, so its plan length is √2 × the run of a common rafter, and then the slope length is that plan length ÷ cos θ. The result is that the hip rafter is always 41% longer than the common at the same pitch.

Worked Example

Scenario: A 24-ft-wide garage with a 6:12 gable roof and a 12-inch rafter tail overhang. Find the common and hip rafter lengths.

  1. Run = 24 / 2 = 12 ft
  2. θ = atan(6/12) = 26.57°
  3. cos θ = 0.8944
  4. Common rafter (line) = 12 / 0.8944 = 13.42 ft (13 ft 5 in)
  5. Overhang run = 12 in / 12 = 1.0 ft → overhang slope length = 1.0 / 0.8944 = 1.12 ft
  6. Common rafter incl. overhang = 13.416 + 1.118 = 14.53 ft
  7. Hip / valley rafter = 13.42 × √2 = 18.97 ft
  8. Ridge rise = 12 × (6/12) = 6 ft

Order 16-ft 2×8 lumber for the common rafters (allows 14.54 ft + a 10% trim allowance) and 20-ft 2×10 for the hips. The hip rafter is one size deeper than the common because it carries twice the tributary roof area and is loaded in deeper bending.

Practical Tips

  • Line length is theoretical — cut longer. The calculated length is plumb-cut to plumb-cut. Add 1.5–3 in for the ridge-plumb cut seat and the birdsmouth notch before ordering stock.
  • Hip rafters run deeper. A 2×8 common usually pairs with a 2×10 or 2×12 hip, because the hip descends at a flatter pitch (its true slope is shallower than the common pitch) and carries load from two roof planes. Drop the hip bevel or back-bevel it to fit.
  • Valley rafters are cut like hips but upside down. The line-length math is identical (Run × √2 / cos θ); the difference is the valley sits in the re-entrant corner and the bevels reverse. A valley often needs a 2×12 because it can also carry water load.
  • Verify against IRC span tables. Rafter length from this calculator is geometry only. The size (2×6 vs 2×8 vs 2×10) and spacing must come from IRC Table R802.5.1(1–8) based on the species, grade, and total roof load — use the IRC Rafter Span Calculator for that.

Code References

IRC R802.5 (wood rafter framing requirements), IRC Table R802.5.1(1–8) (rafter span tables by species), IRC R802.5.2 (rafter ties and ridge strap requirements)

Frequently Asked Questions

How do you calculate common rafter length?
Divide the building span by 2 to get the run, then divide the run by cos(θ) where θ = atan(pitch_rise/12). Equivalently, multiply the run by √(12² + rise²) / 12. For a 24-ft span at 6:12: run = 12 ft, multiplier = √180/12 = 1.118, common rafter = 12 × 1.118 = 13.42 ft (13 ft 5 in). Add the overhang slope length separately.
Why is a hip rafter longer than a common rafter at the same pitch?
A hip rafter sits on the 45° corner of the building, so its horizontal plan length is √2 (1.414) times the common rafter run. The slope length is then that plan length ÷ cos θ, giving a hip that is exactly √2 × the common rafter length. At 6:12 on a 24-ft span the common is 13.42 ft and the hip is 18.97 ft — 41% longer. Hips are also typically one lumber size deeper (2×10 vs 2×8) because of the heavier tributary load.
How much overhang should I add to a rafter?
Typical residential overhangs are 12–24 inches horizontal. Convert to slope length by dividing by cos θ — a 12-in overhang on a 6:12 roof adds 12 / (cos 26.57°) = 13.4 in = 1.12 ft of rafter tail. Always add the overhang on top of the line length, plus 2–3 in for the birdsmouth and plumb cut, before ordering lumber.
What size rafter do I need for a 24-ft span?
It depends on pitch, species, spacing, and snow load. At 6:12 with 24-in o.c. spacing, a #2 Southern Pine 2×10 typically spans 24 ft per IRC Table R802.5.1, while a 2×8 of the same species tops out near 17 ft. Always verify against the IRC rafter span tables or use the IRC Rafter Span Calculator, because geometry alone does not determine structural size.