Skip to main content

Rafter length calculator

Enter the span, the pitch and the overhang. You get each rafter's length, the board to buy, and the angles to cut.

Checked Nov 20262 sources citedSee the working

This rafter length is plain geometry for a common gable rafter, and it does not size the rafter. Size, spacing and bearing come from 2021 IRC section R802 and its span tables, and your local code and inspector decide, since a roof that fails can collapse on people. Trusses, hips and valleys need other methods, and a birdsmouth weakens a rafter if cut too deep.

Wall to wall, measured level. Half of this is the run.

Along the ridge, to count rafters.

Rafter spacing

The span tables list 12, 16, 19.2 and 24 in.

Everything is worked out in this page. Nothing you type is sent.

Units

Enter and read measurements in feet, inches and yards.

Drawn to scale
8 ft run4 ft rise26.6°10.22 ft rafter
Each rafter, with tail and allowance
10.22
feet
Board to buy
12
feet
Rafters
32
Ridge to wall
8.87 ft
Tail
1.12 ft
Plumb cut, from the board's edge
26.6 degrees
Seat cut
63.4 degrees
Pitch multiplier
1.118

My project list

0 items

Add this, then whatever else the job needs. Everything you need to buy ends up here.

How we got 10.22 ft

  1. Run, less half the ridge7.94 ft
  2. Ridge to wall8.87 ft
  3. Tail1.12 ft
  4. Plumb allowance2.75 in
  5. Total, then the next board up10.22 ft, so 12 ft

Figures used

Rafter spacings listed in the span tables, in inches
see the table below
The steps framing lumber is usually sold in, in feet
2
Inches in one foot
12
Degrees in one radian
57.29577951308232
Degrees in a right angle, relating the seat cut to the plumb cut
90

2 sources cited further down. Checked Nov 2026 by Anil, developer of this site.

Working

How to measure for rafters

Measure the building's width across the top of the wall plates, level, and from outside face to outside face. Half of that is the run, the level distance a rafter has to cover. If a ridge board sits at the top, each rafter stops short by half its thickness, so a 1-1/2 inch ridge takes off 3/4 inch per side.

Find the pitch from your plans, or from the roof pitch calculator if the roof exists already. For the overhang, measure the level distance from the wall to where the rafter tail ends. Many people measure this along the slope, and then the multiplier gets applied twice and the tail comes out too long.

8 ft run4 ft rise26.6°10.22 ft rafter
A 16 ft wide building at 6 in 12. Each rafter is 10.22 ft with its tail and allowance.

Use real board sizes. A 2x6 is 5-1/2 inches deep, and it is that depth which sets how much extra board you need for the plumb cut at the bottom. Check your walls too, because one length only works if the walls are parallel.

A worked example

Johnson's rafter square manual prints this one: an 8 in 12 roof, a 13 foot run, a 1 foot 9 inch tail and a 2x6 rafter. These lines come from the same formula the calculator above runs.

Johnson's 8 in 12 rafter

  1. Multiplier at 8 in 12: 1.2019
  2. Rafter: 13 × 1.2019 = 15.62 ft
  3. Tail: 1.75 × 1.2019 = 2.10 ft
  4. Plumb allowance: 5.5 × 8 ÷ 12 = 3.67 in
  5. Total: 18.03 ft, so a 20 ft board

Johnson prints 18 feet and 9/16 of an inch from its tables, within a fraction of an inch of this. That length barely clears an 18 foot board, so buy the next one up, which is what the calculator does. This page finds length only. To price the lumber, use the lumber calculator, and for what goes on top, the roofing calculator.

Rafter lengths for common buildings

These assume a 1-1/2 inch ridge, a 1 foot level overhang and a 2x6 rafter. Each cell is the rafter's total length, tail and allowance included, in feet. It is not a recommendation on what size of rafter the span needs.

Worked out by this calculator. Feet.
Width4 in 126 in 128 in 1212 in 12
8 ft5.365.756.247.44
12 ft7.477.998.6410.27
16 ft9.5710.2211.0513.10
20 ft11.6812.4613.4515.93
24 ft13.7914.6915.8518.75
30 ft16.9518.0519.4623.00

Mistakes that make a short rafter

  • The whole ridge off the run. Each rafter loses half the ridge's thickness, not all of it.
  • No plumb allowance. The bottom cut needs extra board, and buying the bare length leaves you short.
  • Slope for span. Under R802.4.1, rafter spans are measured along the horizontal projection. The sloped length is for buying wood, not for the table.
  • Using this for a hip or a valley. Those need other multipliers, and trusses are engineered. This handles only a common rafter.
  • Skimping on bearing. R802.6 calls for at least 1-1/2 inches on wood or metal and 3 inches on masonry, so the birdsmouth has to leave enough.

Questions

How do I calculate rafter length?

Multiply the run by the pitch multiplier. On an 8 in 12 roof with a 13 foot run, that is 13 times 1.2019, or about 15.62 feet. The run is half the building's width, less half the ridge board's thickness.

Do I measure from the ridge center?

Yes, then take half the ridge thickness off. Johnson's manual says to divide the building width in half, and with a ridge board, to deduct half its thickness from the run. For a 1-1/2 inch ridge, that is 3/4 inch per rafter.

How do I add the overhang?

