Roof Framing Calculator: Formulas, Methods, and a Worked Example

Updated on 17-Jun-2026

Enter building length, width, pitch & overhang to calculate rafter length, ridge board, hip rafters, rafter count, board feet & roof area instantly.


Common: 16" or 24" OC
Typical: 1.5" (nominal 2x)
Typical: 5.5" (2x6 wall) or 3.5" (2x4 wall)
Result
Includes overhang and ridge deduction
For hip roofs; same as valley rafters
Includes both sides of roof
Total linear footage of rafter lumber
Maximum: 1/3 of rafter depth
Roof Framing Diagram

Roof Framing Calculator: Formulas, Methods, and a Worked Example

Roof framing involves calculating rafter lengths, ridge board dimensions, rafter spacing, and material quantities before any cutting begins. This guide breaks down the core formulas used in a roof framing calculator, along with a complete worked example.

1. Roof Angle (Plumb Cut Angle)

The roof angle is derived from the pitch (rise per 12 inches of run) and is the base value used in every other calculation.

Formula: θ = arctan(Pitch ÷ 12)

θ=arctan(P12)\theta = \arctan\left(\frac{P}{12}\right)

2. Common Rafter Length

The run is half the building width, adjusted for half the ridge board thickness. The rise is the run multiplied by the pitch ratio. Overhang is added along the slope.

Formula:

Run=W2-t24\text{Run} = \frac{W}{2} - \frac{t}{24}
Rise=Run×tan(θ)\text{Rise} = \text{Run} \times \tan(\theta)
Lcommon=Run2+Rise2+O/12cos(θ)L_{common} = \sqrt{\text{Run}^2 + \text{Rise}^2} + \frac{O/12}{\cos(\theta)}

3. Ridge Board Length

For a gable roof, the ridge runs the full building length. For a hip roof, it's shortened by the building width.

Formula (Gable):

Lridge=LL_{ridge} = L

Formula (Hip):

Lridge=L-WL_{ridge} = L - W

4. Hip / Valley Rafter Length

A hip rafter spans the diagonal of the square formed by two common rafter runs, so its run is the common run multiplied by √2.

Formula:

Runhip=Run×2\text{Run}_{hip} = \text{Run} \times \sqrt{2}
Lhip=Runhip2+Rise2+(O/12)×2cos(θ)L_{hip} = \sqrt{\text{Run}_{hip}^2 + \text{Rise}^2} + \frac{(O/12) \times \sqrt{2}}{\cos(\theta)}

5. Number of Rafters

Based on building length, spacing (on-center), and one extra rafter to close the run. Multiply by 2 for both roof sides.

Formula:

nside=L×12S+1n_{side} = \left\lceil \frac{L \times 12}{S} \right\rceil + 1
ntotal=2×nsiden_{total} = 2 \times n_{side}

6. Total Lumber Length & Board Feet

Total linear footage comes from multiplying rafter count by rafter length. Board feet converts that into a lumber order quantity using nominal stock dimensions.

Formula:

Total Length=ntotal×Lcommon\text{Total Length} = n_{total} \times L_{common}
BF=b×d×Total Length12BF = \frac{b \times d \times \text{Total Length}}{12}

7. Seat Cut Angle

The seat cut is complementary to the plumb cut angle.

Formula:

θseat=90-θ\theta_{seat} = 90^\circ - \theta

8. Birdsmouth Depth

Building codes typically cap the birdsmouth notch at one-third of the rafter's actual depth to preserve structural strength.

Formula:

Dbirdsmouthdrafter3D_{birdsmouth} \leq \frac{d_{rafter}}{3}

9. Roof Area

For a gable roof, total roof area is both slopes combined.

Formula:

Aroof=2×(Lcommon×L)A_{roof} = 2 \times (L_{common} \times L)

Worked Example

Let's calculate a gable roof with the following inputs: Building Width = 30 ft, Building Length = 40 ft, Pitch = 6/12, Overhang = 18 in, Rafter Spacing = 16 in o.c., Ridge Thickness = 1.5 in, Rafter Stock = 2×6.

Step 1 — Roof Angle:

θ=arctan(612)=26.57\theta = \arctan\left(\frac{6}{12}\right) = 26.57^\circ

Step 2 — Run and Rise:

Run=302-1.524=14.9375 ft\text{Run} = \frac{30}{2} - \frac{1.5}{24} = 14.9375 \text{ ft}
Rise=14.9375×tan(26.57)=7.469 ft\text{Rise} = 14.9375 \times \tan(26.57^\circ) = 7.469 \text{ ft}

Step 3 — Common Rafter Length:

Lcommon=14.93752+7.4692+18/12cos(26.57)=16.70+1.68=18.38 ftL_{common} = \sqrt{14.9375^2 + 7.469^2} + \frac{18/12}{\cos(26.57^\circ)} = 16.70 + 1.68 = 18.38 \text{ ft}

Step 4 — Ridge Board Length:

Lridge=40 ftL_{ridge} = 40 \text{ ft}

Step 5 — Number of Rafters:

nside=40×1216+1=31n_{side} = \left\lceil \frac{40 \times 12}{16} \right\rceil + 1 = 31
ntotal=2×31=62n_{total} = 2 \times 31 = 62

Step 6 — Total Lumber & Board Feet:

Total Length=62×18.38=1139.6 ft\text{Total Length} = 62 \times 18.38 = 1139.6 \text{ ft}
BF=2×6×1139.6121140 board feetBF = \frac{2 \times 6 \times 1139.6}{12} \approx 1140 \text{ board feet}

Step 7 — Seat Cut Angle:

θseat=90-26.57=63.43\theta_{seat} = 90^\circ - 26.57^\circ = 63.43^\circ

Step 8 — Birdsmouth Depth (2×6, actual depth 5.5"):

Dbirdsmouth5.53=1.83 inD_{birdsmouth} \leq \frac{5.5}{3} = 1.83 \text{ in}

Step 9 — Roof Area:

Aroof=2×(18.38×40)=1470.4 sq ftA_{roof} = 2 \times (18.38 \times 40) = 1470.4 \text{ sq ft}

So for a 30×40 ft gable roof at a 6/12 pitch, you'd need rafters roughly 18'4-5/8" long, 62 rafters total, around 1,140 board feet of 2×6 lumber, and the roof covers approximately 1,470 square feet.