How to Calculate Rafter Length
Find a common rafter’s length from span, pitch, ridge board thickness, and overhang using the pitch factor, with a worked example.
Last reviewed: November 11, 2026
The short answer
A common rafter’s length is its horizontal run multiplied by a pitch factor. The run is half the span, less half the thickness of the ridge board, and the factor is the square root of one plus the square of the rise per foot of run. Add the overhang to the run before multiplying.
Use the Rafter Length CalculatorWhy the rafter is longer than the run
A rafter climbs while it travels across. Its horizontal distance is the run, but the board itself follows the slope, so it is longer than the run. The steeper the roof, the bigger the difference. This is a right triangle: the run is one leg, the rise is the other, and the rafter is the hypotenuse.
Roofers describe slope as a pitch, such as 6:12, which means the roof rises 6 inches for every 12 inches of run. The rise per foot of run is the pitch divided by 12 per foot, and the rafter length per foot of run follows from the Pythagorean theorem.
Rafter length formulas
Run = span ÷ 2 − ridge board thickness ÷ 2 Pitch factor = √(1 + (pitch ÷ 12)²) Rafter length = (run + horizontal overhang) × pitch factor
All horizontal distances use the same unit. The pitch is the rise in inches per 12 inches of run.
Pitch factors to know
The factor for a 4:12 pitch is 1.054, for 6:12 it is 1.118, for 8:12 it is 1.202, and for 12:12 it is 1.414. A 12:12 roof is a 45 degree slope, and its rafter is exactly the square root of two times the run. These factors let you check any calculation quickly: at 6:12, a 10 ft run gives 11.18 ft.
Because the factor increases with pitch, a small error in the measured pitch has a larger effect on a steep roof. Measure the rise and run carefully, over a long enough distance, with a level.
Worked example: a 20-foot span at 8:12 with an overhang
A building is 20 ft wide. The roof pitch is 8:12, the ridge board is 1.5 inches thick, and the overhang is 1.5 ft measured horizontally.
- Half span: 10 ft
- Ridge allowance: 0.75 in ÷ 12 = 0.0625 ft, so run = 9.9375 ft
- Run plus overhang: 9.9375 + 1.5 = 11.4375 ft
- Pitch factor: √(1 + (8 ÷ 12)²) = 1.2019
- Length: 11.4375 × 1.2019 = 13.75 ft
Result: The rafter is about 13.75 ft, or 13 ft 9 in, measured along the top edge. Without the ridge allowance the length would be 13.82 ft, about 0.9 inch longer.
What the length does not include
The length is measured along the top edge and from the center of the ridge to the end of the tail. It does not account for the plumb cut at the ridge, the birdsmouth notch where the rafter sits on the wall plate, or a decorative tail cut. These details affect where each end of the board falls, and how much stock you need.
Rafter size, spacing, and allowable span come from span tables and local code, not from geometry. A longer span needs a larger or stronger rafter, and the choice should be made with the framing plan, an engineer’s guidance, or the code for your area.
Check your numbers
- Longer than the run
- The rafter must always be longer than the run. If not, check the pitch.
- Reverse it
- Divide the length by the factor to recover the run and compare with your half span.
- Compare to a framing square
- On site, a framing square marked at 8 and 12 shows the same slope. The tool is a check, not a replacement for geometry.
- Plan extra stock
- Rafters are cut from standard lengths. Order the next length up, and expect trimming on site.
Measuring pitch on an existing roof
If you are building new, the pitch comes from the plans. For an existing roof, you can find it from the attic by marking 12 inches of horizontal run along a level and measuring the vertical distance from the level to the underside of the rafter. That vertical distance in inches is the pitch. For example, 8 inches over 12 inches is 8:12.
Measure at a few places and compare, since framing can be uneven. Be careful on ladders and in attic spaces, and never walk on ceiling drywall between joists. If the roof is hard or unsafe to access, measure a gable end from the ground or ask a professional.
From one rafter to a roof
Once you have one rafter length, the rest of the roof follows. Multiply by the number of rafters to estimate the total length of lumber. The count is the roof length divided by the spacing, plus one, on each side of the ridge. Spacing comes from the framing plan and the span tables for your lumber.
For example, a 24 ft long roof with rafters 24 inches on center has 24 ÷ 2 = 12 spaces, so 13 rafters per side, or 26 for both sides. At 13.75 ft each, that is about 357.5 ft of lumber before trimming. This is a quantity check, and the rafter size and spacing are not decided here.
Rafter questions
What about hip and valley rafters?
They run on a diagonal and have different geometry. This method covers a common rafter on a symmetric gable roof.
Does this tell me what size lumber to use?
No. Size and spacing depend on load, span, species, and local requirements. See the references on the rafter calculator page.