EstimationPro AI EstimationPro AI

Rafter Calculator - Free Rafter Length & Cost Estimator

Free rafter calculator. Enter building span, roof pitch, and spacing to get rafter length, lumber count, board feet, and 2026 material and labor costs instantly.

1,000+ Contractors Reviewed by Pros By EstimationPro Team
ft

Outside edge to outside edge

ft

Along the ridge line

in

Typical: 12-18 inches

Enter building span and length to see results
or

Last updated: 2026-03-10

How to Calculate Rafter Length, Count, and Cost

A rafter calculator takes the guesswork out of roof framing. You enter your building span, roof pitch, and rafter spacing, and it gives you the exact rafter length, total count, board feet, and an estimated cost for materials and labor. Whether you are framing a new garage, an addition, or a full house, getting the rafter math right before you order lumber saves trips to the yard and keeps your budget on track.

The core formula is simple geometry. Your rafter run is half the building span (for a standard gable roof). Multiply the run by the pitch ratio to get the rise, then use the Pythagorean theorem to find the rafter line length. Add your eave overhang measured along the slope, and you have the total rafter length to cut. The calculator handles all of this, plus it checks your lumber size against span tables so you do not end up with undersized rafters that will not pass inspection.

Inputs you'll need

  • Building span - Outside wall to outside wall measurement (feet)
  • Building length - Along the ridge direction (feet)
  • Roof pitch - Rise over 12 inches of run (e.g. 6/12)
  • Rafter spacing - On-center distance: 12", 16", or 24"
  • Lumber size - 2x6 through 2x12, based on span requirements
  • Eave overhang - Horizontal projection past the wall (inches)

Rafter Span Limits by Lumber Size (2026)

SPF #2 grade, 20 psf live load, 10 psf dead load

Lumber Size 12" OC Max Span 16" OC Max Span 24" OC Max Span Cost per LF
2x6 14'-6" 13'-0" 11'-0" $0.85 - $1.40
2x8 19'-0" 17'-6" 14'-6" $1.20 - $1.90
2x10 24'-0" 22'-0" 18'-6" $1.60 - $2.50
2x12 28'-6" 26'-0" 22'-0" $2.10 - $3.40

Worked examples

Example A: 24x40-ft garage, 6/12 pitch, 2x8 at 16" OC, 12" overhang

  • Rafter run = 24 / 2 = 12 ft
  • Rise = 12 x (6/12) = 6 ft
  • Rafter line length = sqrt(12² + 6²) = sqrt(180) = 13.4 ft
  • Overhang along slope = (12/12) x 1.118 = 1.1 ft
  • Total rafter length = 13.4 + 1.1 = 14.5 ft (order 16-ft boards)
  • Rafters per side = (40 / 1.333) + 1 = 31
  • Total rafters = 62
  • Material cost: 62 x 14.5 ft x $1.20-$1.90/lf = $1,078 - $1,707

Example B: 16x20-ft shed, 4/12 pitch, 2x6 at 24" OC, 6" overhang

  • Rafter run = 16 / 2 = 8 ft
  • Rise = 8 x (4/12) = 2.67 ft
  • Rafter line length = sqrt(64 + 7.11) = 8.4 ft
  • Overhang = (6/12) x 1.054 = 0.5 ft
  • Total rafter length = 8.4 + 0.5 = 8.9 ft (order 10-ft boards)
  • Rafters per side = (20 / 2) + 1 = 11
  • Total rafters = 22

Example C: 32x60-ft building, 8/12 pitch, 2x10 at 16" OC

  • Rafter run = 16 ft. Rise = 10.67 ft. Rafter length = 19.2 ft
  • Rafters per side = (60 / 1.333) + 1 = 46. Total = 92 rafters
  • Board feet per rafter = (1.5 x 9.25 x 19.2) / 12 = 22.2 BF
  • Total board feet = 2,042 BF

Need help with the rest of the roof? Use our roof pitch calculator to convert between pitch, angle, and slope factor, or the roofing calculator to estimate shingles and underlayment once your rafters are up. For the framing budget, check the framing cost calculator.

