# Roof Pitch & Rafter Calculator (`jumblemog/roof-framing-calculator`) Actor

Roof framing from plain text: rise, common, hip and jack rafter lengths, birdsmouth cuts and ridge height for gable, hip and shed roofs, roof area in squares with shingles and underlayment, and pitch to degree conversions.

- **URL**: https://apify.com/jumblemog/roof-framing-calculator.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** AI, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Roof Pitch & Rafter Calculator

**Work out rafter lengths, birdsmouth cuts, ridge height, hip and jack rafters, roof squares and shingle bundles for a gable, hip or shed roof, or convert a roof pitch, from one line of text.** Ask `gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc` or `convert 30 degrees to pitch` and you get back:

- **The framing**: rise, common rafter length along the top edge with the ridge deduction and the tail, the board length to buy, plumb and seat cut angles, the birdsmouth seat and depth (warned when it cuts more than 1/3 of the rafter), the height above plate and the ridge height above the wall plates.
- **Hip roofs**: hip rafter length, the pitch on the hip, the jack rafter step at your spacing and the jack count.
- **Counts and materials**: common rafters, the roof area in square feet and squares, shingle bundles with waste, synthetic underlayment and felt rolls, drip edge, starter and ridge cap.
- **Pitch conversions**: x/12 ↔ degrees ↔ percent ↔ ratio, with the slope factor and the hip and valley factor.
- **A to-scale drawing** of the roof section and a **Markdown report**. Lengths come in inches and in feet and inches to the nearest 1/16".

It's made for:

- Carpenters, framers, roofers and DIY builders cutting rafters for a shed, garage, addition or porch.
- Roofing estimators and contractors pricing shingles and underlayment.
- AI agents and construction apps that need roof framing numbers or pitch conversions they can show their work for.

