Rafter length calculator

Line length, overhang and total, from the run and the pitch — with the ridge taken off and the overhang scaled.

Units

Half the building width for a common rafter — wall to ridge, not wall to wall.

A 6 in 12 roof rises 6 in for every foot across.

Measured level. It is scaled down the slope for you.

Half of it comes off the run. A 2x ridge is 1.5 in.

Material estimate

Enter the run and the pitch to see how long the rafter is.

    A rafter is a hypotenuse

    Which makes this one of the few things on a building site with an exact answer. The whole calculation is Pythagoras. The reason it still goes wrong is that roof pitch is quoted as a ratio rather than an angle, and two things have to be handled before the triangle is the right triangle.

    rise = run × (pitch ÷ 12) line length = √(run² + rise²) slope factor = √(1 + (pitch ÷ 12)²) 12 ft run, 6 in 12, 1.5 in ridge, 12 in overhang run − half ridge = 11.94 ft rise = 5.97 ft line length = 13.35 ft overhang × 1.12 = 1.12 ft total to cut = 14.46 ft

    The run is half the building

    A common rafter goes from the wall plate to the ridge, and the ridge sits over the centre. So the run is half the span, and a 24 foot building has a 12 foot run with a rafter each side. Enter the full width and the answer comes out exactly twice too long — which is the commonest wrong rafter figure there is, and the easiest one to spot once you know to look for it.

    Two corrections nobody makes

    Half the ridge comes off the run. The rafter lands on the face of the ridge board, not on the centre line of the roof. A 2x ridge is an inch and a half thick, so three quarters of an inch leaves the run. It is a small number that shows up as a visible gap at the peak.

    The overhang is scaled, not added. An eave projection is quoted level — how far it sticks out horizontally — but it travels down the slope like the rest of the rafter, so it gets multiplied by the slope factor. Add it flat and every tail comes up short.

    Slope factors and rafter lengths by pitch

    Slope factors and rafter lengths by pitch
    PitchAngleSlope factorLine length, 12 ft run
    3 in 1214°1.03112.37 ft
    4 in 1218.4°1.05412.65 ft
    5 in 1222.6°1.08313 ft
    6 in 1226.6°1.11813.42 ft
    7 in 1230.3°1.15813.89 ft
    8 in 1233.7°1.20214.42 ft
    9 in 1236.9°1.2515 ft
    10 in 1239.8°1.30215.62 ft
    12 in 1245°1.41416.97 ft

    From this calculator, no ridge deduction and no overhang. Multiply any level distance by the slope factor to get the distance along the roof — it works for areas as well as lengths.

    What the slope factor is really for

    It is not only a rafter number. Multiply a roof's footprint by the slope factor and you have its sloped area, which is what shingles, underlayment and sheathing are bought against. That is why the same figure appears on the shingle calculator: the footprint you can measure off a plan is never the area you have to cover.

    What this gives you, and what it does not

    • Line length along the top edge, ridge face to outside of the plate, plus the overhang if you enter one. Cut your stock to the total and lay the cuts out on it.
    • Not the birdsmouth, the plumb cut or the tail detail. Those are laid out from the line, not added to it.
    • Not hips, valleys or jacks. A hip runs on the diagonal and its unit rise is measured over 17 inches, not 12. Different calculation, and guessing it would put a wrong number on a roof.
    • Not the rafter size. Depth, grade and spacing come from a span table for your load and species.

    The rest of the roof

    For the covering, the shingle calculator takes the same pitch and works out squares, starter, ridge cap and drip edge from the sloped area. Sheathing comes off the plywood calculator, and the walls carrying all of it are counted by the wall framing calculator, which handles rafter spacing the same way it handles studs. Before you lift a bundle of rafters onto a plate, the lumber weight calculator tells you what it weighs at the moisture content it left the yard with.

    Section through a roof at a 6 in 12 pitch over a 12 foot run, showing the rafter as the hypotenuse.
    Drawn to scale.

    Common questions

    How do you calculate rafter length?

    Square the run, square the rise, add them and take the square root — the rafter is the hypotenuse of a right triangle whose base is the run and whose height is the rise. The only preparation is turning the pitch into a rise: a 6 in 12 roof rises 6 inches for every 12 inches of run, so over 11.94 feet of run it climbs 5.97 feet, and the line length is 13.35 feet. Add the overhang along the slope and you have the piece to cut.

    Is the run half the building width?

    For a common rafter, yes — and this is the mistake that makes half the answers online exactly twice too big. A common rafter climbs from the wall plate to the ridge, which sits over the centre of the building, so its run is half the span. A 24 foot wide building has a 12 foot run per rafter, with a rafter on each side. Enter the full width here and every figure the tool gives you will be double what you need.

    What is a slope factor?

    The number you multiply a level distance by to get the distance along the roof. It is the square root of one plus the pitch squared as a decimal: a 6 in 12 roof has a slope factor of 1.12, so every level foot is 1.12 feet of rafter, and a roof's sloped area is its footprint times the same figure. The table below gives it for the common pitches — it is the single most useful number on this page, because it converts anything, not just rafters.

    Do I subtract for the ridge board?

    Yes, half of it. The rafter stops at the face of the ridge board rather than at the centre line of the roof, so half the ridge thickness comes off the run before anything else happens. A 2x ridge is 1.5 inches thick, so three quarters of an inch comes off — which on the worked example takes the line length from 13.42 feet to 13.35 feet. Small, but it is the difference between a tight ridge and a gap you can see from the ground.

    How do I add the overhang?

    Scale it, do not add it flat. An overhang is usually specified as a level projection — how far the eave sticks out horizontally — and it runs down the same slope as the rest of the rafter, so it is multiplied by the slope factor like everything else. Twelve inches of level overhang on this 6 in 12 example is 13.42 inches along the rafter. Add it flat and every rafter tail is short. This calculator does the scaling; enter the level projection you want.

    Does this include the birdsmouth and the tail cut?

    No. What you get is the line length — measured along the top edge of the rafter from the ridge face to the outside of the wall plate, plus the overhang if you asked for one. The birdsmouth seat and heel, the plumb cut at the ridge and whatever tail detail you are cutting are all laid out from that line, not added to it. Cut the stock to the total length here and lay the cuts out on it.

    What about hip and valley rafters?

    They are longer, and this tool does not do them. A hip runs diagonally across the corner, so its run is the diagonal of the two runs it meets rather than either one, and its unit rise is measured over 17 inches rather than 12 because that diagonal is longer. Jack rafters shorten in a regular series from the hip. All of it is derived from the common rafter figures on this page, but the diagonal is a different calculation and pretending otherwise would put a wrong number on a roof.

    How many rafters do I need?

    That is a spacing question rather than a length one, and it works exactly like a stud wall: divide the building length by the rafter spacing, round up, and add one, because a run of bays has one more member than it has gaps. The wall framing calculator does that arithmetic. What sets the spacing and the rafter size is a span table for your species, grade and load — not a calculator, and not a rule of thumb.

    Sources

    This calculator uses no material constants — only geometry and unit conversions, both exact by definition. Nothing here depends on a supplier's published figure.

    How we choose and cite these figures

    By Team MaterialMath. Published . How these figures are sourced and checked.