Renovimo
Builder looking up at the bare rafters and ridge of a timber roof frame against a blue sky

Engineering calculator

Gable roof and rafter calculator

A common rafter is half the building width times the pitch multiplier, plus the overhang: on a 24 ft wide house at 6 / 12, 13 ft 5 in from the wall to the ridge center and 14 ft 6 7/16 in with a 12 in overhang, cut from a 16 ft board. Enter your roof and get every cut, the rafter count, the ridge board, ties and sheathing, checked against the 2021 IRC, drawn and framed in 3D.

Enter your roof

The building and the pitch

Width is the wall the rafters span, outside to outside; the ridge runs along the length. Overhangs are measured level.

The framing

Pick the rafter size from IRC Tables R802.4.1(1)–(8) for your lumber, snow load and dead load; this page cuts and counts it, it does not size it.

More in this series

The pitch sets every other number on a roof. Start there if you have not measured it yet.

Carpenter cutting a board beside a miter saw in front of a timber frame going up

Based on your result

What you'll need

Cut one rafter, try it at both ends of the building against the ridge board and the plate, and only then use it as the pattern for the rest.

Rafters
Commons for both sides plus the barge rafters on the rakes
Calculate above
Ridge board
At least as deep as the rafter plumb cut (R802.3)
—
Ceiling joists or rafter ties
One beside each rafter pair, in the bottom third of the rafter height
—
Hurricane ties Amazon
If required by R802.11: one per rafter end on each wall
—
Ridge straps or collar ties Amazon
If used: every 4 ft in the upper third (R802.4.6)
—
Roof sheathing, 4 × 8
Roof area plus 10 % for cutting
—
Rafter square Amazon
Marks the plumb and seat cuts from the pitch scale
1
Framing nails Amazon
Per the fastening schedule, IRC Table R602.3(1)
As needed

As an Amazon Associate I earn from qualifying purchases.

The maths

How this rafter calculator works

Every cut on a common rafter comes from three numbers: the run, the pitch and the board's depth. The rafter's top edge is the measuring line; the birdsmouth and the plumb cuts are laid out from it.

run = span ÷ 2 · k = √(1 + (pitch ÷ 12)²)
line = run × k
tail = overhang × k
board = (run − ½ ridge + overhang) × k + depth × pitch ÷ 12
heel = seat × pitch ÷ 12 · notch ≤ depth ÷ 4
rafters = (length ÷ spacing, rounded up + 1) × 2
sheets = roof area × 1.10 ÷ 32
  1. 01

    Line length

    Half the span is the run; times the pitch multiplier it is the rafter's top edge from the outside of the wall to the ridge center. 12 ft at 6 / 12: 12 × 1.118 = 13 ft 5 in.

  2. 02

    Ridge and plumb cut

    The ridge board sits between the rafters, so each one stops half its thickness short of the center, measured level: ¾ in for a 1½ in ridge. The plumb cut is the pitch angle off square, 26.57° at 6 / 12.

  3. 03

    Birdsmouth

    The seat sits level on the top plate and the heel is plumb at the wall line. The notch, square to the board edge, is held to a quarter of the depth (R802.7.1 and R502.8.1). With an overhang, R802.7.1.1 governs instead — at least 3½ in of rafter must remain above the notch — and this page still holds the notch to ¼ depth, which is conservative for a cantilevered rafter.

  4. 04

    Tail and board

    The overhang times the multiplier is the tail. The plumb cuts make the board longer than its top edge by the depth × pitch ÷ 12, so a 2 × 8 rafter at 6 / 12 needs 14 ft 9 3/16 in of board — a 16 ft length.

  5. 05

    Count and the rest

    One rafter at each gable wall and one every spacing in between, on both sides; a ridge board as long as the roof; a tie beside each rafter pair; sheathing for the roof area plus 10 % for cutting; and, where R802.11 requires them, a hurricane tie at every rafter end.

Rafter length calculator

Rafter length calculator: what each number means

Line length
From the outside of the wall to the ridge center, along the rafter's top edge. This is the figure framing squares and rafter tables give.
Tail
From the wall line to the plumb fascia cut, along the top edge. It is the cantilever the code limits to 24 in measured level (R802.7.1.1).
Board length
The whole piece from the long point of the tail cut to the long point of the ridge cut. Buy the next stock length up.
Height above plate (HAP)
The depth of rafter left above the wall at the heel. It sets the height of the whole roof, so every rafter must have the same one.

Good to know

Gable roof calculator questions

Halve the building width for the run and multiply it by the pitch multiplier, √(1 + (pitch ÷ 12)²). On a 24 ft wide house at 6 / 12 that is 12 ft × 1.118 = 13 ft 5 in from the wall to the ridge center. Add the overhang the same way (12 in × 1.118 = 1 ft 1 7/16 in), take half the ridge board off the top, measured level, and add the depth × pitch ÷ 12 for the plumb cuts to get the board: 14 ft 9 3/16 in for a 2 × 8, cut from a 16 ft length.

One at each gable wall and one every spacing in between, on both sides. A 40 ft long roof at 16 in on center takes 31 a side, 62 in all, plus four barge rafters when the roof overhangs the gables.

The 2021 IRC sends rafter notches to Section R502.8.1, which allows a notch at the end of a member up to one-fourth of its depth (R802.7.1). Where the rafter overhangs the wall, R802.7.1.1 governs: at least 3½ in of rafter must remain above the notch and the cantilever may be no longer than 24 in. This page also holds the notch to ¼ depth (R502.8.1), which is conservative for a cantilevered rafter.

At least 1 in nominal thick and no shallower than the cut end of the rafters (R802.3). A 2 × 8 rafter at 6 / 12 has a plumb cut of 8 1/8 in, so the ridge must be a 2 × 10.

Yes, or the ridge must be a beam designed by an engineer. Ceiling joists that run with the rafters belong in the bottom third of the rafter height (R802.5.2); where they don't, 2 × 4 or larger rafter ties at no more than 24 in on center tie the rafters across the building (R802.5.2.2).

Where collar ties are used, they go in the upper third of the attic, at least 1 × 4 and no more than 4 ft on center. A ridge strap of at least 1¼ in × 20 gage may replace them, nailed to the top edge of each rafter with three 10d common nails (R802.4.6).

That depends on the lumber species and grade, the spacing, your ground snow load, the dead load and whether a ceiling hangs from them, and comes from IRC Tables R802.4.1(1)–(8). This calculator does not size rafters; it cuts and counts the size you choose.

Rafters must resist uplift per Table R802.11 (R802.11). Nailing alone is allowed where the uplift is 200 lb or less per rafter, or where the wind speed is 115 mph or less in Exposure B with a pitch of 5 / 12 or more, a span of 32 ft or less and rafters at 24 in or closer. Everywhere else, use a connector at every rafter end.

For your website

Run a contractor, supply or DIY site? Put this gable roof and rafter calculator on your own page for free — it works the same as here and updates on its own.

Keep estimating