Skip to content

Rafter Calculator

This rafter calculator gives the length of a common rafter to a sixteenth of an inch, its cut angles and birdsmouth, and the board length and number of boards to buy.

1. The roof

Outside of wall to outside of wall.

A 6 means the roof rises 6 in. for every 12 in. it runs.

Measured level, out from the wall.

A 2x ridge is 1.5 in. thick. Use 0 if the rafters meet each other.

2. The rafter

How much of the rafter sits flat on the wall plate. A 2x4 plate is 3.5 in. Use 0 for no notch.

The size you pick sets the cuts and the lumber order. It does not check strength: that comes from a span table or an engineer.

3. The order (optional)

Along the ridge. Leave blank to skip the count.

For one board of the stock length shown in the result.

Your rafter

Rafter length

0

Board to buy

0

Plumb cut

0

Rise

0

Side view

Measurements

Part Tape reading Decimal
Show the working

    Lengths and cuts only. This calculator does not size rafters for load or span. Use a span table for your lumber and snow load, or an engineer, and follow your local building code.

    Runs in your browser. Nothing uploaded.

    Use this rafter calculator to work out the length of a common rafter for a gable or shed roof. Enter the building width, the pitch and the overhang. It gives the rafter length as a tape reading to a sixteenth of an inch, the plumb and level cut angles, the birdsmouth, and the part most tools leave out: the board length to buy, how many boards, and what they’ll cost.

    About the rafter calculator

    Rafter length is one line of geometry. Getting from that number to a lumber order takes three more steps that are easy to get wrong on a scrap of plywood: the ridge deduction, the extra board the angled cuts use up, and the count.

    • Length to a sixteenth. Feet, inches and a fraction you can find on a tape, with the decimal beside it.
    • Ridge deduction built in. Enter the ridge board thickness and half of it comes off the run.
    • Cut angles. The plumb cut for the ridge and tail, and the level cut for the seat.
    • Birdsmouth. Heel height, notch depth and the wood left above the plate, with a warning when the notch passes a quarter of the rafter.
    • Board to buy. The stock length each rafter needs, rounded up to the 2 ft steps lumber is sold in.
    • Count and cost. Rafters for the whole roof, board feet, and a total if you enter a price.
    • A side view drawn to scale.

    It runs in your browser. Nothing you enter is sent anywhere or saved.

    What it doesn’t do: it doesn’t tell you what size of lumber is strong enough. That depends on span, spacing, wood grade and snow load, and it comes from a span table or an engineer.

    How to use the rafter calculator

    1. Choose the roof. Gable for two slopes meeting at a ridge. Shed for one slope.
    2. Enter the building width from the outside of one wall to the outside of the other.
    3. Enter the pitch as rise in 12. A 6 means 6 inches up for every 12 inches across.
    4. Enter the overhang, measured level out from the wall, and the ridge board thickness.
    5. Pick the rafter size and the birdsmouth seat length.
    6. Add the building length and spacing for a count, and a price for a cost.

    The rafter calculator formula

    The rafter calculator treats a rafter as the long side of a right triangle. The run is the bottom, the rise is the upright, and the rafter is the slope.

    run = (building width - ridge thickness) / 2
    rise = run x pitch / 12
    rafter length = run x square root of (1 + (pitch / 12) squared)

    That square root is the length of rafter for each foot of run. Carpenters call it the line length ratio. For a shed roof, the run is the whole building width and there’s no ridge to deduct.

    The overhang is measured level, so it’s multiplied by the same ratio to get the length of the tail along the slope.

    Rafter calculator example: a 24 ft gable

    A building is 24 ft wide. The roof is 6 in 12 with a 1.5 inch ridge board and a 12 inch overhang, framed in 2×8.

    1. Run: (24 ft – 1.5 in.) / 2 = 11.9375 ft, which is 11 ft 11 1/4 in.
    2. Rise: 11.9375 x 6 / 12 = 5.9688 ft, which is 5 ft 11 5/8 in.
    3. Ratio: the square root of 1.25 = 1.1180.
    4. Line length, ridge to wall: 11.9375 x 1.1180 = 13.3465 ft, which is 13 ft 4 3/16 in.
    5. Tail: 12 in. x 1.1180 = 13 7/16 in.
    6. Rafter length: 14 ft 5 9/16 in.

    Leave the ridge out and the line length comes to 13 ft 5 in. Each rafter is then 13/16 inch too long, and the pair won’t sit down on the walls with the ridge board between them.

    Rafter length by pitch

    The same 24 ft building, 1.5 inch ridge and 12 inch overhang, at each common pitch. The last column is the board to buy for a 2×8.

    Pitch Angle Length per foot of run Ridge to wall With overhang Board
    3 in 12 14.04° 1.0308 12 ft 3 11/16 in. 13 ft 4 in. 14 ft
    4 in 12 18.43° 1.0541 12 ft 7 in. 13 ft 7 5/8 in. 14 ft
    5 in 12 22.62° 1.0833 12 ft 11 3/16 in. 14 ft 3/16 in. 16 ft
    6 in 12 26.57° 1.1180 13 ft 4 3/16 in. 14 ft 5 9/16 in. 16 ft
    7 in 12 30.26° 1.1577 13 ft 9 13/16 in. 14 ft 11 3/4 in. 16 ft
    8 in 12 33.69° 1.2019 14 ft 4 3/16 in. 15 ft 6 9/16 in. 16 ft
    9 in 12 36.87° 1.2500 14 ft 11 1/16 in. 16 ft 2 1/16 in. 18 ft
    10 in 12 39.81° 1.3017 15 ft 6 1/2 in. 16 ft 10 1/16 in. 18 ft
    12 in 12 45.00° 1.4142 16 ft 10 9/16 in. 18 ft 3 9/16 in. 20 ft

    Notice the 5 in 12 row. The rafter is 14 ft 3/16 in. long, a hair over 14 ft, and it needs a 16 ft board. That’s the trap the board column is there to catch.

    Rafter length by building width

    At 6 in 12, with the same ridge and overhang.

    Building width Ridge to wall With overhang Board
    12 ft 6 ft 7 11/16 in. 7 ft 9 1/16 in. 10 ft
    16 ft 8 ft 10 1/2 in. 9 ft 11 15/16 in. 12 ft
    20 ft 11 ft 1 5/16 in. 12 ft 2 3/4 in. 14 ft
    24 ft 13 ft 4 3/16 in. 14 ft 5 9/16 in. 16 ft
    28 ft 15 ft 7 in. 16 ft 8 7/16 in. 18 ft
    32 ft 17 ft 9 13/16 in. 18 ft 11 1/4 in. 20 ft

    The cuts

    A common rafter has three cuts, and the rafter calculator gives the angle for each.

    • The plumb cut at the ridge. It stands vertical when the rafter is in place. Its angle off square is the roof angle: 26.57 degrees at 6 in 12.
    • The birdsmouth. A notch where the rafter sits on the wall. It has a level seat cut and a plumb heel cut.
    • The tail cut. Usually plumb, at the same angle as the ridge cut, so a fascia board sits flat against it.

    The level cut is 90 degrees minus the roof angle: 63.43 degrees at 6 in 12. On a framing square you don’t need the degrees at all. Hold 12 on one arm and the pitch on the other, and the square gives you both lines. The degrees are for a miter saw or a speed square.

    The birdsmouth

    The seat is the flat part that bears on the wall plate. A 2×4 plate is 3.5 inches wide, so 3.5 inches is the usual seat.

    heel = seat x pitch / 12
    notch depth, square to the rafter = seat x sine of the roof angle

    At 6 in 12 with a 3.5 inch seat on a 2×8:

    • Heel: 3.5 x 6 / 12 = 1 3/4 in.
    • Notch depth: 1 9/16 in., which is 21.6% of the rafter.
    • Wood left above the plate, measured plumb: 6 3/8 in.

    The steeper the roof, the deeper the same seat cuts. At 8 in 12 that 3.5 inch seat takes 26.8% of a 2×8. The building code limits a notch at the end of a rafter to a quarter of its depth. Inspectors and framers argue about whether a birdsmouth is that kind of notch, so the rafter calculator flags it and tells you the longest seat that stays inside a quarter: 3 1/4 in. in this case. Ask your building department which rule they apply.

    A 2×6 rafter on a 2×6 wall is the common problem. A full 5.5 inch seat at 6 in 12 would take 44.7% of the rafter. The seat doesn’t have to cover the whole plate.

    What board to buy

    This is the step the rafter calculator adds that a plain length formula skips. A rafter with a plumb cut at each end is a parallelogram, and you cut it from a rectangle. The slant at each end uses extra board:

    board needed = rafter length + rafter depth x pitch / 12

    For the 24 ft example: 14.465 ft + 7.25 in. x 0.5 = 14.465 + 0.302 = 14.77 ft. Dimensional lumber comes in 2 ft steps, so you buy 16 ft boards.

    Most yards keep lengths up to 20 ft on the rack. A wide building with a steep roof can need more. A 36 ft wide building at 8 in 12 with an 18 inch overhang needs 23.9 ft of 2×10 for each rafter. The rafter calculator warns you when you pass 20 ft, because that usually means a special order, engineered lumber, or trusses.

    How many rafters

    rafters per side = building length in inches / spacing, rounded up, plus 1

    For a building 30 ft long:

    Spacing on centre Rafters per side Gable roof total
    12 in. 31 62
    16 in. 24 48
    19.2 in. 20 40
    24 in. 16 32

    At 16 inches, the 24 ft example needs 48 boards of 16 ft 2×8. That’s 1,024 board feet. At $18 a board it’s $864.

    The count is for the common rafters only. Add extras for gable-end overhangs, doubled rafters beside skylights or chimneys, and a spare or two for a bad board.

    Example: a garage

    A garage is 20 ft wide and 22 ft long. The roof is 4 in 12 with a 12 inch overhang and a 1.5 inch ridge, in 2×6 at 24 inches on centre.

    • Ridge to wall: 10 ft 5 11/16 in.
    • Rafter length: 11 ft 6 3/8 in.
    • Plumb cut: 18.43 degrees.
    • Board: 12 ft.
    • Rafters: 12 a side, 24 in all, 288 board feet.
    • At $14.50 a board: $348.

    Example: a shed roof

    A lean-to is 12 ft wide and 16 ft long, with a 3 in 12 roof, a 6 inch overhang, and 2×6 rafters at 24 inches. Choose “Shed” and the run is the full 12 ft.

    • Rise: 3 ft.
    • Wall to wall along the slope: 12 ft 4 7/16 in.
    • Rafter length with the tail: 12 ft 10 5/8 in.
    • Board: 14 ft. Nine rafters, 126 board feet.

    The shed setting puts an overhang on the low side only. If yours overhangs at the top as well, add that amount to the overhang box. The length comes out the same.

    Reading your result

    • Rafter length. From the ridge cut to the end of the tail, measured along the top edge.
    • Board to buy. The stock length for each rafter.
    • Plumb cut. The angle off square for the ridge and tail.
    • Rise. How high the ridge end sits above the wall plate line.
    • Rafters. The count, with board feet and cost.
    • Measurements. Every length as a tape reading and as a decimal.

    Open “Show the working” to see each step. Cut one pair first and try them on the building before you cut the rest. If they fit, use one as the pattern.

    Common mistakes

    • Forgetting the ridge. Half the ridge thickness comes off each run.
    • Measuring the overhang along the slope. It’s a level measurement. The tail along the slope is longer.
    • Buying boards the length of the rafter. The end cuts need more.
    • Using the inside width. Measure to the outside of the walls, where the rafter bears.
    • Cutting the birdsmouth too deep to cover a wide plate.
    • Choosing a rafter size from a length calculator. Size comes from a span table.

    What the rafter calculator can’t tell you

    • Whether the rafter is strong enough. Not span, not deflection, not snow or wind load.
    • Hip, valley and jack rafters. It covers common rafters on gable and shed roofs.
    • Ceiling joists, rafter ties and collar ties. A gable roof needs something to stop the walls spreading.
    • Trusses. Those are engineered and built to order.
    • Your local code and permit rules.

    More project calculators

    Pricing the whole job? The job estimate calculator turns materials and labor into a quote. For the slab or footings under the building, the cubic yard calculator gives concrete volume, and the concrete block calculator counts blocks for the walls. Once the roof is on, the recessed lighting calculator lays out the ceiling. All of them are on the home and garden tools page.

    Method and sources

    Rafter length, cut angles, the birdsmouth and the board allowance are right-triangle geometry, shown step by step in the working. Lumber depths are the standard dressed sizes: a 2×8 is 7.25 inches deep. The quarter-depth limit on end notches is from the International Residential Code, section R802.7.1, as quoted in framing references. We did not read the code text directly, and local codes can differ.

    Frequently asked questions

    How do I calculate rafter length?

    Take the run, which is half the building width less half the ridge board, and multiply it by the square root of 1 plus the pitch over 12, squared. For a 24 ft wide building with a 1.5 in. ridge at 6 in 12, the run is 11.9375 ft, the multiplier is 1.118, and the rafter is 13 ft 4 3/16 in. from the ridge to the wall. A 12 in. overhang adds 13 7/16 in., for 14 ft 5 9/16 in. in all.

    What length of board do I need for each rafter?

    A little more than the rafter length, because the angled cut at each end uses extra board: the depth of the rafter times the pitch over 12. A 14 ft 5 9/16 in. rafter cut from a 2x8 at 6 in 12 needs 14.77 ft of board. Lumber is sold in 2 ft steps, so you buy 16 ft boards.

    What angle do I cut a rafter at?

    The plumb cut at the ridge and the tail is the roof angle, measured off square. At 6 in 12 that is 26.57 degrees, at 4 in 12 it is 18.43 degrees and at 12 in 12 it is 45 degrees. The level cut for the birdsmouth seat is 90 degrees minus that.

    How deep should a birdsmouth be?

    Deep enough for the seat to sit on the wall plate, and no deeper. A 3.5 in. seat at 6 in 12 makes a notch 1 9/16 in. deep, which is 21.6% of a 2x8. The building code limits a notch at the end of a rafter to a quarter of its depth, though inspectors differ on how that applies to a birdsmouth. The rafter calculator warns you when the notch passes a quarter.

    How many rafters do I need?

    Divide the building length in inches by the spacing, round up, and add one for the far end. Double it for a gable roof. A 30 ft long building at 16 in. on centre needs 24 rafters a side, 48 in all. That count does not include extra rafters for gable-end overhangs or doubled rafters around openings.

    Does the rafter calculator tell me what size lumber to use?

    No. It works out lengths, cuts and the order for the size you choose. Whether a 2x6 or a 2x10 is strong enough depends on the span, spacing, wood species and grade, and your snow load. That comes from a span table, your building department or an engineer.

    Guides that use this tool

    Last updated: October 8, 2026