We believe math and science education should be free and accessible to everyone. Why education matters >

Roof Framing Calculator

Framing a roof starts with numbers: rafter length, rafter count, and ridge board dimensions. This roof framing calculator takes your building span, length, roof pitch, and overhang, then returns everything you need to order lumber with confidence. It handles both two-sided gable roofs and single-slope shed roofs, and works for additions, garages, sheds, and new construction.

Roof Framing Basics

A rafter forms the hypotenuse of a right triangle where:

  • Run = horizontal distance from outside wall to ridge (half the building span for a gable; full span for a shed)
  • Rise = vertical height gained (run x pitch/12)
  • Rafter Length = sqrt(run^2 + rise^2) + overhang rafter

Pitch is expressed as rise per 12 inches of run. A 6:12 pitch gains 6 inches of height for every foot of horizontal run (about 26.57 degrees from horizontal).

Gable vs Shed Roof Framing

Gable roofs have two opposing slopes that meet at a central ridge board. Rafters on each side connect the top plates of the exterior walls to the ridge. For a 24-ft span, each rafter has a 12-ft run (minus half the ridge board thickness).

Shed roof framing calculator use a single slope. The rafter runs the full building width, connecting a tall wall on one side to a shorter wall on the other. Sheds, lean-to additions, and modern minimalist homes frequently use shed roofs.

Worked Example

A 24x40 ft garage with a 6:12 pitch and 12-in overhang:

  • Run = 24/2 - 0.0625 = 11.94 ft
  • Rise = 11.94 x 0.5 = 5.97 ft
  • Main rafter = sqrt(11.94^2 + 5.97^2) = 13.35 ft
  • Overhang rafter = sqrt(1.0^2 + 0.5^2) = 1.12 ft
  • Total rafter length = 14.47 ft (buy 16-ft lumber)

At 16-in OC spacing on 40-ft walls: 40 x 12 / 16 + 1 = 31 rafters per side, 62 total for a gable.

Rafter Size and Spacing

Rafter dimensions depend on span, spacing, and roof load. Common sizing (at 30 PSF live load, 16 in OC):

Rafter Size Max Span
2x6 10 ft
2x8 14 ft
2x10 18 ft
2x12 22 ft

Always check your local building code and IRC span tables for your species, grade, and snow load.

Cut Angles

Plumb cuts (at the ridge and at the rafter tail) equal the roof angle from horizontal. For a 6:12 pitch: atan(6/12) = 26.57 degrees. The seat cut (birdsmouth on the wall plate) is the complement: 63.43 degrees.

Mark these cuts with a framing square set to the pitch rise (6 inches) and tongue (12 inches), or use a speed square pivoted to 26.57 degrees.

Ridge Board Sizing

The ridge board needs to be at least 1 inch deeper than the rafter depth. For 2x8 rafters, use a 2x10 ridge board. The ridge runs the full length of the building and connects opposing rafters through plumb cuts on each side.

Collar Ties and Rafter Ties

Building code requires rafter ties (horizontal members in the lower third of the rafters) to prevent the walls from spreading under roof load. Collar ties (upper third) stiffen the ridge against uplift. Plan these into your framing before starting.

Did this solve your problem?

Frequently Asked Questions

Search Calculators

Search across all calculator categories