Rafter Calculator

A rafter calculator finds rafter length as run ÷ cos(arctan(pitch ÷ 12)), so a 12 ft run at a 6/12 pitch needs a 13.42 ft rafter before overhang and ridge cuts.

Rafter length13.42 ft
Angle26.6°

This rafter calculator gives you the length of a common rafter from its horizontal run and the roof pitch. Enter the run in feet and the pitch as inches of rise per 12 inches of run. You get the rafter length along the slope and the roof angle in degrees.

The result is the theoretical length from the outside of the wall to the ridge. It does not include the overhang, and it assumes you have already adjusted the run for the ridge board. Both steps are shown below.

The rafter length formula

A rafter, its run, and its rise form a right triangle. The pitch sets the angle of that triangle, and the angle turns run into slope length:

  • Angle = arctan(pitch ÷ 12)
  • Rafter length = run ÷ cos(angle)

There is a second form that framers use with a speed square or a framing square. It gives the same answer:

  • Rafter multiplier = √(pitch² + 12²) ÷ 12
  • Rafter length = run × rafter multiplier

The rafter length calculator above uses the first form. A third way, using Pythagoras directly, also matches: rafter = √(run² + rise²), where rise = run × pitch ÷ 12.

Rafter length multiplier by pitch

Multiply your run in feet by the multiplier to get rafter length in feet. The middle column is the “length per foot of run” printed on a framing square’s common-rafter table.

Pitch Angle Rafter length per foot of run Multiplier
1/12 4.8° 12.04 in 1.003
2/12 9.5° 12.17 in 1.014
3/12 14.0° 12.37 in 1.031
4/12 18.4° 12.65 in 1.054
5/12 22.6° 13.00 in 1.083
6/12 26.6° 13.42 in 1.118
7/12 30.3° 13.89 in 1.158
8/12 33.7° 14.42 in 1.202
9/12 36.9° 15.00 in 1.250
10/12 39.8° 15.62 in 1.302
11/12 42.5° 16.28 in 1.357
12/12 45.0° 16.97 in 1.414

The same multipliers convert a roof’s flat footprint to its sloped area, which is why the roof area calculator uses them too.

Worked examples

All numbers below come from the rafter calculator’s own formula.

Example 1: the default, a 12 ft run at 6/12

  • Angle: arctan(6 ÷ 12) = 26.6°
  • Rafter length: 12 ÷ cos(26.6°) = 13.42 ft
  • Check with the table: 12 × 1.118 = 13.42 ft

Example 2: a 24-foot garage with a ridge board and a 12-inch overhang

The building is 24 ft wide outside the walls, the pitch is 6/12, the ridge board is a 1½-inch-thick 2×10, and the eaves overhang 12 inches level.

  1. Half the span: 24 ÷ 2 = 12 ft
  2. Ridge deduction: half of 1½ in = ¾ in = 0.0625 ft. Run = 12 − 0.0625 = 11.9375 ft
  3. Wall-to-ridge rafter: enter 11.9375 ft at 6/12 → 13.35 ft
  4. Overhang: enter a 1 ft run at 6/12 → 1.12 ft
  5. Total rafter: 13.35 + 1.12 = 14.47 ft (about 14 ft 5⅝ in)

Buy 16-foot boards. That leaves about 1½ feet for the plumb cut at the ridge and for squaring the tail.

Example 3: a 28-foot house at 8/12 with an 18-inch overhang

  1. Run: 28 ÷ 2 = 14 ft, minus ¾ in for a 1½-inch ridge = 13.9375 ft
  2. Wall-to-ridge rafter: 13.9375 ft at 8/12 → 16.75 ft, angle 33.7°
  3. Overhang: a 1.5 ft run at 8/12 → 1.80 ft
  4. Total: 16.75 + 1.80 = 18.55 ft

An 18-foot board is short by more than half a foot, so this roof needs 20-foot rafter stock. That jump from 18 to 20 feet is common at steeper pitches.

How to measure run and pitch

Run. Measure the building’s width from the outside face of one wall to the outside face of the other, then halve it. For a shed roof (one slope only), the run is the full width minus the thickness of the ledger or beam it hangs from at the top. Measure the overhang separately, level, from the face of the wall to where the fascia will sit.

Pitch. If you are matching an existing roof, hold a level against the underside of a rafter in the attic, mark 12 inches along it, and measure straight up to the rafter. That number is the pitch. The roof pitch calculator converts any rise and run you measure into x/12, degrees, and percent. For new work, pitch usually comes from the plans or from your roofing material’s minimum slope.

Ridge board, birdsmouth, and tail: the three cuts

