{
  "id": "rafter",
  "version": "32d37d711576",
  "status": "published",
  "name": "Rafter Calculator",
  "question": "How long are my rafters?",
  "summary": "Computes common rafter length from the building span, roof pitch, ridge board and overhang, with the rise, roof angle, lumber length to buy and how many rafters you need.",
  "category": "construction",
  "subcategory": "roofing",
  "url": "https://www.acalculator.org/construction/rafter-calculator",
  "markdown": "https://www.acalculator.org/construction/rafter-calculator.md",
  "kind": "function",
  "method": "Run = (span − ridge) ÷ 2; slope factor = √(12² + pitch²) ÷ 12; rafter = (run + overhang) × slope factor; rise = run × pitch ÷ 12; angle = arctan(pitch ÷ 12); rafters = 2 × (⌈building length ÷ spacing⌉ + 1).",
  "assumptions": [
    "Common rafters from the ridge board to the tail, measured along the top edge (the line length); no bird’s mouth or plumb-cut allowance.",
    "The overhang is measured level, from the outside of the wall.",
    "Boards are sold in 2 ft steps (Kreg Tool: 6 to 20 ft in 2 ft increments); longer rafters may need a special order.",
    "Spacing is 16 in on center by default, with one rafter at each end of each side."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "span": {
        "title": "Building span",
        "description": "The width of the building, outside of wall to outside of wall.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 200
      },
      "pitch": {
        "title": "Roof pitch (in 12)",
        "description": "Inches of rise for every 12 inches of run, for example 6 for a 6/12 roof.",
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 24
      },
      "oh": {
        "title": "Overhang",
        "description": "How far the eave sticks out past the wall, measured level.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0,
        "maximum": 10
      },
      "ridge": {
        "title": "Ridge board thickness",
        "description": "The thickness of the ridge board; 1.5 in for a 2× board. 0 for none.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0,
        "maximum": 10
      },
      "len": {
        "title": "Building length",
        "description": "The length of the wall the rafters sit along.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 200
      },
      "oc": {
        "title": "Rafter spacing",
        "description": "The distance from the center of one rafter to the next.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.0254,
        "maximum": 10
      }
    }
  },
  "outputs": {
    "rafterFt": {
      "label": "Rafter length (ft)",
      "description": "The length along the slope, ridge to tail, in feet.",
      "format": "number"
    },
    "rafterM": {
      "label": "Rafter length (m)",
      "description": "The same length in metres.",
      "format": "number"
    },
    "rafterIn": {
      "label": "Rafter length (in)",
      "description": "The same length in inches.",
      "format": "number"
    },
    "buy": {
      "label": "Board length to buy (ft)",
      "description": "The rafter length rounded up to the next even foot.",
      "format": "integer"
    },
    "count": {
      "label": "Rafters",
      "description": "Rafters on both sides of the ridge.",
      "format": "integer"
    },
    "riseFt": {
      "label": "Rise (ft)",
      "description": "How high the roof rises over the run: run × pitch ÷ 12.",
      "format": "number"
    },
    "riseM": {
      "label": "Rise (m)",
      "description": "The rise in metres.",
      "format": "number"
    },
    "runFt": {
      "label": "Run (ft)",
      "description": "Half the span minus half the ridge board, in feet.",
      "format": "number"
    },
    "angle": {
      "label": "Roof angle (°)",
      "description": "The angle of the roof above level: arctan(pitch ÷ 12).",
      "format": "number"
    },
    "factor": {
      "label": "Slope factor",
      "description": "Rafter length per unit of run: √(12² + pitch²) ÷ 12.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "span": 7.315200000000001,
      "pitch": 6,
      "oh": 0.30479999999999996,
      "ridge": 0.038099999999999995,
      "len": 12.192,
      "oc": 0.4064
    },
    "outputs": {
      "rafterFt": 14.464564729451766,
      "rafterM": 4.408799329536898,
      "rafterIn": 173.5747767534212,
      "buy": 16,
      "count": 62,
      "riseFt": 5.96875,
      "riseM": 1.819275,
      "runFt": 11.9375,
      "angle": 26.56505117707799,
      "factor": 1.118033988749895
    },
    "text": "Each rafter is 14.46 ft long (buy 16 ft boards); you need 62 rafters."
  },
  "examples": [
    {
      "given": {
        "span": 7.315200000000001,
        "pitch": 5,
        "oh": 0,
        "ridge": 0,
        "len": 12.192,
        "oc": 0.4064
      },
      "expect": {
        "factor": 1.0833333333333333,
        "rafterFt": 13,
        "buy": 14,
        "riseFt": 5,
        "count": 62
      },
      "source": "Pythagorean theorem (OpenStax, Prealgebra 2e, §9.3). https://openstax.org/books/prealgebra-2e/pages/9-3-use-properties-of-angles-triangles-and-the-pythagorean-theorem; hand calculation in content.mdx: run 12 ft, rise 5 ft, √(12² + 5²) = 13 ft; 40 ft ÷ 16 in = 30, + 1 = 31 per side"
    },
    {
      "given": {
        "span": 7.315200000000001,
        "pitch": 6,
        "oh": 0.30479999999999996,
        "ridge": 0.038099999999999995,
        "len": 12.192,
        "oc": 0.4064
      },
      "expect": {
        "runFt": 11.9375,
        "rafterFt": 14.464564729451766,
        "buy": 16,
        "angle": 26.565051177077994
      },
      "source": "Pythagorean theorem (OpenStax, Prealgebra 2e, §9.3). https://openstax.org/books/prealgebra-2e/pages/9-3-use-properties-of-angles-triangles-and-the-pythagorean-theorem; Kreg Tool, Ultimate Guide to Lumber Dimensions (2× lumber is 1.5 in thick; lengths in 2 ft steps). https://learn.kregtool.com/learn/understand-lumber-sizing/; hand calculation in content.mdx: (11.9375 + 1) × √180 ÷ 12 = 14.46 ft, buy 16 ft"
    },
    {
      "given": {
        "span": 8,
        "pitch": 9,
        "oh": 0.5,
        "ridge": 0.04,
        "len": 10,
        "oc": 0.6
      },
      "expect": {
        "factor": 1.25,
        "rafterM": 5.6,
        "riseM": 2.985,
        "count": 36
      },
      "source": "Pythagorean theorem (OpenStax, Prealgebra 2e, §9.3). https://openstax.org/books/prealgebra-2e/pages/9-3-use-properties-of-angles-triangles-and-the-pythagorean-theorem; hand calculation in content.mdx: run (8 − 0.04) ÷ 2 = 3.98 m; (3.98 + 0.5) × 15 ÷ 12 = 5.6 m; rise 3.98 × 9 ÷ 12 = 2.985 m; ⌈10 ÷ 0.6⌉ + 1 = 18 per side"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, §9.3 Use Properties of Angles, Triangles, and the Pythagorean Theorem. https://openstax.org/books/prealgebra-2e/pages/9-3-use-properties-of-angles-triangles-and-the-pythagorean-theorem (retrieved 2026-10-01)",
    "Kreg Tool, Ultimate Guide to Lumber Dimensions: Actual vs Nominal Sizes (a nominal 2× board is 1.5 in thick; most dimensional lumber comes in 6 to 20 ft lengths in 2 ft increments). https://learn.kregtool.com/learn/understand-lumber-sizing/ (retrieved 2026-10-01)",
    "NIST Handbook 44 (2026), Appendix C, General Tables of Units of Measurement: 1 ft = 12 in = 0.3048 m. https://www.nist.gov/document/2026-nist-handbook-44-appendix-c (retrieved 2026-10-01)"
  ],
  "related": [
    "roof-pitch",
    "roofing",
    "stair"
  ],
  "changelog": []
}