Measure the overhang level and multiply by the same pitch multiplier. A 1 foot 9 inch level overhang at 8 in 12 is about 25 inches along the slope. Measuring along the slope and then multiplying again is a common mistake.

How many rafters do I need?

Divide the building's length in inches by the spacing, round up, add one, and double it for both sides. A 20 foot building at 16 inches takes 32 rafters. Gable end details may change the count a little.

What size rafters do I need?

This calculator does not size them. Size depends on span, spacing, species and load, and comes from the span tables in 2021 IRC section R802.4.1, or from an engineer. Rafter spans there are measured along the horizontal projection, not the slope.

When do I need a professional?

You need an engineer or a licensed builder for anything beyond a simple gable, for heavy snow loads, or for a roof over living space where the code requires a permit. Have the framing inspected before you cover it.

This rafter length is plain geometry for a common gable rafter, and it does not size the rafter. Size, spacing and bearing come from 2021 IRC section R802 and its span tables, and your local code and inspector decide, since a roof that fails can collapse on people. Trusses, hips and valleys need other methods, and a birdsmouth weakens a rafter if cut too deep.

Sources and review

Checked in November 2026. Spotted a wrong number? Report it and it goes in the corrections log.

How this is calculated

Every figure below is read from the code that produces the answer, so what is written here is what the calculator ran. The constants were last checked against their sources in November 2026.

The arithmetic

Run

Run = Width ÷ 2 − Ridge thickness ÷ 2

Ridge thickness
Half of it comes off each side

Worked through: 8 − 0.0625 = 7.94 ft

Rafter

Length = (Run + Overhang) × √(1 + (Pitch ÷ 12)²)

√(1 + (Pitch ÷ 12)²)
The pitch multiplier

Worked through: 13 × 1.2019 = 15.62 ft

Plumb allowance

Allowance = Rafter depth × Pitch ÷ 12

Rafter depth
The real depth, in inches

Worked through: 5.5 × 8 ÷ 12 = 3.67 in

The constants, and where they come from

TABLE_SPACINGS

Published figure

Rafter spacings listed in the span tables, in inches

0
12
1
16
2
19.2
3
24

Applies to: Places using the 2021 IRC. Local amendments differ

Source: 2021 residential code, chapter 8, as adopted in Colorado, UpCodes, published 2021, read 2026-11. This source is about 5 years old, and it is the one the figure rests on.

Columns in Tables R802.4.1(1) to (8), read through UpCodes' copy of Colorado's adoption, since ICC refused our request. 2024 numbering could not be checked.

BOARD_STEP_FEET

Modelled

The steps framing lumber is usually sold in, in feet

2

Applies to: Common dimension lumber at a yard. Check yours

No published figure exists for this. It is derived, and the derivation is below rather than a citation to something that does not say it. Last checked in November 2026.

Common practice, not read from a published standard. It is used only to round the board length up, so a yard with other lengths just changes where you round.

INCHES_PER_FOOT

Definitional

Inches in one foot

12

Applies to: Definitional, everywhere

Source: RAS-120 rafter angle square manual, Johnson Level and Tool, published 2019, read 2026-11. This source is about 7 years old, and it is the one the figure rests on.

Twelve inches make a foot, and a pitch is stated over 12 inches of run. The method and the half-ridge deduction are Johnson's.

DEGREES_PER_RADIAN

Definitional

Degrees in one radian

57.29577951308232

Applies to: Definitional, everywhere

True by definition, so there is nothing to cite. The derivation is below.

A half turn is 180 degrees or pi radians, so one radian is 180 divided by pi.

RIGHT_ANGLE

Definitional

Degrees in a right angle, relating the seat cut to the plumb cut

90

Applies to: Definitional, everywhere

True by definition, so there is nothing to cite. The derivation is below.

The plumb and seat cuts are square to each other, so together they make 90 degrees.

SIDES_OF_ROOF

Definitional

Sides of a gable roof that take rafters

2

Applies to: A simple gable roof

True by definition, so there is nothing to cite. The derivation is below.

A gable has one slope either side of the ridge, so each position along the ridge takes 2 rafters.

What the labels mean

Published figure:
taken directly from the source named beside it.
Modelled:
derived rather than measured, and the derivation is shown.
Definitional:
true by definition, like the number of inches in a foot, so there is nothing to cite.

If a figure here looks wrong, it may be. Tell us what you found and we will check it against the source and publish a correction if it needs one. How constants are chosen and how often they are reviewed is set out in our methodology.

How to use the rafter length calculator

  1. 1

    Measure the building's width and length

  2. 2

    Find the roof pitch

  3. 3

    Enter the overhang, measured level

  4. 4

    Enter the real sizes of the ridge and the rafter

  5. 5

    Read the length and board, and check the size against the span tables

What this calculator assumes

Every estimate here rests on the assumptions below. Where your job differs from one of them, the figure will differ too.

  • A simple gable with a ridge board, and rafters the same on both sides
  • The overhang is measured level, not along the slope
  • The ridge takes half its thickness off each run
  • It finds length only. Span tables or an engineer decide what size rafter you need

Pro tips

  • Make one pattern rafter, test it on both sides, and cut the rest from it
  • Crown the boards so any bow sits upward
  • Check that the walls are parallel before you trust one length for all