The calculator gives a centerline length. The board you cut has three more features the formula does not show.

  1. Ridge plumb cut and the ridge deduction. Rafters on opposite sides meet at the center of the ridge, but the ridge board takes up space. Subtract half its thickness from the run, measured level. For a 1½-inch ridge, that is ¾ inch of run, which becomes ¾ × 1.118 = 0.84 inch along the slope at 6/12, or ¾ × 1.202 = 0.90 inch at 8/12. Cut the top of the rafter plumb (vertical when installed) at the pitch angle.

  2. Birdsmouth. This is the notch that lets the rafter sit flat on the wall’s top plate. It has a level seat cut and a plumb heel cut. The seat cut is usually as wide as the top plate, 3½ inches on a 2×4 wall or 5½ inches on a 2×6 wall. A common framing rule of thumb is to leave at least two-thirds of the rafter depth above the seat cut, so do not notch too deep on shallow rafters.

  3. Tail cut. The overhang ends with a plumb cut for the fascia, a level cut for the soffit, or both. Lay this out after the birdsmouth so the overhang length is measured from the heel cut. Sizing the soffit underneath is easier with the soffit calculator.

Cut one rafter, test it in place at both ends, then use it as the pattern for the rest.

Rafters vs. trusses

Stick-framed rafters work well for sheds, garages, additions, vaulted ceilings, and any roof that needs open attic space. For long, simple gable roofs, pre-engineered trusses are often faster and come with stamped engineering. The roof truss calculator counts how many you need along a wall. Hip roofs need a different set of rafter lengths (hip, jack, and common), covered by the hip roof calculator.

Common rafter mistakes

  • Using the full span as the run. On a gable roof the run is half the span. Entering 24 ft for a 24-ft-wide building gives a 26.83-ft rafter at 6/12, double the real answer.
  • Forgetting the overhang. The calculator stops at the wall. Add the overhang as its own run at the same pitch.
  • Skipping the ridge deduction. It is under an inch per rafter, but it accumulates into a ridge that sits high and rafters that will not seat.
  • Measuring run along the slope. Run is always level. Measuring along the existing roof surface gives you rafter length, not run.
  • Sizing depth from length alone. Rafter size depends on span, spacing (16 or 24 in on center), dead load, snow load, and lumber species and grade. Use the IRC rafter span tables (R802.4.1) or an engineer.
  • Ordering exact lengths. Lumber comes in 2-foot increments. Round the total up and price it with the board foot calculator.

This rafter calculator gives geometric length only. Rafter sizing, spacing, connections, and uplift ties must meet your local building code. Confirm the design with your building inspector or a structural engineer before ordering lumber.

Embed this calculator on your site

Free to use. Paste this into your page's HTML. Please keep the link under the calculator.

Frequently asked questions

How do I calculate rafter length?

Multiply the horizontal run by the rafter multiplier for your pitch, which is √(pitch² + 144) ÷ 12. A 6/12 roof has a multiplier of 1.118, so a 12-foot run needs a 12 × 1.118 = 13.42-foot rafter from the outside of the wall to the ridge centerline. This is the same as run ÷ cos(arctan(pitch ÷ 12)).

What is the run of a rafter?

Run is the level, horizontal distance the rafter covers, from the outside face of the wall to the ridge. On a symmetrical gable roof it is half the building's width. A 24-foot-wide house has a 12-foot run, minus half the ridge board's thickness if you want the exact cut length.

How do I account for the ridge board?

Subtract half the ridge board's thickness from the run before calculating. A 1½-inch ridge takes ¾ inch off the run, turning a 12-foot run into 11.9375 feet. At 6/12 that shortens the rafter from 13.42 feet to 13.35 feet, about ⅞ inch along the slope.

Does the rafter calculator include the overhang?

No. It returns the length from wall to ridge. Run the overhang separately as its own horizontal run at the same pitch and add the two. A 12-inch level overhang at 6/12 adds 1 × 1.118 = 1.12 feet of rafter, so a 13.35-foot rafter becomes 14.47 feet and you buy 16-foot stock.

What size lumber should I buy for rafters?

Round the total rafter length (wall-to-ridge plus overhang) up to the next stock length (12, 14, 16, 18, or 20 feet), leaving a few inches for the plumb cut at the ridge and the tail cut. Rafter depth (2×6, 2×8, 2×10) depends on span, spacing, snow load, and species, so use the IRC rafter span tables or an engineer.

How deep can the birdsmouth cut be?

A common framing rule of thumb is to keep at least two-thirds of the rafter's depth above the seat cut, so on a 2×8 (7¼ inches deep) the notch should go no deeper than about 2⅜ inches measured square to the edge. The seat cut should bear fully on the wall's top plate, typically 3½ inches on a 2×4 wall.

Estimates only. Verify quantities with your supplier before purchasing.