How to calculate rafter length
The formula is straightforward: multiply the horizontal run by the slope factor, then add the sloped overhang. The slope factor converts a horizontal distance to a sloped distance for any roof pitch. For a 6:12 pitch the slope factor is 1.118 — every foot of run becomes 1.118 feet of rafter. Skip to the rafter calculator if you just want the number.
1. The slope factor formula
Roof pitch is expressed as rise over run — the "x" in x:12 notation means the roof rises x inches for every 12 inches of horizontal run. The slope factor is the ratio of the sloped hypotenuse to the horizontal run, calculated by the Pythagorean theorem:
Once you have the slope factor, rafter length is simply a multiplication:
common rafter = run × slope factor
overhang (sloped) = overhang (horizontal) × slope factor
total cut length = common rafter + overhang (sloped)
The “run” for a simple gable roof is half the building width — the horizontal distance from the outside of the wall plate to the centre of the ridge. For a 24-foot wide building the run is 12 feet.
2. Slope factor table for common pitches
The slope factor and the equivalent roof angle for every standard pitch from 3:12 to 12:12. These values are pure trigonometry — they are the same regardless of which building code applies in your area.
| Pitch | Slope factor | Roof angle |
|---|---|---|
| 3:12 | 1.031 | 14.0° |
| 4:12 | 1.054 | 18.4° |
| 5:12 | 1.083 | 22.6° |
| 6:12 | 1.118 | 26.6° |
| 7:12 | 1.158 | 30.3° |
| 8:12 | 1.202 | 33.7° |
| 9:12 | 1.250 | 36.9° |
| 10:12 | 1.302 | 39.8° |
| 11:12 | 1.357 | 42.5° |
| 12:12 | 1.414 | 45.0° |
Slope factor = √(1 + (rise/12)²). Angle = arctan(rise/12) in degrees.
3. Worked example — 24-foot wide building
Given: building width = 24 ft (7.3 m), roof pitch = 6:12, eave overhang = 12 in (0.3 m horizontal).
Step 1 — find the slope factor
Step 2 — calculate the run
Step 3 — common rafter length
Step 4 — sloped overhang
Step 5 — total cut length
Each rafter is cut to 14 ft 6 in (4.430 m). This is the length from the ridge plumb cut to the tail cut at the eave, including the 12-inch eave overhang.
4. Common rafter lengths at 6:12 pitch
Common rafter length (no overhang) for a 6:12 pitch roof at common building widths. Add the sloped overhang to get the total cut length for your project.
| Building width | Run | Common rafter | Metres |
|---|---|---|---|
| 20 ft (6.1 m) | 10 ft | 11 ft 2 in | 3.40 m |
| 24 ft (7.3 m) | 12 ft | 13 ft 5 in | 4.09 m |
| 28 ft (8.5 m) | 14 ft | 15 ft 8 in | 4.77 m |
| 32 ft (9.8 m) | 16 ft | 17 ft 11 in | 5.44 m |
| 36 ft (11.0 m) | 18 ft | 20 ft 1 in | 6.12 m |
| 40 ft (12.2 m) | 20 ft | 22 ft 4 in | 6.80 m |
Values computed as run × 1.118 (6:12 slope factor). Overhang not included. Verify with the rafter calculator above for your actual overhang dimension.
5. How to count rafters
Rafter count depends on the building length and the on-centre spacing. The formula for one side of a gable roof:
The ceiling function (⌈ ⌉) rounds up so there is always a rafter at each end, regardless of whether the spacing divides evenly. Double the result for both sides of the roof.
Example: 40-foot building at 16-inch (1.333 ft) spacing:
Total linear footage of rafter stock = total rafters × total cut length. For the example above: 62 × 14.534 ft = 901 linear feet. Order with a 10–15% waste allowance for plumb cuts, bird's-mouth cuts, and off-cuts.
6. What the overhang calculation includes
The horizontal overhang is the distance the rafter extends beyond the outside face of the wall framing — the eave projection. Because the rafter follows the slope, the actual sloped length of the overhang is longer than the horizontal distance. The slope factor converts one to the other:
A 12-inch horizontal overhang on a 6:12 pitch roof has a sloped length of 1 × 1.118 = 1.118 ft, or about 13.4 inches measured along the rafter. This is the length of fascia board the rafter tail supports.
The input to this calculator is the horizontal overhang — the amount the roof extends beyond the wall, measured on a level line. If your plans show the overhang as a sloped dimension (along the rafter), divide it by the slope factor first.
7. Common rafter vs hip rafter
This calculator handles common rafters — the parallel rafters that run perpendicular from the ridge board down to the top plate on a gable roof. They are the most numerous rafter type and the one you order in bulk.
A hip roof also has hip rafters, which run diagonally from the corner of the building up to the end of the ridge board. Hip rafters span a greater distance because they travel diagonally across both the run and the length simultaneously. Their length uses a diagonal slope factor: √(run² + (width/2)²) × the vertical factor — this is a more complex calculation beyond the scope of this guide.
For hip roofs, use the roofing calculator to estimate total roof area, and consult your framing plans for hip and valley rafter lengths. The roof pitch calculator can help you confirm the pitch angle and slope factor from a site measurement.
8. Sizing the rafter — span and load
Knowing the rafter length tells you how much material to order, but it does not tell you what size (depth) the rafter needs to be. Rafter size depends on:
- The horizontal span (run), not the sloped length
- The on-centre spacing (16 in, 24 in, etc.)
- The design load — dead load (weight of roof assembly) plus live load (snow, maintenance workers), which depends on your climate zone
- The species and grade of lumber
Span tables published in your local building code give allowable spans for each combination of rafter size, spacing, and load. The framing span calculator helps you look up allowable spans for rafters and joists. Always confirm sizing with a licensed professional before framing — under-sized rafters can sag, crack, or fail under snow load.
Common questions
- How do you calculate rafter length?
- Multiply the horizontal run (half the building width) by the slope factor, then add the overhang. Slope factor = √(1 + (rise/12)²), where rise is the first number in your x:12 pitch. For a 6:12 pitch: slope factor = √(1 + 0.25) = 1.118. A 12-foot run gives a 13.42-foot common rafter. Add a 12-inch overhang (1 × 1.118 = 1.12 ft sloped) for a 14.53-foot total cut length.
- What is the slope factor for a 6/12 pitch roof?
- The slope factor for a 6:12 pitch is √(1 + (6/12)²) = √(1 + 0.25) = √1.25 ≈ 1.118. This means every foot of horizontal run becomes 1.118 feet of sloped rafter. A 14-foot run produces a 14 × 1.118 = 15.65-foot common rafter.
- How many rafters do I need?
- Rafters per side = ⌈building length ÷ spacing⌉ + 1. Double it for both slopes. Example: a 40-foot building at 16-inch spacing = ⌈40 ÷ 1.333⌉ + 1 = 31 rafters per side × 2 = 62 total. The rafter calculator above does this automatically.
- What is the difference between a common rafter and a hip rafter?
- A common rafter runs perpendicular to the wall plate and connects the ridge board to the top plate. A hip rafter runs diagonally from a corner of the building to the ridge — it is longer because it spans both the run and the width simultaneously. Hip rafter length uses a different formula (the diagonal slope factor). This calculator covers common rafters only.
- How far apart should roof rafters be spaced?
- Common spacing is 16 inches (406 mm) or 24 inches (610 mm) on-centre for residential gable roofs. The correct spacing depends on the rafter size, span, load (snow, wind), and local building requirements. Your local authority having jurisdiction (AHJ) or a structural engineer can confirm what your project requires.
Last reviewed 2026-08
Reference & education only. Not professional, engineering, or code-compliance advice. Estimates are based on published model codes; local amendments and your Authority Having Jurisdiction (AHJ) govern. Always verify against the current adopted code and a licensed professional before doing work.