# Rafter Quantity Calculator (Gable, Hip, Shed, L- and T-Shaped Roofs: Rafters, Hips, Valleys, Jacks and Ridge Board)

> Count the rafters of a gable, hip or shed roof at your spacing and their lengths, with the hips, jacks, a wing's valley rafters and the ridge board.

Page: https://craftquantities.com/calculators/materials-quantities/rafter-quantity-calculator/ (calculator). This is the page's Markdown copy; the HTML page is the canonical version.

Version 1.0.0, sources checked 2026-10-10, 6 published test vectors.

Rafters to cut: 40 rafters for Building Length 33 ft and Building Width 26 ft, the page's opening figures; on the metric page, 10 m and 8 m give 40 rafters. Source: California Residential Code (2025) § R802.3.

## Inputs

A length, area or volume is entered with its unit. The page opens on the values below: a metric reader sees the metric column, a US customary reader the other.

| Input | id | Opens at (metric) | Opens at (US customary) | Accepts |
|---|---|---|---|---|
| Roof Shape | `roofShape` | Gable: two slopes, a gable wall at each end | Gable: two slopes, a gable wall at each end | `gable`, `hip`, `shed` |
| Building Length (along the ridge) | `buildingLength` | 10 m | 33 ft | mm, cm, m, in, ft, yd; range 0.5–100 m |
| Building Width (the span) | `buildingWidth` | 8 m | 26 ft | mm, cm, m, in, ft, yd; range 0.5–30 m |
| Roof Pitch (rise per 12 run) | `roofPitch` | 6 | 6 | range 1–24 |
| Eave Overhang (in plan) | `eaveOverhang` | 400 mm | 16 in | mm, cm, m, in, ft, yd; range 0–1.5 m |
| Gable Overhang (each end) | `rakeOverhang` | 300 mm | 11.75 in | mm, cm, m, in, ft, yd; range 0–1.5 m |
| First Wing's Span (0 for none) | `wing1Span` | 0 m | 0 ft | mm, cm, m, in, ft, yd; range 0–30 m |
| First Wing's Length (0 for none) | `wing1Projection` | 0 m | 0 ft | mm, cm, m, in, ft, yd; range 0–40 m |
| Second Wing's Span (0 for none) | `wing2Span` | 0 m | 0 ft | mm, cm, m, in, ft, yd; range 0–30 m |
| Second Wing's Length (0 for none) | `wing2Projection` | 0 m | 0 ft | mm, cm, m, in, ft, yd; range 0–40 m |
| Rafter Spacing (on centre) | `spacing` | 600 mm | 24 in | mm, cm, m, in, ft, yd; range 0.2–1.2 m |
| Ridge Board Thickness | `ridgeThickness` | 38 mm | 1.5 in | mm, cm, m, in, ft, yd; range 0–0.3 m |

- **Roof Shape**: Two slopes and gable ends, four slopes with hips, or a single slope.
- **Building Length (along the ridge)**: From one gable wall's outside face to the other's.
- **Building Width (the span)**: From the outside of one eave wall's plate to the outside of the other.
- **Roof Pitch (rise per 12 run)**: The rise for every 12 of horizontal run, both slopes the same.
- **Eave Overhang (in plan)**: How far the rafter tail reaches past the wall plate, measured level.
- **Gable Overhang (each end)**: How far the roof runs past each gable wall.
- **First Wing's Span (0 for none)**: The width between a wing's eave walls, for an L, T or U-shaped house; 0 for none.
- **First Wing's Length (0 for none)**: From the main roof's wall line out to the wing's end wall.
- **Second Wing's Span (0 for none)**: A second wing's span, on the same long side for a U or the other for a T; 0 for none.
- **Second Wing's Length (0 for none)**: A second wing's length; 0 for none.
- **Rafter Spacing (on centre)**: The centres your span table or framing plan gives.
- **Ridge Board Thickness**: Half of it comes off each rafter's run, where the rafter meets the board's face.

## The answer on the opening values

Worked exactly as the page works it, on the values each system opens on.

### Metric

| Result | Value |
|---|---|
| **Rafters to cut** | 40 rafters |
| Common rafters, both slopes | 36 rafters |
| Barge rafters at the gable overhangs | 4 rafters |
| Slope factor | 1.12 |
| Length of each rafter, ridge face to tail | 4.9 m |
| Rafters, lineal | 195.92 m |
| Ridge board length | 10.6 m |

### US customary

