Rafter Length Calculator

Calculate rafter length, lumber sizes, and board feet from building span and roof pitch

Find rafter length from building span and pitch

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 Length Calculator gives you precise rafter dimensions and a lumber shopping list for stick-framed roofs.

Calculate Length tab: Enter the building span (wall to wall), roof pitch, eave overhang distance, and ridge board thickness. The calculator uses the Pythagorean theorem to compute the exact rafter length including the overhang tail. It also shows the birdsmouth cut depth and the total board length you need to purchase (rounded up to the next standard lumber length). Use this tab when you need the raw geometry for a single rafter.

Lumber List tab: Add the building length and rafter spacing to get a complete lumber order. The calculator computes the number of rafters (both sides), ridge board length, collar tie count and length, and total board feet. It accounts for standard lumber lengths (8, 10, 12, 14, 16 ft) and recommends the most economical cut. Use this tab when you are placing your lumber order at the yard.

Cost Estimate tab: Enter all dimensions plus your state to get a lumber cost estimate. Prices are based on 2026 national averages for #2 SPF framing lumber, adjusted by state. The calculator includes rafters, ridge board, collar ties, and a hardware allowance for hurricane ties and joist hangers.

The Formula
The rafter length calculation uses these formulas:

Run = (Building Span / 2) - (Ridge Thickness / 2) For a 24 ft span with 1.5" ridge: (24 / 2) - (1.5 / 24) = 11.9375 ft

Rise = Run × (Pitch Rise / 12) For 5/12 pitch: 11.9375 × (5/12) = 4.974 ft

Rafter Length (to ridge) = sqrt(Run² + Rise²) sqrt(11.9375² + 4.974²) = sqrt(142.50 + 24.74) = sqrt(167.24) = 12.93 ft

Overhang Length = Overhang Horizontal / cos(pitch angle) Pitch angle for 5/12 = arctan(5/12) = 22.62° 12 inches / cos(22.62°) = 12 / 0.9231 = 13.0 inches

Total Rafter Length = Rafter Length + Overhang Length 12.93 ft + 1.08 ft = 14.01 ft -> buy 14-ft lumber

Number of Rafters = ((Building Length / Spacing) + 1) × 2 ((40 / 2) + 1) × 2 = 21 × 2 = 42 rafters
Example Calculation
Example: 24 ft x 40 ft Home with 5/12 Pitch

Tom is framing a new garage addition in Michigan. The building is 24 ft wide by 40 ft long with a 5/12 pitch, 12-inch eave overhang, and 2x ridge board. He plans 24" o.c. rafter spacing with 2x8 #2 SPF.

Step 1: Calculate rafter length Run: (24 / 2) - (1.5 / 24) = 11.9375 ft Rise: 11.9375 × (5/12) = 4.974 ft Rafter length to ridge: sqrt(11.9375² + 4.974²) = 12.93 ft Overhang tail: 12" / cos(22.62°) = 13.0" = 1.08 ft Total rafter length: 12.93 + 1.08 = 14.01 ft -> buy 14-ft 2x8s

Step 2: Count rafters Rafter pairs: (40 / 2) + 1 = 21 pairs Total rafters: 21 × 2 = 42 rafters (14-ft 2x8) Ridge board: 40 ft of 2x10 (5 pieces of 8-ft, or 3 pieces of 14-ft) Collar ties (every other pair): 11 pieces of 2x4 at 8 ft

Step 3: Board feet & cost Rafters: 42 × 14 × 7.25 × 1.5 / 12 = 533 board feet Ridge: 40 × 9.25 × 1.5 / 12 = 46 board feet Collar ties: 11 × 8 × 3.5 × 1.5 / 12 = 39 board feet Total: ~618 board feet

Step 4: Estimated cost (2026)
• 42 pcs 2x8x14 @ $12.50 each = $525
• 5 pcs 2x10x8 (ridge) @ $9.80 each = $49
• 11 pcs 2x4x8 (collar ties) @ $3.75 each = $41.25
• Hurricane ties & hardware: ~$85
Total lumber: ~$700

Frequently Asked Questions

How do I calculate rafter length from span and pitch?
First, find the run: half the building span minus half the ridge board thickness. For a 24 ft span with a 1.5" ridge: run = 12 - 0.0625 = 11.9375 ft. Then use the Pythagorean theorem: rafter length = sqrt(run² + rise²). Rise = run × pitch. For a 4/12 pitch: rise = 11.9375 × (4/12) = 3.979 ft. Rafter length = sqrt(11.9375² + 3.979²) = 12.58 ft. Add the overhang length (overhang horizontal / cos(pitch angle)) for the total cut length.
What size rafter do I need for a 24-foot span?
For a 24-foot span (12-foot run per side) with a standard 4/12-8/12 pitch at 24" o.c. spacing, you typically need 2x10 or 2x12 rafters, depending on species, grade, and load. Using #2 SPF (Spruce-Pine-Fir) at 24" o.c. with 20 psf live load + 10 psf dead load, a 2x10 spans about 15 ft and a 2x12 spans about 19 ft of horizontal run. Since each rafter runs 12 ft, a 2x10 is typically sufficient. Always consult local span tables or an engineer.
Do I need collar ties or rafter ties?
Rafter ties (also called ceiling joists) are required for conventional rafter framing. They resist the outward thrust that rafters place on the walls. They must be installed in the lower third of the rafter span. Collar ties (installed in the upper third) do not resist thrust — their purpose is to prevent ridge separation in high wind. IRC code requires rafter ties on every other rafter pair at minimum, and collar ties on every other pair no more than 4 ft below the ridge.
What is the difference between a ridge board and a ridge beam?
A ridge board is a non-structural member (typically a 1x or 2x) that provides a nailing surface where opposing rafters meet. The roof structure depends on rafter ties or ceiling joists to resist outward thrust. A ridge beam is a structural member (typically 4x, 6x, LVL, or steel) that carries the vertical load of the rafters, eliminating the need for rafter ties. Ridge beams allow vaulted or cathedral ceilings but require posts at each end transferring loads to the foundation.
How many board feet of lumber do I need for rafters?
Board feet = (number of rafters × rafter length in feet × lumber width in inches × lumber thickness in inches) / 12. For a 40-foot-long building with 24" o.c. spacing, you need about 42 rafters (2 per bay × 21 bays, including the end rafters). If each rafter is 14 ft of 2x8: board feet = 42 × 14 × 7.25 × 1.5 / 12 = 533 board feet. Add the ridge board and collar ties for a complete lumber order.

Related Calculators

Related Guides & Resources