SwiftTools

Roof Rafter Calculator

Enter your building length, span and pitch, and this roof rafter calculator returns the rafter length, how many rafters to cut, the ridge board and the total lumber — for a gable roof, stick-framed.

Your roof
run = span / 2 · rise = run x pitch / 12 · rafter length = sqrt(run^2 + rise^2) · cut length = rafter length + overhang x slope factor · positions per side = ceil(length / spacing) + 1 · total rafters = positions x 2

Gable-roof common rafters only — the parallel rafters from ridge to wall plate. Hip roofs need hip and jack rafters too, and manufactured trusses are a different product (see the Roof Truss Cost Calculator). This is a planning estimate: rafter size depends on span, species, grade and snow load, so confirm it against local span tables or a licensed professional before cutting or ordering.

How the roof rafter calculator works

A common rafter is a right triangle: the run is half the building span, the rise is the run times the pitch over 12, and the rafter length is the hypotenuse — the square root of run squared plus rise squared. At a 6/12 pitch the slope factor is 1.118, so every foot of run becomes 1.118 feet of rafter. The cut length adds the eave overhang, also on the slope: a 12-inch overhang at 6/12 adds 1.118 feet. The count is a layout, not a division: rafters sit at fixed on-center spacing along the building, one at each end wall, so the positions per side are the building length divided by the spacing, rounded up, plus one — then doubled for both slopes.

Worked example: a 40-foot building, 24 feet wide, at a 6/12 pitch with 16-inch spacing and a 12-inch overhang. The run is 12 feet, the rise 6 feet, and the rafter length is the square root of 144 plus 36, or 13.42 feet; with the sloped overhang the cut length is 14.53 feet. The positions per side are 40 divided by 1.333, rounded up, plus one — 31 — so the roof needs 62 rafters in total, or 69 with a 10% waste allowance, and 62 times 14.53, or about 901 linear feet of lumber. Those are the exact figures from the worked examples on the leading rafter calculators, which is the consensus this page follows.

Common mistakes: forgetting the overhang (a foot of eave per rafter is real lumber); counting one side only (a gable roof has two slopes, so the count doubles); and dividing the length by the spacing without adding one (the last bay still needs a rafter at the far end wall). Rafter size is a separate question from length: at 16-inch spacing, 2x6 suits runs up to about 10 feet, 2x8 up to 13, 2x10 up to 16 and 2x12 up to 20, depending on species, grade and snow load — always verify against your local span tables. If you want manufactured trusses instead of stick framing, the Roof Truss Cost Calculator prices that job, including its own count.

run = span / 2 · rise = run x pitch / 12 · rafter length = sqrt(run^2 + rise^2) · cut length = rafter length + overhang x slope factor · positions per side = ceil(length / spacing) + 1 · total rafters = positions x 2

Related tools

Also try the Roof Truss Cost Calculator for manufactured trusses, the Roof Pitch Calculator for the slope, and the Roofing Felt Calculator for the underlayment.

Roof rafter calculator FAQ

How many rafters do I need for a 40 ft roof?

Divide the length by the spacing, round up, add one, then double for both slopes. A 40-foot building at 16-inch spacing needs 31 positions per side, or 62 rafters; at 24-inch spacing it needs 21 positions per side, or 42 rafters. Add 10% for waste.

How do I calculate rafter length?

Use the Pythagorean theorem: run is half the span, rise is run times pitch over 12, and rafter length is the square root of run squared plus rise squared. A 12-foot run at 6/12 pitch gives a 6-foot rise and a 13.42-foot rafter, before the overhang.

What is the standard rafter spacing?

16 inches on center is the standard for most residential gable roofs; 24 inches is common for light loads and trusses, and 12 inches for heavy snow or tile roofs. Closer spacing raises the count: a 40-foot roof needs 62 rafters at 16 inches and 42 at 24.

What size rafter do I need?

At 16-inch spacing, 2x6 suits runs up to about 10 feet, 2x8 up to 13 feet, 2x10 up to 16 feet and 2x12 up to 20 feet, depending on lumber species, grade and snow load. In heavy snow areas (40+ PSF) go one size up. Always verify with local span tables.

How much overhang should rafters have?

12 to 24 inches of eave overhang is typical. The overhang is measured horizontally but cut on the slope, so a 12-inch overhang at 6/12 pitch adds about 1.12 feet to each rafter — include it, or the order comes up short.

Does this calculator work for hip roofs?

No — it counts common rafters for a gable roof only. A hip roof also needs four hip rafters (one per corner) and jack rafters whose lengths shrink toward the corners. For a hip roof, use the gable count for the main span and consult your framing plans for the hips and jacks.

Rafters or trusses — which should I use?

Rafters are stick-framed on site and leave the attic open; trusses are factory-built, cheaper per roof on simple spans, and need a crane. This calculator counts rafters; the Roof Truss Cost Calculator counts and prices trusses for the same building.