Roof Rafter Calculator

.rafter-calc-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; border: 1px solid #ddd; border-radius: 8px; background-color: #f9f9f9; color: #333; line-height: 1.6; } .rafter-calc-container h2 { color: #2c3e50; text-align: center; margin-bottom: 25px; } .rafter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; } @media (max-width: 600px) { .rafter-grid { grid-template-columns: 1fr; } } .input-group { display: flex; flex-direction: column; } .input-group label { font-weight: 600; margin-bottom: 5px; font-size: 0.9em; } .input-group input, .input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; } .calc-button { width: 100%; padding: 15px; background-color: #27ae60; color: white; border: none; border-radius: 4px; font-size: 1.1em; font-weight: bold; cursor: pointer; transition: background 0.3s; } .calc-button:hover { background-color: #219150; } .result-display { margin-top: 25px; padding: 20px; background-color: #fff; border-left: 5px solid #27ae60; border-radius: 4px; display: none; } .result-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; } .result-item:last-child { border-bottom: none; } .result-label { font-weight: 600; } .result-value { color: #27ae60; font-weight: bold; } .article-section { margin-top: 40px; border-top: 1px solid #ddd; padding-top: 20px; } .article-section h3 { color: #2c3e50; margin-top: 20px; }

Roof Rafter Calculator

12 inches 16 inches 24 inches
Rafter Length (to ridge): 0.00 ft
Total Length (incl. overhang): 0.00 ft
Roof Angle (Pitch): 0.00°
Total Rafters Needed: 0

How to Use the Roof Rafter Calculator

Calculating the exact length of roof rafters is critical for any framing project. This tool helps you determine the rafter length, the angle of the cut, and the total quantity of lumber required based on your building's dimensions.

Understanding Key Terms

  • Span: The total width of the building from the outside of one wall plate to the outside of the opposite wall plate.
  • Rise: The vertical height increase for every 12 inches of horizontal run (commonly referred to as the pitch, e.g., 6/12).
  • Run: Half of the span (minus half the ridge board thickness).
  • Overhang: The portion of the rafter that extends beyond the exterior wall.
  • On Center (OC): The distance from the center of one rafter to the center of the next.

The Math Behind Rafters

The calculation uses the Pythagorean theorem (a² + b² = c²). To find the rafter length:

  1. Determine the Run (Span / 2).
  2. Subtract half the thickness of the Ridge Board from the Run.
  3. Calculate the Total Rise based on the pitch.
  4. Calculate the hypotenuse: Length = √(Run² + Rise²).
  5. Add the Overhang hypotenuse to get the full board length.

Practical Example

Imagine a shed with a 12-foot span and a 4/12 pitch. The run is 6 feet. If you have no ridge board and a 12-inch overhang, the base rafter length is roughly 6.32 feet. Adding the overhang (approx 1.05 feet at that angle) brings the total board length to about 7.37 feet. You would likely purchase 8-foot lumber to account for the birdsmouth cut and tail trimming.

function calculateRafters() { var span = parseFloat(document.getElementById('buildingSpan').value); var pitchRise = parseFloat(document.getElementById('roofRise').value); var overhangInches = parseFloat(document.getElementById('overhang').value); var ridgeThick = parseFloat(document.getElementById('ridgeThickness').value); var roofLen = parseFloat(document.getElementById('roofLength').value); var spacing = parseFloat(document.getElementById('rafterSpacing').value); if (isNaN(span) || isNaN(pitchRise) || isNaN(overhangInches) || isNaN(ridgeThick) || isNaN(roofLen)) { alert("Please fill in all fields with valid numbers."); return; } // 1. Calculate the Adjusted Run (ft) // Run is half the span minus half the ridge board thickness var run = (span / 2) – ((ridgeThick / 12) / 2); // 2. Calculate Angle // Pitch is rise/12, so angle is atan(rise/12) var angleRad = Math.atan(pitchRise / 12); var angleDeg = angleRad * (180 / Math.PI); // 3. Calculate Rafter Length (Hypotenuse of the run) var rafterLength = run / Math.cos(angleRad); // 4. Calculate Overhang Hypotenuse var overhangRunFeet = overhangInches / 12; var overhangHyp = overhangRunFeet / Math.cos(angleRad); // 5. Total Length var totalRafterLength = rafterLength + overhangHyp; // 6. Total Rafter Count // Rafters are needed on both sides. // Count = (Length / Spacing) + 1, then double for gable sides. var spacingFeet = spacing / 12; var countPerSide = Math.ceil(roofLen / spacingFeet) + 1; var totalCount = countPerSide * 2; // Display Results document.getElementById('resLength').innerHTML = rafterLength.toFixed(2) + " ft"; document.getElementById('resTotalLength').innerHTML = totalRafterLength.toFixed(2) + " ft"; document.getElementById('resAngle').innerHTML = angleDeg.toFixed(2) + "°"; document.getElementById('resCount').innerHTML = totalCount; document.getElementById('results').style.display = 'block'; }

Leave a Comment