Rafter Calculator: How to Measure, Cut, and Size Rafters for Any Roof Pitch
A rafter calculator takes the guesswork out of roof framing by converting your building span, roof pitch, and overhang into exact rafter lengths, cut angles, and birdsmouth dimensions. Whether you're framing a new garage, replacing storm-damaged rafters, or building a porch roof, getting these numbers wrong means wasted lumber and trips back to the lumberyard. This guide walks through the math behind rafter calculations, shows you how cuts are laid out, and gives you the reference tables that carpenters keep in their back pocket.

What Is a Roof Rafter?
A rafter is a structural member that runs from the ridge board (or ridge beam) at the peak of the roof down to the exterior wall plate. Rafters carry the weight of sheathing, roofing material, snow loads, and wind loads down to the walls and ultimately to the foundation. On a simple gable roof, common rafters are identical and spaced evenly — typically 16 or 24 inches on center.
Rafters differ from trusses in one critical way: they're stick-framed on site, one board at a time. Trusses arrive pre-built from a factory — our truss calculatorcovers that side of the equation. Stick-framing gives you more flexibility — cathedral ceilings, complex roof shapes, small additions — but it demands accurate measurements and cut angles. One degree off on a plumb cut and the rafter won't seat against the ridge board properly. That's where the math matters.
The Rafter Length Formula
Every rafter length starts with two numbers: the run and the pitch. The run is half the building span — each rafter covers one side of the roof. The pitch is expressed as rise over 12 inches of horizontal run (a 6/12 pitch rises 6 inches for every foot of run).
The formula uses the Pythagorean theorem, packaged into a shortcut called the pitch factor:
Rafter Line Length = Run (inches) × Pitch Factor
The pitch factor for any roof is: √(rise² + 12²) ÷ 12. For a 6/12 pitch, that's √(36 + 144) ÷ 12 = √180 ÷ 12 = 1.1180. A 4/12 pitch gives you 1.0541. These factors are printed on most framing squares and in the IRC building code rafter span tables.
After calculating the line length, you make two adjustments: subtract half the ridge board thickness (because the rafter stops at the center of the ridge, not at the far edge), and add the overhang length (the tail that extends past the wall to form the eave). The overhang uses the same pitch factor — a 16-inch horizontal overhang on a 6/12 pitch adds 16 × 1.1180 = 17.89 inches of rafter material.
Worked Example: 24-Foot Span at 6/12 Pitch
Here's a real calculation for one of the most common residential scenarios — a 24-foot-wide building with a 6/12 roof pitch and 16 inches of overhang.
- Run: 24 ft ÷ 2 = 12 ft = 144 inches
- Pitch factor (6/12): 1.1180
- Line length: 144 × 1.1180 = 160.99 inches
- Ridge deduction: 1.5" ÷ 2 = 0.75" → 160.99 − 0.75 = 160.24"
- Overhang: 16 × 1.1180 = 17.89"
- Total rafter length: 160.24 + 17.89 = 178.13 inches (14' 10 1/8")
You'd buy 16-foot stock and cut to length — a 14-foot board would be just barely short. With 30 feet of ridge and 16" OC spacing, that's 24 rafters per side, 48 total. At roughly $1.45/ft for 2×8 lumber, each 16-foot rafter costs about $23.20, putting the common rafter lumber at around $1,114 before waste. Add 10% waste and you're looking at 53 boards and about $1,226.
Roof Pitch and Rafter Factors
Rafter factor tables are the fastest way to convert pitch to rafter length. If you don't know your existing roof pitch, our roof pitch calculator can determine it from rise and run measurements. Here are the factors for every standard pitch, with the rafter length per foot of run:
| Pitch | Angle | Factor | Per ft of Run | Common Use |
|---|---|---|---|---|
| 2/12 | 9.5° | 1.0138 | 12.17" | Low-slope, commercial |
| 3/12 | 14.0° | 1.0308 | 12.37" | Minimum for shingles |
| 4/12 | 18.4° | 1.0541 | 12.65" | Ranch homes |
| 5/12 | 22.6° | 1.0833 | 13.00" | Common residential |
| 6/12 | 26.6° | 1.1180 | 13.42" | Standard residential |
| 7/12 | 30.3° | 1.1577 | 13.89" | Cape Cod style |
| 8/12 | 33.7° | 1.2019 | 14.42" | Colonial, Tudor |
| 10/12 | 39.8° | 1.3017 | 15.62" | A-frame, steep |
| 12/12 | 45.0° | 1.4142 | 16.97" | 45° roof |
Notice how the jump from 4/12 to 8/12 adds roughly 14% more rafter material. On a large roof, that pitch change can add $300-500 in rafter lumber alone — before you count the extra sheathing and roofing material for the increased surface area.
Birdsmouth, Plumb, and Tail Cuts
Three cuts define every rafter. Get them right and the rafter drops into place. Miss one and it rocks, gaps, or sits crooked on the wall.
- Plumb cut (ridge cut):The angled cut at the top of the rafter where it meets the ridge board. It's cut at the pitch angle from vertical — for a 6/12 pitch, that's 26.6° off plumb. On a framing square, mark with 6 on the tongue and 12 on the blade; the tongue edge is your plumb line.
- Birdsmouth (seat + heel cut):The notch where the rafter sits on the wall plate. The seat cut is horizontal and matches the plate width (3.5" for a 2×4 wall). The heel cut is vertical. The IRC limits the birdsmouth depth to one-third of the rafter depth — on a 2×8 (7.25" actual), that's a maximum of 2.42". If your calculated heel height exceeds that limit, you need a deeper rafter.
- Tail cut: The end of the overhang, usually cut plumb so the fascia board sits flat against it. Some builders prefer a square cut or a combination cut depending on the fascia detail.
The HAP (Height Above Plate) is the vertical distance from the top of the wall plate to the top edge of the rafter, measured at the outside of the wall. If you're matching an existing roof or tying into another structure, HAP is the dimension that has to match — not the rafter length, not the pitch alone. A mismatch of even half an inch shows as a visible ridge line bump. Our framing calculator can help you plan the wall structure that your rafters sit on.
Hip and Valley Rafters
Hip roofs add complexity. A hip rafter doesn't run straight from ridge to wall — it runs diagonally to the corner at a 45° plan angle. That longer diagonal path means hip rafters are significantly longer than common rafters for the same span.
The math: a hip rafter's run is the common run times √2 (about 1.414). For our 24-foot span example with a 12-foot run, the hip run is 12 × 1.414 = 16.97 feet. The hip pitch factor also changes because the rise stays the same but the run is longer. For a 6/12 common pitch, the hip pitch factor is √(6² + 12² × 2) ÷ (12 × √2) = 1.0607.
Hip and valley rafters typically need to be one or two sizes larger than common rafters because they carry loads from both roof planes. If your common rafters are 2×8, the hip rafter is usually 2×10 or 2×12. The AWC span tables provide specific sizing guidance based on species and load conditions.
Valley rafters work the same way geometrically — they run diagonally from the ridge down into the valley between two intersecting roof planes. The length calculation is identical to a hip rafter. The difference is structural: valley rafters collect water runoff, so the framing around them needs proper flashing and adequate slope for drainage.
Rafter Sizing and Span Tables
Choosing the right rafter size isn't just about length — it's about load capacity over the span. A rafter might be long enough at 2×6 but not strong enough to carry snow loads without excessive deflection. Here are general maximum spans for #2 SPF lumber at common spacings, assuming 20 psf live load (no heavy snow):
| Lumber Size | 16" OC Max Span | 24" OC Max Span | Typical Cost/ft |
|---|---|---|---|
| 2×6 | 11'-4" | 9'-8" | $0.85-$1.10 |
| 2×8 | 15'-0" | 12'-10" | $1.30-$1.65 |
| 2×10 | 19'-2" | 16'-4" | $1.75-$2.15 |
| 2×12 | 23'-3" | 19'-11" | $2.40-$2.90 |
Snow load regions change everything. In areas with 40+ psf ground snow loads, these spans drop by 15-25%. A 2×8 that spans 15 feet in Texas might only be good for 12 feet in Minnesota. Always reference your local code — the IRC Table R802.4.1 is the starting point, but many jurisdictions have amendments for their specific climate. If you're calculating lumber volume for a materials order, our board foot calculator converts rafter counts directly to board feet and estimated costs. Once the rafters and sheathing are sized, run the numbers through our roofing calculator to estimate shingles, underlayment, and all the finish materials that go on top.
Common Rafter Mistakes That Waste Lumber
After 20+ years of seeing roof framing go wrong, these are the mistakes that cost real money:
- Forgetting the ridge deduction.Every rafter needs half the ridge thickness subtracted. Skip this on 48 rafters and each one is ¾" too long — you'll fight the fit at the ridge all day. Not a huge lumber waste, but a massive time waste.
- Measuring overhang along the rafter instead of horizontal.A 16" horizontal overhang is NOT 16 inches of rafter length — at 6/12 pitch it's 17.89" along the rafter. This mistake makes your eaves 1-2 inches short, and you can't add fascia material back once you've cut.
- Cutting the birdsmouth too deep.Exceeding the one-third depth rule weakens the rafter at its most critical point — the bearing wall. A 2×6 rafter with a 3" deep birdsmouth has lost over half its effective depth. If the birdsmouth math doesn't work, go up a lumber size — 2×8 gives you much more room. This fix costs $50-100 extra in lumber; a structural failure costs thousands.
- Using the wrong pitch factor for hip rafters.Hip rafters don't use the common rafter pitch factor. They use a different factor because the run is diagonal. Using the common factor makes every hip rafter 2-4 inches short. Two ruined 2×12×20' boards at $53 each is $106 in the dumpster.
- Not accounting for lumber sizes.A "2×8" is actually 1.5" × 7.25". Every birdsmouth, HAP, and ridge height calculation uses actual dimensions, not nominal. Using 8" instead of 7.25" throws off your ridge height by ¾" — visible and sloppy.
When to Use This Calculator
- Before ordering lumber — get exact rafter lengths to determine the minimum stock length, then multiply by your rafter count plus waste. Buying 16-footers when 14-footers would do wastes $2-4 per rafter.
- Setting up cuts on a pattern rafter — use the plumb cut angle, birdsmouth dimensions, and tail length to mark your first rafter accurately. Once that pattern is verified, duplicate it for the remaining rafters. Use our construction calculator to estimate the rest of your building materials alongside the rafter order.
- Comparing roof designs— switch between pitch values to see how rafter length, material cost, and cut angles change. A jump from 4/12 to 6/12 adds about 6% more rafter length but dramatically changes the roof's appearance and attic space.
- Verifying hip and valley rafter lengths — the diagonal geometry catches a lot of experienced framers off guard. Let the calculator handle the √2 factor and the adjusted pitch factor so you can focus on the cuts.
- Understanding rise-and-run geometry — the same Pythagorean math that sizes rafters also drives stair stringer layout. If you're framing stairs in the same project, our stair calculator uses identical rise/run principles to compute riser heights, tread depths, and stringer lengths with IRC code compliance checks.