![A drawing made by this Actor for a 24 by 40 ft gable roof at 6/12: a to-scale section across the span with the rafters, 12 in overhangs and walls, a 6 ft rise and 14'-5-9/16" common rafters; 1,221 ft² of roof and 41 bundles of shingles](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/roof-framing-calculator-example.png?signature=1HwpW9J6goHdpSRbBnBBW)

### How to use it

1. Write **Roofs and pitches**, one per entry. The form has examples.
2. Optionally change the **Default shingle waste** (10% for gable and shed roofs, 15% for hip roofs).
3. Click **Start**. Each request is a row in the results, with its summary, drawing and report.

#### What you can write

| You write | It means |
|---|---|
| `gable`, `hip`, `shed` (or `lean-to`) | The roof style (gable by default) |
| `24 ft span`, `24x40 ft`, `30 ft wide 50 ft long` | The span the rafters cross and the building length (a footprint's short side is the span) |
| `6/12`, `6 pitch`, `6 in 12`, `30°`, `50%`, `5 ft rise` | The pitch, or the rise it comes from |
| `12 in overhang`, `rake overhang 8 in`, `no overhang` | Eave and rake overhangs (12" by default) |
| `2x8 rafters`, `16 in oc`, `24 o.c.` | Rafter size (2x8 by default) and spacing (16" by default) |
| `2x10 ridge`, `LVL ridge`, `double ridge` | Ridge thickness for the ridge deduction (1-1/2" by default) |
| `2x6 walls` | Wall plate width for the birdsmouth seat (3-1/2" by default) |
| `12% waste` | Shingle waste |
| `convert 30 degrees to pitch`, `8/12 pitch in degrees`, `4 ft rise over 12 ft run` | A pitch conversion |

The same as an object: `{"style": "gable", "span": "28 ft", "length": "36 ft", "pitch": "10/12", "overhang": "16 in", "rake": "8 in", "rafter": "2x10", "spacing": 24}` or `{"angle": 30}`.

### Examples

- `gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc` → rise 6'-0", common rafters 14'-5-9/16" (buy 16 ft), birdsmouth 3-1/2" × 1-3/4", ridge 6'-6-3/8" above the plates; 66 rafters, 1,221 ft² (12.2 squares), 41 bundles.
- `hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters` → commons 19'-9-1/16", hips 25'-8-3/8" (pitch on the hip 5.66/12), jacks step 1'-7-1/4"; 2,102 ft², 73 bundles with 15% waste.
- `shed roof 12 ft wide 16 ft long 3/12, 2x6 rafters 24 in oc` → the high wall 3'-0" taller, rafters 14'-5-3/16" with both overhangs, a note on double underlayment below 4/12.
- `convert 30 degrees to pitch` → 6.93/12, 57.74% slope, slope factor 1.1547.

### How-to examples

These are examples from **Examples** above, written as complete inputs; the result lines are from their runs.

#### How to calculate common rafter length for a gable roof

```json
{"requests": ["gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc"]}
```

Result: Rise 6'-0", common rafters 14'-5-9/16" (buy 16 ft), birdsmouth 3-1/2" × 1-3/4", ridge 6'-6-3/8" above the plates; 66 rafters, 1,221 ft² (12.2 squares), 41 bundles.

#### How to calculate hip and jack rafters

```json
{"requests": ["hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters"]}
```

Result: Commons 19'-9-1/16", hips 25'-8-3/8" (pitch on the hip 5.66/12), jacks step 1'-7-1/4"; 2,102 ft², 73 bundles with 15% waste.

#### How to convert roof angle in degrees to pitch

```json
{"requests": ["convert 30 degrees to pitch"]}
```

Result: 6.93/12, 57.74% slope, slope factor 1.1547.

#### How to let an AI agent work out roof framing

Add this Actor to the [Apify MCP server](https://mcp.apify.com) with `https://mcp.apify.com/?tools=jumblemog/roof-framing-calculator`. The agent writes the roof in one line ("gable roof, 24x40 ft, 6/12 pitch") and passes on the rafter lengths, cuts, roof area and shingle bundles instead of guessing them.

### FAQ

**Which roofs does it handle?** Gable, hip and shed roofs over one rectangle, plus pitch conversions between rise per 12, degrees and percent.

**Does it tell me if my rafter size is strong enough?** No. It works out the geometry; check the size against the IRC rafter span tables.

**Does it count shingles?** Yes: roof area in squares and bundles, with waste you can set.

**Does it do valleys or dormers?** No. Intersecting roofs, dormers, gambrel and mansard roofs aren't laid out.

**How many can I run at once?** Up to 200 roofs or pitches per run, each as a line of text or an object. A request that can't be computed isn't billed.

**Does it work with Zapier, Make or n8n?** Yes. Call the Actor with its Apify app or an HTTP request and pass the results on.

### Input

| Field | What it is |
|---|---|
| `requests` | Roofs or pitches, as lines of text or objects (up to 200 per run) |
| `waste` | Shingle waste % when a request doesn't say |
| `charts` | Draw each roof or pitch (default on) |

### Output

One dataset item per request, also saved together in the run's `OUTPUT` record:

```json
{
  "request": 1, "status": "ok", "type": "roof", "title": "Gable roof, 6/12 pitch, 24'-0\" span",
  "summary": "Gable roof, 6/12 (26.57°) over a 24'-0\" span: rise 6'-0\", common rafters 14'-5-9/16\" long (buy 16 ft 2x8), birdsmouth 3-1/2\" seat × 1-3/4\" deep, ridge 6'-6-3/8\" above the wall plates. Roof area 1,221 ft² (12.2 squares): 41 bundles of shingles with 10% waste, 66 common rafters.",
  "roof": {"style": "gable", "pitch": "6/12", "angle": 26.57, "span": 288, "run": 144, "rise": 72, "ridgeHeightAbovePlate": 78.36,
           "overhang": 12, "rafter": "2x8 (7.25\" deep)", "spacing": 16, "length": 480, "commonRafters": 66},
  "common": {"lineLength": 161.0, "ridgeDeduction": 0.8385, "tailLength": 13.42, "length": 173.6, "buyLength": "16 ft",
             "plumbCutAngle": 26.6, "seatCutAngle": 63.4, "birdsmouthSeat": 3.5, "birdsmouthDepth": 1.75, "heightAbovePlate": 6.356},
  "dimensions": {"rise": "6'-0\"", "commonLength": "14'-5-9/16\"", "ridgeHeight": "6'-6-3/8\"", "...": "..."},
  "area": {"roofArea": 1221, "squares": 12.21, "eaveFeet": 84, "rakeFeet": 58.14, "ridgeFeet": 42},
  "materials": {"wastePercent": 10, "shingleBundles": 41, "syntheticUnderlaymentRolls": 2, "feltRolls15lb": 4, "dripEdgePieces10ft": 15},
  "units": {"length": "in", "angle": "°", "area": "ft²", "edges": "ft"}
}
```

A hip roof adds `hip` (length, buy length, pitch on the hip, jack step and count). A pitch request has `pitch` (x/12, angle, percent, ratio, slope and hip factors, rise per foot) and `table` (1/12 to 12/12). Every item has `warnings`, `notes` (every assumption and default), a Markdown `report` and links to the drawing and report. A request that can't be computed has `"status": "failed"` and the reason in `error`, and isn't billed.

### How it works

1. **Run**: half the span for gable and hip roofs (the whole span for a shed), from the outside of the wall to the ridge center line.
2. **Common rafter**: (run − half the ridge thickness + overhang) × slope factor, where the slope factor is √(12² + pitch²) ÷ 12; the board to buy also covers the plumb cuts.
3. **Birdsmouth**: the seat is the wall plate width, its plumb depth is seat × pitch ÷ 12, and the height above plate is the rafter's plumb depth minus that; the ridge height is rise + height above plate.
4. **Hips**: the hip and valley factor √(2 × 12² + pitch²) ÷ 12 per foot of common run; jacks shorten by spacing × slope factor.
5. **Area and materials**: the plan area with overhangs × slope factor, 3 bundles per square plus waste, underlayment at 1,000 ft² (synthetic) or 400 ft² (15 lb felt) per roll with laps.

### Pricing

You pay one low price per request, at the price shown on this page: a roof, or a pitch conversion. The drawing and report are included. Requests that can't be computed are never charged. If you set a maximum cost per run, the Actor stops before a request that wouldn't fit.

### Speed

A request takes milliseconds. A run through the API answers in about 10 seconds, including the cloud container starting.

### Tips and limits

- **Check the rafter size.** This works out the geometry, not whether a 2x8 can span it; use the IRC rafter span tables (R802.4.1) or a structural calculator.
- **Rectangular roofs.** Gable, hip and shed roofs over one rectangle; valleys from intersecting roofs, dormers and gambrel or mansard roofs aren't laid out.
- **Shingle slope limits**: asphalt shingles need 2/12 or more, with double underlayment below 4/12 (IRC R905.2.2).
- **Limits**: 200 requests per run.

### For AI agents and developers

This Actor works with the [Apify MCP server](https://mcp.apify.com), so AI agents can call it as a tool. Pass `requests` as plain text and read `summary`, `common`, `area`, `materials` and `warnings`. A direct API call that waits for the answer:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~roof-framing-calculator/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"requests": ["gable roof 26x36 ft, 7/12, 16 in overhang, 2x10 rafters 24 in oc", "convert 9/12 to degrees"]}'
```

`run-sync` instead returns the run's `OUTPUT`: the status, the counts and every result as JSON.

In Python, with the `apify-client` package:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("jumblemog/roof-framing-calculator").call(run_input={
    "requests": [{"style": "hip", "span": "32 ft", "length": "48 ft", "pitch": "6/12", "overhang": "18 in"}],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["summary"])
```

### Credits

- Method: standard roof framing geometry (slope, hip and valley factors, ridge deduction, birdsmouth and height above plate); shingle slope limits from the *International Residential Code* 2021 R905.2.2. This Actor is not affiliated with the ICC.
- Drawings: [Vega-Lite](https://vega.github.io/vega-lite/) and [vl-convert](https://github.com/vega/vl-convert) (BSD-3-Clause), with the [Inter](https://rsms.me/inter/) font (SIL Open Font License).

# Actor input Schema

## `requests` (type: `array`):

One roof or pitch per entry, as a line of text or an object. Roof: the style (gable, hip or shed; gable by default), the span ('24 ft span') or footprint ('24x40 ft'), the pitch ('6/12', '6 pitch', '30°', '50%') or rise ('5 ft rise'), and any of: building length ('40 ft long'), eave overhang ('12 in overhang', default 12 in), rake overhang, rafter size ('2x8 rafters', default 2x8), spacing ('16 in oc'), ridge ('2x10 ridge' = 1-1/2 in, 'LVL ridge', 'double ridge'), wall plate ('2x6 walls'), shingle waste ('12% waste'). Pitch: 'convert 30 degrees to pitch', '8/12 pitch in degrees', '4 ft rise over 12 ft run'. Object fields: type (roof, pitch), style, span, length, pitch, angle, slopePercent, rise, run, overhang, rake, rafter, rafterDepth, spacing, ridge, plate, waste, title, text.

## `waste` (type: `integer`):

Extra shingles added when a request doesn't say (10% for gable and shed roofs, 15% for hip roofs by default).

## `charts` (type: `boolean`):

A to-scale section across the roof with the rafters, overhangs, walls and rise, or a pitch triangle with the common pitches.

## Actor input object example

```json
{
  "requests": [
    "gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc",
    "hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters",
    "shed roof 12 ft wide 16 ft long 3/12, 2x6 rafters 24 in oc",
    "garage roof 24 ft span, 5 ft rise, 2x6 walls",
    "convert 30 degrees to pitch",
    {
      "style": "gable",
      "span": "28 ft",
      "length": "36 ft",
      "pitch": "10/12",
      "overhang": "16 in",
      "rake": "8 in",
      "rafter": "2x10",
      "spacing": 24
    }
  ],
  "charts": true
}
```

# Actor output Schema

## `results` (type: `string`):

One row per request: the summary and chart.

## `output` (type: `string`):

The OUTPUT record: every result in one JSON object.

## `files` (type: `string`):

Drawings (PNG and SVG) and Markdown reports in the run's key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "requests": [
        "gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc",
        "hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters",
        "shed roof 12 ft wide 16 ft long 3/12, 2x6 rafters 24 in oc",
        "garage roof 24 ft span, 5 ft rise, 2x6 walls",
        "convert 30 degrees to pitch",
        {
            "style": "gable",
            "span": "28 ft",
            "length": "36 ft",
            "pitch": "10/12",
            "overhang": "16 in",
            "rake": "8 in",
            "rafter": "2x10",
            "spacing": 24
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/roof-framing-calculator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "requests": [
        "gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc",
        "hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters",
        "shed roof 12 ft wide 16 ft long 3/12, 2x6 rafters 24 in oc",
        "garage roof 24 ft span, 5 ft rise, 2x6 walls",
        "convert 30 degrees to pitch",
        {
            "style": "gable",
            "span": "28 ft",
            "length": "36 ft",
            "pitch": "10/12",
            "overhang": "16 in",
            "rake": "8 in",
            "rafter": "2x10",
            "spacing": 24,
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/roof-framing-calculator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "requests": [
    "gable roof, 24x40 ft, 6/12 pitch, 12 in overhang, 2x8 rafters 16 in oc",
    "hip roof 30x50 ft, 8/12, 18 in overhang, 2x10 rafters",
    "shed roof 12 ft wide 16 ft long 3/12, 2x6 rafters 24 in oc",
    "garage roof 24 ft span, 5 ft rise, 2x6 walls",
    "convert 30 degrees to pitch",
    {
      "style": "gable",
      "span": "28 ft",
      "length": "36 ft",
      "pitch": "10/12",
      "overhang": "16 in",
      "rake": "8 in",
      "rafter": "2x10",
      "spacing": 24
    }
  ]
}' |
apify call jumblemog/roof-framing-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/roof-framing-calculator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NPqVCviKEMBcctUmM/builds/dXEOvPv3TUrgeO6Fe/openapi.json
