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)
⚠️ Results are for informational purposes only. Verify against applicable codes and manufacturer specifications before use. Always consult a licensed electrician/HVAC contractor and your local AHJ (Authority Having Jurisdiction) before performing work.
Guides are drafted with AI assistance and reviewed by our editors.
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.
- Run = 24 / 2 = 12 ft
- θ = atan(6/12) = 26.57°
- cos θ = 0.8944
- Common rafter (line) = 12 / 0.8944 = 13.42 ft (13 ft 5 in)
- Overhang run = 12 in / 12 = 1.0 ft → overhang slope length = 1.0 / 0.8944 = 1.12 ft
- Common rafter incl. overhang = 13.416 + 1.118 = 14.53 ft
- Hip / valley rafter = 13.42 × √2 = 18.97 ft
- 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)