Home, DIY & Auto

Rafter Calculator

Enter the building span, the roof pitch and the overhang. The calculator gives the common rafter length along the slope, the roof angle, the rise, how many rafters you need and the stock length to buy.

Free, runs in your browserUpdated October 2026
Units
ft
Outside of wall to outside of wall.
in
in
Use 0 for trusses or no ridge board.
ft
in
On center, for example 16 or 24 in.
Rafter length with overhang
–
Ridge to wall (no overhang)–
Overhang along the slope–
Rise over the rafter run–
Roof pitch and angle–
Lumber length to buy–
Rafters (both sides)–

Rafter calculator diagram: 24 ft span at 6/12 pitch with 12 in overhang gives a 14 ft 5.57 in rafter
How the Rafter Calculator works: Common rafter length for a gable roof, overhang included.

How to Use the Rafter Calculator

How to use the rafter calculator: set units, enter span, pitch and overhang, then read the rafter length
Numbered steps on the Rafter Calculator. Follow them in order.
  1. Choose feet and inches or metres and millimetres.
  2. Enter the building span, outside of wall to outside of wall.
  3. Enter the roof pitch as rise in 12, or switch the format to degrees.
  4. Enter the horizontal overhang, then ridge thickness, length and spacing below.
  5. Read the rafter length with overhang, then the lumber length to buy and rafter count.

Measure the building span from the outside of one wall plate to the outside of the opposite wall plate. Enter it along with the roof pitch as inches of rise per 12 inches of run.

A 6/12 roof rises 6 in for every 12 in of run, or switch the pitch box to degrees and use the tool as a pitch calculator. Then add the horizontal overhang past the wall.

Enter the ridge board thickness, which is 1.5 in for a 2x ridge, plus the building length and rafter spacing on center to count rafters. Metric mode uses meters for the span and millimeters elsewhere.

Rafter Length Formula

It first finds the run, which is half the span minus half the ridge board. Half the ridge comes off each side because the rafter stops at the face of the ridge, not its center.

run = span ÷ 2 − ridge thickness ÷ 2
slope factor = √(1 + (pitch ÷ 12)²)
rafter length (ridge to wall) = run × slope factor
overhang along slope = horizontal overhang × slope factor
roof angle = arctan(pitch ÷ 12)
pitch from angle = 12 × tan(angle)

The slope factor is the Pythagorean theorem in one number: the hypotenuse of a right triangle with a run of 12 and a rise of the pitch, divided by 12. Multiply the run by it.

The same factor converts the horizontal overhang into its length along the slope, so the total rafter length includes the tail. The result is the stock length needed before trimming the plumb and tail cuts.

Worked Example: A 24-Foot Garage

Take a 24 ft wide garage with a 6/12 roof, a 1.5 in ridge board and a 12 in overhang. The run is 24 times 12, divided by 2, minus 0.75, which gives 143.25 in.

The slope factor for 6/12 is 1.1180, so the rafter from ridge to wall is 160.16 in, or 13 ft 4.16 in. The overhang adds 13.42 in, for a total rafter length of 14.46 ft.

A 16 ft board covers it with room for the cuts. The roof angle is 26.57 degrees, and the rafter rises 5 ft 11.63 in over its run, which sets the height of the ridge.

How Many Rafters You Need

Divide the building length by the rafter spacing, round up and add one for the end rafter. Do this for each side of a gable roof, then double the result to get the total count.

With a 40 ft building and rafters at 16 in on center, each side needs 480 divided by 16, plus 1, which gives 31 rafters. Both sides together need 62 rafters for the whole roof.

Spacing of 16 in on center is the usual choice for houses, while 24 in suits lighter loads and 12 in suits heavy snow. Lumber lengths are rounded up to the next 2 ft increment.

Roof Pitch to Degrees

Roof pitch is the rise in inches for every 12 inches of horizontal run. To turn it into a roof angle, take the arctangent of the pitch divided by 12, as the table below shows.

PitchAngleSlope factor
3/1214.04°1.0308
4/1218.43°1.0541
5/1222.62°1.0833
6/1226.57°1.1180
8/1233.69°1.2019
10/1239.81°1.3017
12/1245.00°1.4142

To go the other way, multiply 12 by the tangent of the angle in degrees. A 30 degree roof gives 12 times 0.5774, which is 6.93, so it is very close to a 7/12 pitch.

Shingle manufacturers set minimum slopes for their products, and low slopes often need an extra layer of underlayment. Check the bundle instructions before you choose a very shallow pitch for a new asphalt shingle roof.

Marking the Plumb Cut and Birdsmouth

Use a framing or speed square set to the pitch to mark the plumb cut at the ridge. Measure the rafter length along the top edge and mark the plumb line at the wall plate.

The birdsmouth, or seat cut, is notched so the rafter sits flat on the plate. A common guideline is to leave at least two thirds of the rafter depth above the seat cut for strength.

Make one pattern rafter, test it on both sides of the building, and only then copy it. The tail cut at the overhang end is usually plumb, so the fascia board sits vertical and straight.

Limits and Building Codes

This tool only calculates common rafters on a symmetrical gable roof. Hip, valley and jack rafters need different factors, and shed roofs use the full span as the run instead of half the building span.

Rafter size and spacing depend on span, snow load and lumber grade. In Canada, use the span tables in your provincial building code or the National Building Code, and get proper engineering for unusual roofs.

A ridge board is non-structural, while a ridge beam carries load and needs solid posts. The USDA Wood Handbook covers lumber strength and properties in depth if you need to understand sizing and grades further.

Frequently asked questions

How do I calculate rafter length?

Divide the span by 2, subtract half the ridge thickness to get the run, and multiply by the slope factor, the square root of 1 plus the pitch over 12 squared. Add the overhang times the same factor.

What angle is a 6/12 roof pitch?

A 6/12 pitch is 26.57 degrees. A 4/12 pitch is 18.43 degrees, an 8/12 pitch is 33.69 degrees and a 12/12 pitch is exactly 45 degrees, the steepest common residential roof.

How do I convert degrees to roof pitch?

Multiply 12 by the tangent of the angle. For example, 30 degrees gives 12 times 0.5774, which is 6.93, so about a 7/12 pitch. The calculator does this when you switch the pitch box to degrees.

How long should rafters be for a 24 ft span?

With a 6/12 pitch, a 1.5 in ridge board and a 12 in overhang, each rafter is about 14.46 ft long, so you would buy 16 ft lumber to leave room for the cuts.

How many rafters do I need?

Divide the building length by the spacing, round up and add one for each side. A 40 ft building at 16 in on center needs 31 rafters per side, or 62 rafters for the whole roof.

What is a birdsmouth cut?

A birdsmouth is the notch cut near the bottom of a rafter so it sits flat on the wall plate. A common guideline keeps at least two thirds of the rafter depth above the seat cut.