| Result | Value |
|---|---|
| **Rafters to cut** | 40 rafters |
| Common rafters, both slopes | 36 rafters |
| Barge rafters at the gable overhangs | 4 rafters |
| Slope factor | 1.12 |
| Length of each rafter, ridge face to tail | 15.96 ft |
| Rafters, lineal | 638.21 ft |
| Ridge board length | 34.96 ft |

## How it is worked out

18 rafters on each slope at the spacing, a pair over each gable wall, and a barge rafter on each slope at both overhanging gables; each runs from the ridge board's face to the tail's plumb cut.

The working the page shows, in order: Common rafters, both slopes; Barge rafters at the gable overhangs; Slope factor; Length of each rafter, ridge face to tail; Rafters, lineal; Ridge board length; then rafters to cut.

The method, derived in full:

- [Spacing, Pitch and the Count That Follows](https://craftquantities.com/methodology/spacing-pitch-and-count/): Why a run divided by a spacing gives the number of gaps and not the number of things, why the division rounds up rather than to nearest, and what the leftover bay at the end does to both.

What this calculation does not cover:

- Nothing here sizes a rafter or checks the roof. The section, grade and spacing for the span, the snow and the wind come from your code's rafter span tables or an engineer, and so do the ties, collars or ridge beam that stop the roof spreading.
- A rectangle with every slope at one pitch: a gable, a hip roof with its ridge along the longer side, or a shed, and up to two wings off its long sides for an L, a T or a U, each no wider than the main span. A wing off an end, a wing at another pitch, dormers and any other outline need the hip and valley pages, plane by plane.
- Where a wing ties in, the valley jacks are counted at the spacing from each valley's foot and the wing's commons from its end wall; the valley rafters run to the wing ridge's end, and the extra framing a wing near a hipped end of the main roof needs, and any blocking or ridge beam, is the framing plan's.
- Each rafter is its line length from the ridge board's face to the tail's plumb cut. The birdsmouth, the plumb cuts and rounding up to a stock length are not added; the common rafter page draws the cuts.
- Barge rafters are one per slope at each overhanging gable, cut like a common. The outlookers or ladder framing that carry them are not counted.
- On a hip roof each jack runs to the hip's centre line and each hip to the ridge's end, so half the hip's thickness, the hip's drop or backing and the king commons' cut against the ridge are not taken off; the hip and valley cut list page gives those cuts.
- On a shed roof the eave overhang is taken at the high side as well as the low eave, and the gable-shaped walls at each end, taller at the high side, are wall framing, not rafters.
- Ceiling joists or rafter ties, collar ties, blocking at the plate, the sub-fascia and the roof sheathing are separate items.

A professional must decide:

- Nothing here sizes a rafter or checks the roof. The section, grade and spacing for the span, the snow and the wind come from your code's rafter span tables or an engineer, and so do the ties, collars or ridge beam that stop the roof spreading.
- Structure: sizes, thicknesses, spans, reinforcement and bearing are a structural engineer's or the building official's decision. This is a quantity, not a design.

## Sources

As the calculator cites them (sources checked 2026-10-10):

- California Residential Code (2025) § R802.3: a ridge board connecting opposing rafters not less than 1 inch (25 mm) nominal thickness and not less in depth than the cut end of the rafter; § R802.4.2: rafters framed opposite each other to a ridge board, offset no more than 1 1/2 inches (38 mm); § R802.4.6: collar ties not less than 1 x 4 nominal, no more than 4 feet (1219 mm) on centre <https://gocodebook.com/library/us/ca/ca-residential-code/chapter-8-roof-ceiling-construction/section-r802-wood-roof-framing>
- Rafter line length: run x sqrt(1 + (rise / 12)^2), the run being horizontal from the outside of the wall plate to the ridge; the overhang's horizontal projection takes the same factor (this site's common gable rafter length page)
- Open Exam Prep, Louisiana roofing contractor guide, 3.2 Surface Area Calculations: the hip and valley multiplier sqrt(12² + 12² + R²) / 12 from the 17-inch diagonal run (1.500 at 6:12); length of one hip rafter = common run x the hip multiplier <https://open-exam-prep.com/study-guides/la-roofing-contractor/roofing-estimating-plan-reading-math/surface-area-calculations-squares>
- Jack rafters on an equal-pitch 45° hip: each spacing along the plate shortens a jack by the spacing x the common rafter's length per unit of run, the framing square's common difference (this site's hip and valley rafter cut list page)
- Southern Pine Inspection Bureau, "Nominal vs. Actual Lumber Sizes": dressed sizes per PS 20-20, the American Softwood Lumber Standard; a nominal 2-inch member dresses to 1 1/2 in <https://blog.spib.org/nominal-vs-actual-lumber-sizes/>

A code or standard has force only where a jurisdiction has adopted it, usually with local amendments; check what is in force with the authority where you build.

## Questions answered on the page

**How many rafters does a gable roof need?**

On each slope, the building's length divided by the spacing, rounded up, plus one, then twice that for both slopes. A 10 m (32.8 ft) roof at 600 mm (24 in) centres takes 18 a slope, 36 in all, and four barge rafters more if the gables overhang.

**How long is each rafter?**

Half the span less half the ridge board, plus the eave overhang, all measured level, times the slope factor. On an 8 m (26.2 ft) span at 6 in 12 with a 400 mm (15.7 in) eave and a 38 mm (1 1/2 in) ridge that is 4.381 m (14.37 ft) level, times 1.118, or 4.898 m (16.07 ft) along the slope before the cuts.

**Is a ridge board enough, or do I need a ridge beam?**

That is the roof's design. A ridge board only gives the rafters something to meet; it carries nothing when the walls are tied by ceiling joists or rafter ties. A roof without those ties, such as a vaulted ceiling, needs a ridge beam an engineer or the span tables size.

**How many rafters does a hip roof need?**

Commons along the ridge on both long sides, a king common at each hip end, four hips, and jack rafters each side of every hip at the spacing from the corner. A 12 by 8 m (39.4 by 26.2 ft) hip roof at 6 in 12 with 600 mm (24 in) centres and a 400 mm (15.7 in) eave has a 4 m (13.1 ft) ridge, 16 commons along it and 2 kings, 4 hips of 6.6 m (21.65 ft), and 48 jacks, 134.2 m (440.2 ft) of them: 70 pieces.

**What does a wing add to the rafters of an L-shaped roof?**

Two valley rafters, valley jacks on both roofs where they meet, and the wing's own commons. A 6 m (19.7 ft) wing standing 4 m (13.1 ft) off a 12 by 8 m (39.4 by 26.2 ft) gable at 6 in 12, with 600 mm (24 in) centres and a 400 mm (15.7 in) eave, takes two valley rafters of 5.1 m (16.73 ft), nine valley jacks on the main roof in place of nine of its commons, eight on the wing, and 16 wing commons: 74 pieces with the barges, against 46 for the plain gable.

**How are a shed roof's rafters counted?**

One slope, so one rafter at each spacing along the walls plus one, each the whole span and both overhangs times the slope factor. A 6 m (19.7 ft) lean-to over a 3 m (9.8 ft) span at 3 in 12 with 300 mm (11.8 in) eaves takes 11 rafters at 600 mm (24 in), each 3.711 m (12.17 ft), and the high wall stands 0.75 m (2.46 ft) above the low one.

**Does this include the ceiling joists?**

No. Ceiling joists or rafter ties are counted on the ceiling joist page; run it with the same building and spacing.

## Related calculators

- [Common Gable Rafter Length Calculator](https://craftquantities.com/calculators/materials-quantities/common-rafter-length-calculator/)
- [Ceiling Joist Spanning Lineal Lumber Aggregator](https://craftquantities.com/calculators/materials-quantities/ceiling-joist-linear-footage-calculator/)
- [Roof Truss Spacing & Count Calculator](https://craftquantities.com/calculators/materials-quantities/roof-truss-spacing-calculator/)
- [Hip/Valley Rafter Plumb Cut Angular Cutlist](https://craftquantities.com/calculators/materials-quantities/hip-valley-rafter-cutlist-calculator/)

## Run it from a program

- REST: `GET https://api.craftquantities.com/v1/calculate/rafter-quantity-calculator` with each input as a query parameter, a length, area or volume with its unit; `https://api.craftquantities.com/v1/describe/rafter-quantity-calculator` lists the inputs.
- MCP: the `calculate` tool at https://api.craftquantities.com/mcp with `slug` `rafter-quantity-calculator`.
- Definition and test vectors: https://craftquantities.com/api/v1/calculators/rafter-quantity-calculator.json

---
Source: https://craftquantities.com/calculators/materials-quantities/rafter-quantity-calculator/
Craft Quantities: free to read, cite and link to; the pages are not licensed for republication. Quantities only: no prices, no design and no certification.