Pro tips from the field

  • Order 10-15% extra lumber. Between crown checks, bird's mouth cuts, and the inevitable mis-cut, you will need extra. On hip roofs with lots of jack rafters, go closer to 15%.
  • Crown your rafters before you cut. Sight down every board and mark the crown side. Install crown up so the rafter straightens under load instead of sagging further.
  • Cut a pattern rafter first. Cut one rafter, test-fit it on the building, verify the plumb cut, bird's mouth, and tail cut. Then use it as a template for the rest. One wrong angle on your pattern wastes 60+ boards.
  • Use a construction calculator for the bird's mouth. The seat cut depth should not exceed one-third of the rafter depth. On a 2x8, that is 2.4 inches max. Cutting deeper weakens the rafter at its most critical point.
  • Do not forget collar ties or ceiling joists. Without them, the outward thrust from the rafters will push your walls apart over time. Code requires them on most roof-framed structures. Collar ties go in the upper third of the rafter height.

Common mistakes to avoid

  • Measuring span to the center of the wall instead of outside edge to outside edge. This throws off every calculation.
  • Forgetting the overhang adds slope length, not just horizontal distance. A 12-inch overhang on a 6/12 pitch adds 13.4 inches of rafter, not 12.
  • Using the wrong span table. Span tables vary by species, grade, load, and duration factor. A southern pine #2 table will not give you the right numbers for SPF or Doug Fir.
  • Skipping the ridge board. Without a ridge board or beam, you have no nailing surface at the peak, and opposing rafters will not align properly. Most codes require it.
  • Undersizing rafters for the load. Standard tables assume 20 psf live load. If you are in snow country (40+ psf ground snow) or planning a heavy roof covering like tile, you need to upsize or tighten spacing.

How to Use This Calculator

Enter your building dimensions

Input the building span (wall to wall) and the building length along the ridge. Use outside-edge measurements from your plans or tape measure.

Select your roof pitch and rafter spacing

Choose the roof pitch (rise over run) and rafter spacing. Most residential roofs use 4/12 to 8/12 pitch with 16" or 24" on-center spacing.

Pick your lumber size and overhang

Select the rafter lumber size (2x6 through 2x12) and set the eave overhang in inches. The calculator will warn you if the span exceeds safe limits for your lumber choice.

Review your results

Get the exact rafter length, total rafter count, board feet, and a cost breakdown including lumber, hardware, and labor. Adjust your location for regional pricing.

Rafter Length Formula

Rafter Length = √(Run² + Rise²) + Overhang
Rise = Run × (Pitch ÷ 12)
Run = Building Span ÷ 2
Number of Rafters = (Building Length ÷ Spacing) + 1 per side

Where:

