Rafter Length Calculator
Table of contents
How to use the rafter length calculatorHow to calculate rafter length?How to calculate truss count and roof truss cost?FAQsNo house is complete without a sturdy roof, and to build one, you need proper roof trusses  this is exactly what this rafter length calculator will help you find! 🏠
With the help of this tool, you can calculate the dimensions of your roof trusses in no time. However, this tool is more than a simple rafter calculator! You can also use it to figure out the truss count for your roof and, while you're at it, quickly estimate the total purchase and installation costs.
Read on to see the math that underpins working out truss dimensions, find out how to calculate rafter length, and learn the rafter length formula.
PS. If you're looking for the ultimate roofing guide, check out the roofing calculator.
How to use the rafter length calculator
Our tool has two applications. You can use it as either a rafter length calculator, which estimates the dimensions of your trusses for you, or as a roof truss count calculator, which will allow you to estimate the roof truss costs as well (it even includes the price of installation).
To start your calculations, you need to choose one of the two options mentioned above. In the field above the illustration, pick either "rafter length" or "truss count".
1. If you picked rafter length:
Start by deciding what you want the calculations to be based on. You can choose the rise of the roof (which is its height) or the roof pitch (which is the slope created by the rafter). If you want to learn more about the way it's calculated, check out our roof pitch calculator.
 If you picked the rise, all you need to do is input its value, put in the roof's run, and the calculator will return the rafter length in the bottommost field.
💡 Please note that the rafter length calculator works both ways, that is, you can also use it to calculate the rise or the run! If you already know the rafter length and want to figure out any of the other dimensions, simply input the two you know, and you will get the third one.

If you decided to include roof pitch in your calculations, you will need to input the run and the pitch of the roof to get the rafter length. After doing that, you will see the rafter length in the bottommost field.
Here as well, our calculator works both ways. You can input any of the two values to calculate the third one.
You can input the roof pitch in whichever format you prefer (angle, percentage, ratio), and our tool will automatically tell you the other ones.
2. If you picked truss count:

Input the roof length and the oncenter spacing (the distance between the middles of two neighboring roof trusses), and the rafter calculator will return the number of roof trusses needed.

Our tool can also figure out the approximate roof truss cost. In the appropriate fields of the calculator, decide whether you want to include the cost of installation in the calculations.

If you pick No, the only thing left to input is the cost of a single roof truss. The rafter length calculator will return the total expenses in the bottommost field.

If you pick Yes, you will also need to declare how much per time unit the contractor would charge you to install the trusses, as well as the expected duration of the installation. As soon as you fill in all the variables, you will see the total expenses at the bottom of the calculator.

Don't worry if you're unsure what the roof's run, rise, oncenter spacing, and such exactly mean — we've prepared an illustration of the variables you need to fill out in the calculator.
✅ If, on the other hand, you only need beams running through a room (and not trusses), you can check out our wood beam span calculator to help you choose the appropriate lumber size for your beams.
How to calculate rafter length?
The rafter length calculator lets you calculate truss dimensions using two slightly different sets of variables. It all comes down to what information you already have. Usually, that is either the pitch or the rise of the roof. What is more, the formula used to calculate roof truss dimensions is one you probably know very well — it's the exact same formula you use to describe a right triangle — Pythagoras!
The formulas we use are the following:

For calculations based on the roof rise:
rise² + run² = rafter length²
meaning that:
rafter length = √(rise² + run²)

For calculations based on the roof pitch:
The formula used to calculate rafter length from roof pitch is, in fact, the same as the one above. The one difference is that we need to calculate the roof rise using the pitch first. So what you need to do first is to get the pitch using the following formula:
rise / run = pitch
expressed as a percentage, meaning that:
rise = run × pitch
We can merge these two equations to get a single rafter length formula based on the roof pitch:
rafter length² = (run × pitch)² + run²
rafter length = √((run × pitch)² + run²)
rafter length = run × √(pitch² + 1)
If you're unsure about the terms such as roof run and rise, refer to the illustration below:
How to calculate truss count and roof truss cost?
As you know, figuring out rafter length and other truss dimensions is not the only thing you can use this tool for! Our tool calculator can also help out with planning out your roof project by estimating the truss count and showing you the costs you can expect for the materials and their installation. To do so, it uses the following equations:

truss count = ((roof length × 12)/24) + 1
rounded up to the closest integer (for example, if the result is 14.5, you need to get 15 trusses). In this formula, we assume the roof length in feet and a 24" spacing between each truss.
To calculate the costs, we use the following two formulas:
Including installation costs:
total costs = truss count × single truss price + cost per time unit of work × duration of work
Excluding installation costs:
total costs = truss count × single truss price
If you're interested in more details about calculating roof truss count, visit our roof truss calculator.
If you're unsure about the terms, such as the oncenter spacing, refer to the illustrations below:
How do I calculate rafter length using pitch?
To calculate rafter length using pitch, follow these steps:

Remember that pitch is the ratio between rise and run:
pitch = rise / run
or
rise = run × pitch 
Use the rafter length formula:
rafter length = √(rise^{2} + run^{2})

Substitute the rise from step 1 into the rafter length formula:
rafter length = √((run × pitch)^{2} + run^{2})

Simplify the formula:
rafter length = run√(pitch^{2} + 1)

Substitute the known values for pitch and run to calculate the rafter length.
How do I calculate rafter length from run and rise?
To calculate rafter length from run and rise, use the rafter length formula:
rafter length = √(rise^{2} + run^{2})
For instance, for a rise = 1 ft 5 in and run=3 ft 3/8 in, the rafter length is:
rafter length = √((1 ft 5 in)^{2} + (3 ft 3/8 in)^{2})
rafter length = 3 ft 5 in
What size rafters do I need for a 12 feet span?
Assuming a 4:12 pitch, you would need a rafter that is 6 feet 4 inches long. However, If you want to consider other pitches, you can use the rafter length formula in terms of the pitch and run:
rafter length = run√(pitch^{2} + 1)
Remember that the span equals twice the run, so run = span / 2.
What are common values for roof pitches?
Roof pitches can range from 4:12 to 9:12, with ratios like 6:12 and 8:12 also being common. These ratios indicate the relationship between the horizontal distance (run) and the roof's vertical rise.
The number before the colon indicates the run and the number after the rise. For example, a 6:12 pitch means the roof rises 6 inches vertically for every 12 inches of horizontal distance (run).