Before building a gable roof or hip roof, you need to know your common rafter sizes.
Seasoned framers know how to calculate this crucial measurement no matter the project requirements thanks to millenniaold trigonometry.
To put you on par with the experts, we provide the formula carpenters use to figure out common rafter sizing and where to mark cuts.
All you need is paper, a pencil, and a scientific calculator.
It might trigger traumatic memories of high school math class, but the sheer bliss in knowing that you sized your rafters correctly is well worth it.
On this page
How Do You Calculate Rafter Length?
Get Your Measurements
To determine roof rafter length, you need to know the following four measurements:
1. Roof span – Also called the building width or rafter span, this measurement refers to the distance between the outside opposite walls.
2. Ridge board thickness – The thickness of the board where the top ends of the opposite rafters meet. Ridge boards are usually made of 2by board, so 1.5 inches is typical.
3. Roof slope – The roof rise and run, expressed by a ratio that indicates roof steepness.
4. Rafter overhang – The horizontal distance the rafter projects past the outside wall.
Plug Your Measurements Into the Rafter Length Formula
The formula we use to calculate total rafter length including the eaves is:
To calculate where the rafter meets the wall plate, which is where you mark the bird’s mouth cut, use the line length formula:
Calculate Roof Angle
Bear in mind that these formulas call for the roof “angle” expressed in degrees – not the pitch of the roof.
You can calculate the roof angle by plugging arctangent (roof slope) into a scientific calculator.
For example, a 6/12 roof slope translates to a 26.57º roof angle. We know this by entering arctangent (6/12) into a scientific calculator.
To skip this numberpunching step, refer to this table of roof angles rounded to the hundredth decimal for common roof slopes.
Roof pitch 
Roof angle 
1/12 
4.76° 
2/12 
9.46° 
3/12 
14.04°° 
4/12 
18.43° 
5/12 
22.62° 
6/12 
26.57° 
7/12 
30.26° 
8/12 
33.69° 
9/12 
36.87° 
10/12 
39.81° 
11/12 
42.51° 
12/12 
45.00° 
For Example
Let’s say you’re building a roof with the following dimensions:

Roof span: 20 feet

Ridge board thickness: 1 foot

Roof slope: 6/12

Rater overhang: 1.5 inches
First, let’s convert all measurements to the same unit. We use inches in this example.
Additionally, we need to calculate the roof angle by plugging arctangent (6/12) into a calculator.
Following these recalculations, we have the following:

Roof span: 240 inches

Ridge board thickness: 12 inches

Roof slope: 26.57º

Rater overhang: 1.5 inches
We can now send these numbers through a calculator following the rafter length calculator formula:
To see our rafter size in feet, we need to divide our inches figure by 12.
Our rafters should measure 12’ 2.75” long.
To make ample room for cuts, buy lumber at least one foot longer than the total rafter length.
Using the Pythagorean Theorem
Alternatively, you can use the Pythagorean theorem to determine rafter length.
This approach involves more steps as you first need to calculate the roof rise – the distance from the center of the span to the top of the ridge.
To determine roof rise, make a proportion between the roof slope and the rafter run (roof span + thickness of the ridge board ÷ 2) and solve for the missing variable.
You can then plug the numbers into the Pythagorean theorem formula to solve for the hypotenuse, i.e., the length of the rafter.
How Do I Figure Out How Many Rafters I Need?
The following three measurements dictate the number of rafters you need:
1. Roof length – the distance from one gableend to the other.
2. Rafter spacing – how much space separates each rafter course on the center. Typical rafter spacing ranges between 12 inches to 24 inches on center.
3. Gable overhang – the distance the end rafters project past the gable wall.
To calculate the number of rafters you need, plug these measurements into this formula.
Make sure all measurements read the same units, as in all inches or feet.
How Do I Cut My Own Rafters?
With a framing square, pencil, and tape measure, mark outlines for the plumb cut, tail cut, heel cut, seat cut, and fascia cuts on your first rafter according to your rafter length measurements.
With your cuts drawn out, you can then rev up your circular saw and put your carpentry skills to work.
Read this roof framing article for stepbystep, DIY instructions on how to outline and cut rafters.