Rafter Calculator

Calculate rafter count, lumber size per IBC span tables, and complete material lists with board feet

Calculate the number of rafters needed based on building length and spacing

Quick presets

ft

Total Roof Area

0 sq ft

0.0 roofing squares • Pitch multiplier: 1.054

PRO

Professional Calculator

Calculate total area for complex roofs with multiple sections

ft
ft

Total Roof Area

1,389 sq ft

Sections

2

Total Squares

13.9

Cost Breakdown

Section 1: $1,054 (76%)
Section 2: $335 (24%)

Detailed Breakdown

Section 11,054 sq ft
Dimensions40 × 25 ft (footprint: 1,000 sq ft)
Pitch4/12 (×1.054)
Section 2335 sq ft
Dimensions20 × 15 ft (footprint: 300 sq ft)
Pitch6/12 (×1.118)
Total Roof Area1,389 sq ft
Total Squares13.9
Bundles (10% waste)46
How to Use This Calculator
The Rafter Calculator helps you determine count, size, and materials in three steps:

Rafter Count tab: Enter your building length and select the rafter spacing (12", 16", or 24" on center). Choose your roof type — shed roofs have rafters on one side, gable roofs on two sides, and hip roofs on all four sides with additional hip and jack rafters. The calculator shows the exact number of common rafters needed. Remember that the first and last rafters sit at the building ends, so you always get one more rafter than the number of spaces.

Rafter Sizing tab: Enter the horizontal rafter span (half the building width for a centered ridge), roof pitch, spacing, lumber species/grade, and design snow load. The calculator references IBC/IRC 2024 span tables to recommend the minimum lumber size (2x6 through 2x12) that meets structural requirements. If your span is close to the maximum for a given size, the calculator recommends stepping up one size for safety margin.

Complete List tab: Enter all building dimensions to generate a comprehensive material list: common rafters (count, size, and individual length), ridge board (size and length), collar ties (count and size), and total board feet. This gives you everything you need for a lumber yard order.

The Formula
The rafter calculations use these formulas:

Rafter Count: Rafters per Side = (Building Length in inches / Spacing in inches) + 1 Gable Total = Rafters per Side x 2 Hip Total = Common Rafters + 4 Hip Rafters + Jack Rafters

Rafter Sizing (per IBC/IRC 2024 Table R802.4.1): Required Size determined by: Species/Grade + Spacing + Horizontal Span + Design Load Total Load = Dead Load (typically 12-20 psf) + Live/Snow Load

Typical maximum horizontal spans (SPF #2, 20 psf snow, 16" OC): 2x6: 10' 6" 2x8: 13' 11" 2x10: 17' 9" 2x12: 21' 7"

Board Feet: BF per Rafter = (Nominal Thickness x Nominal Width x Length) / 12 Total BF = (Rafter BF x Count) + Ridge Board BF + Collar Tie BF

Collar Ties: Count = Number of Rafter Pairs / 2 (minimum every other pair) Minimum size: 1x4 for spans up to 12', 1x6 for spans over 12'
Example Calculation
Example: 40' x 28' Gable Roof in Indiana — 30 psf Snow Load

Mike is building a 40-foot long, 28-foot wide garage with a 5/12 pitch gable roof in Indianapolis (30 psf ground snow load).

Step 1: Calculate rafter count
• Building length: 40 ft = 480 inches
• Spacing: 16" OC
• Rafters per side: (480 / 16) + 1 = 31
Total common rafters: 31 x 2 = 62

Step 2: Determine rafter size
• Horizontal span: 28 / 2 = 14 ft
• Species: SPF #2, 16" OC, 30 psf snow
• Per IRC Table R802.4.1: 2x10 required (2x8 max span is 12'10" at 30 psf)

Step 3: Calculate rafter length
• 5/12 pitch factor: sqrt(1 + (5/12)^2) = 1.083
• Slant length: 14 x 1.083 = 15.16 ft → Buy 16-foot 2x10s

Step 4: Complete material list
• 62 ea — 2x10x16' common rafters
• 3 ea — 2x12x16' ridge board (spliced at 40')
• 16 ea — 1x6x8' collar ties (every other pair)
Total board feet: 62 x 26.67 + 3 x 32 + 16 x 4 = 1,818 BF
Lumber cost: ~$1,818 x $0.70/BF = $1,273

Frequently Asked Questions

How do I calculate the number of rafters I need?
Divide the building length (in inches) by the rafter spacing (in inches) and add 1. For a 40-foot building (480 inches) with 16-inch spacing: 480 / 16 = 30, plus 1 = 31 rafters per side. A gable roof has two sides, so you need 62 common rafters total. Always add 1 because you need a rafter at each end. For hip roofs, the calculation is more complex because you also need 4 hip rafters and jack rafters that decrease in length toward each corner.
What is the difference between the rafter calculator and the rafter length calculator?
The rafter calculator determines how many rafters you need and what SIZE lumber (2x6, 2x8, 2x10, 2x12) is required based on span tables and building codes. The rafter length calculator determines the actual LENGTH of each rafter based on span and pitch geometry. You need both: this calculator tells you to buy sixty-two 2x10s; the rafter length calculator tells you those 2x10s need to be 16-foot boards (to yield the required 15'3" rafter length after cutting).
What size rafter do I need for a 14-foot span?
For a 14-foot horizontal span with SPF #2 lumber at 16" OC spacing and 20 psf snow load, you typically need 2x8 rafters per IRC Table R802.4.1. However, this varies by species, grade, and load. Douglas Fir-Larch #2 at 16" OC can span 14 feet with 2x8s. SPF #2 at the same spacing may require 2x10s for the same span with heavier snow loads (40+ psf). Always verify with your local building code, as some jurisdictions amend the IRC tables.
Do I need collar ties with my rafters?
Yes, collar ties (or ridge straps) are required by IRC Section R802.3.1 for roofs framed with rafters. Collar ties connect opposing rafters in the upper third of the rafter span to prevent ridge separation. They are typically 1x4 or 1x6 lumber nailed to each rafter pair with at least three 10d nails per end. Collar ties must be installed on every other rafter pair at minimum, or every 4 feet along the ridge, whichever is closer. Do not confuse collar ties with rafter ties (which are at the bottom and resist outward thrust).
How do I calculate board feet for rafters?
Board feet = (thickness in inches x width in inches x length in feet) / 12. A 2x10x16 rafter = (2 x 10 x 16) / 12 = 26.67 board feet. For 62 rafters: 62 x 26.67 = 1,653 board feet. Add the ridge board (typically one size deeper than the rafters, e.g., 2x12) and collar ties. In 2026, framing lumber is priced at approximately $0.55-0.85 per board foot for SPF #2, so 1,653 BF of rafter material costs approximately $910-1,405 for the lumber alone.

Related Calculators

Related Guides & Resources