Run
= Horizontal distance from wall plate to ridge center (half the span)
Rise
= Vertical height from wall plate to ridge, determined by pitch
Pitch
= Roof slope expressed as rise per 12 inches of run (e.g. 6/12)
Overhang
= Eave extension beyond the wall, measured along the rafter slope
Spacing
= On-center distance between rafters (12", 16", or 24")

Free to Embed on Your Website

Add this calculator to your blog, resource page, or client portal — just copy one line of code. Your visitors get a useful tool, you get more engagement.

100% freeAuto-resizesMobile responsiveNo sign-up required
EstimationPro AI For Contractors, By Contractors

Turn Your Calculations Into a Full Estimate

Go from quick calculations to detailed, line-item estimates your clients will trust.

Photos & voice to estimate PDF proposals & schedules Regional pricing data
No credit card required Set up in under 2 minutes Trusted by contractors nationwide

Frequently Asked Questions

How do I calculate rafter length?

Rafter length is calculated using the Pythagorean theorem. Divide your building span by 2 to get the rafter run (horizontal distance). Multiply the run by the pitch ratio (rise/12) to get the rise. Then: rafter length = square root of (run squared + rise squared). Add your eave overhang (measured along the slope) for the total cut length. For example, a 24-ft span with a 6/12 pitch gives a run of 12 ft, a rise of 6 ft, and a rafter line length of about 13.4 ft.

How many rafters do I need for a gable roof?

Count the rafters per side first: divide the building length by the on-center spacing (in feet), then add 1. For a 40-ft building at 16" OC, that is (40 / 1.333) + 1 = 31 rafters per side, or 62 total for both sides of a gable roof. At 24" OC, you would need 21 per side (42 total), saving material but requiring larger lumber to handle the load.

What size lumber should I use for rafters?

Lumber size depends on span and spacing. For SPF #2 grade at 16" OC with standard residential loads: 2x6 spans up to 13 ft, 2x8 up to 17.5 ft, 2x10 up to 22 ft, and 2x12 up to 26 ft. At 24" OC, reduce those numbers by about 15-20%. Always check local building codes, as snow load, wind zones, and species grades affect allowable spans.

How much do rafters cost in 2026?

Dimensional lumber prices in 2026 run about $0.85-$1.40/lf for 2x6, $1.20-$1.90/lf for 2x8, $1.60-$2.50/lf for 2x10, and $2.10-$3.40/lf for 2x12. For a typical 24x40-ft gable at 6/12 pitch with 2x8 rafters at 16" OC, material for 62 rafters runs roughly $1,000-$1,600. Add ridge board, hardware, and framing labor ($3-8/sq ft of roof area) and the total lands between $4,500-$12,000.

What is the difference between rafters and trusses?

Rafters are individual boards cut and assembled on-site, running from the ridge board down to the wall plate. Trusses are pre-engineered, factory-built triangular frames delivered ready to set. Rafters cost $3-8/sq ft installed while trusses run $3-5/sq ft of roof plan area (installed). Rafters give you usable attic space and work better for complex roof shapes. Trusses go up faster and are stronger for long spans, but they fill the attic with web members.

How far apart should rafters be spaced?

The three standard spacings are 12", 16", and 24" on center. Most residential framing uses 16" OC, which balances strength and material cost. 24" OC saves lumber but requires larger rafters and may not meet code for heavier loads (snow country, tile roofs). 12" OC is used for heavy loads or when you want to use smaller lumber. Your local building inspector will have the final say based on your load tables.

How do I calculate board feet for rafters?

Board feet = (thickness in inches x width in inches x length in feet) / 12. For a 2x8 rafter that is 14 ft long: (1.5 x 7.25 x 14) / 12 = 12.7 board feet. Note that nominal 2x8 is actually 1.5" x 7.25". Multiply the board feet per rafter by total rafter count for your full lumber order. Add 10-15% for waste, especially on hip roofs with angled cuts.

What is a ridge board and do I need one?

A ridge board sits at the peak where opposing rafters meet. It is typically one size larger than the rafters (2x10 ridge for 2x8 rafters) and runs the full building length. Most building codes require a ridge board or ridge beam. A ridge board is a non-structural member that provides a nailing surface. A ridge beam is structural and carries the roof load, used when the roof has no ceiling joists or collar ties to resist the outward thrust.

How much overhang should I leave on my rafters?

Standard eave overhang is 12 to 18 inches, measured horizontally from the wall face. This protects siding and windows from rain. Some styles go up to 24-36 inches for deeper shade. Remember that overhang adds to your rafter length along the slope, not just horizontally. On a 6/12 pitch, a 12-inch horizontal overhang adds about 13.4 inches of rafter length. Factor this into your lumber order.

Related Articles

Why Contractors Choose EstimationPro AI

Estimates in 60 Seconds

AI generates detailed, line-item estimates from basic project details. No more hours on spreadsheets.

Accurate Pricing Data

Built on real contractor pricing and industry cost databases, updated for 2026 market conditions.

Professional Proposals

Send polished PDF estimates with your branding. Clients see a professional contractor they can trust.

Get Paid Faster

Built-in invoicing and Stripe payments. Collect deposits and progress payments directly from estimates.

Related Free Tools

Turn calculations into full estimates