Skip to content
Yardox

Rafter length calculator

Enter the building width and the roof pitch. Get the length of each rafter with the overhang, the ridge height, the plumb and seat cut angles and how many rafters to order.

Roof section with rafters at the entered pitch26.6°6' 0"14' 5 9/16"24 ft

Building and pitch

Outside of wall to outside of wall, across the rafters.

ft

Along the ridge. Used for the number of rafters and the roof area.

in 12

Rafters

in

Measured level from the outside of the wall to the end of the tail.

in

Half of it comes off each rafter. Enter 0 if rafters meet without a board.

in

Often 16 or 24 in, or 600 mm. Use what your span table or design says.

Rafter length with overhang14' 5 9/16"
Add this calculator to your website

Free for any website: paste this code where the calculator should appear. It keeps itself up to date, fits its height to the content and links back to the full page with the explanations.

How to use it

  1. 01Choose a gable roof (two slopes meeting at a ridge) or a shed roof (one slope from a low wall to a high wall).
  2. 02Enter the building width across the rafters and the length along the ridge, measured to the outside of the walls.
  3. 03Enter the pitch the way you have it: rise in 12, degrees, percent, or the height of the ridge above the walls.
  4. 04Set the horizontal overhang, the ridge board thickness and the rafter spacing. Read the rafter length, the cut angles and the count.

How it is calculated

A common rafter is the long side of a right triangle. The level side is the run, the upright side is the rise, and the pitch fixes the ratio between them.

Run (gable)
run = W / 2 − ridge / 2
Slope factor
k = √(1 + (rise / run)²)
Line length
L = run × k
Tail
T = overhang × k
Rafters per side
n = ⌈length / spacing⌉ + 1

The Journal of Light Construction framing workbook takes the run of a gable rafter as half the building width minus half the ridge thickness, and measures the rafter from the ridge plumb cut to the building line, without the overhang. The tail is added separately.

The slope factor is the length of rafter per unit of run. For 4/12 it is 1.054, which is the 12.65 in per foot of run printed on a framing square.

On a shed roof the run is the full width and there is no ridge board. The overhang is added at both the low and the high eave.

The calculator gives geometry only. It does not choose the lumber size or the spacing; those come from the span tables of your building code or from the design.

Worked example

A 24 ft wide garage, 6/12 pitch, 1½ in ridge, 12 in overhang

  1. Run = 144 in − 0.75 in = 143.25 in.
  2. Slope factor for 6/12 = √(1 + 0.5²) = 1.118.
  3. Line length = 143.25 × 1.118 = 160.16 in = 13 ft 4 3/16 in.
  4. Tail = 12 in × 1.118 = 13.42 in. Rafter with tail: 173.58 in = 14 ft 5 9/16 in, so a 16 ft board.
  5. Ridge height above the walls: 144 in × 0.5 = 72 in. Plumb cut 26.6°, seat cut 63.4° off square.

Getting the order right

Cut one pattern rafter first

Lay out and cut one rafter, test it at both ends of the building, then use it as the template for the rest. Walls are rarely perfectly parallel.

Measure along one line

All lengths here are along the same line on the side of the rafter. Mark that line before you lay out the cuts, so the plumb cut, the seat cut and the tail are measured from the same edge.

Check the covering before the pitch

Asphalt shingles need at least 2/12 under the IRC, with a double layer of underlayment up to 4/12. Metal, tile and membranes have their own limits in the product instructions.

Common mistakes

  • Forgetting the ridge board. Every rafter comes out half a ridge thickness too long, and the roof will not close.
  • Entering the overhang measured along the slope. The overhang here is level, from the face of the wall to the tail end.
  • Buying boards cut to the exact rafter length. The plumb cut at the top and the tail cut need extra length on the board.
  • Choosing the lumber size by eye. Rafter size depends on span, spacing, snow and dead load and comes from code span tables.

Questions

How do I calculate rafter length?

Take the run (half the building width minus half the ridge board on a gable roof), multiply by √(1 + pitch²) where pitch is rise divided by run, then add the overhang multiplied by the same factor.

What is the slope factor for common pitches?

The factor is √(1 + (rise/12)²): 4/12 gives 1.054, 6/12 gives 1.118, 8/12 gives 1.202, 12/12 gives 1.414. Multiply the run by it to get the rafter length.

How do I convert 6/12 pitch to degrees?

The angle is the arctangent of rise divided by run: arctan(6/12) = 26.6°. 4/12 is 18.4°, 8/12 is 33.7°, 12/12 is 45°.

What angle is the plumb cut?

The plumb cut is the pitch angle off square, for example 26.6° on a 6/12 roof. The seat cut of the birdsmouth is at right angles to it, 63.4° off square.

How many rafters do I need?

Divide the building length by the spacing, round up and add one for each side. A 36 ft building at 16 in on centre needs 28 per side, 56 for a gable roof.

Can this calculator tell me what size rafter to use?

No. Rafter size depends on the span, spacing, wood species and grade, and the snow and dead loads. Use the span tables in your building code or ask an engineer.

Guides on this topic

Sources

  1. [1]Cutting Common Rafters (Framing Workbook, Training the Trades). Journal of Light Construction. Run of a common rafter on a full gable roof is half the building width minus half the ridge thickness; rafter length is measured from the top plumb cut to the building line and does not include the overhang.. Checked November 10, 2026
  2. [2]Carpentry Refresher Program Manual, Topic 2: Gable Roof Components and Calculations (CC BY 4.0). Saskatchewan Indian Institute of Technologies. Slope as degrees, percent or unit rise in 12; total rise = unit rise × units of run; line length by Pythagoras; tail length = unit line length × overhang. Worked example: 4/12, 16 units of run gives 202.4 in (16 ft 10⅜ in) and 64 in of rise.. Checked November 10, 2026
  3. [3]Asphalt shingles (IRC R905.2), city building department summary. City of Hopkins, MN. Asphalt shingles only on slopes of 2:12 or more; double underlayment from 2:12 to 4:12.. Checked November 10, 2026

Formulas and sources last checked on November 10, 2026. How we calculate