Calculate rafter lengths, peak height, and quantity for your framing project.
12″
16″
24″
Peak Height0
Rafter Length (Each Side)0
Total Trusses Required0
Roof Surface Area (sq ft)0
Understanding Roof Truss Dimensions
Designing a roof requires precise geometry to ensure structural integrity and proper water runoff. This truss calculator helps you determine the essential measurements for a standard common truss gable roof.
Key Terms Explained:
Span: The total horizontal distance the truss will cover, usually from the outside of one wall to the outside of the opposite wall.
Pitch: The steepness of the roof, expressed as vertical rise over 12 inches of horizontal run (e.g., a 6/12 pitch rises 6 inches for every foot of horizontal distance).
Overhang: The portion of the rafter that extends past the exterior wall.
Spacing (OC): "On Center" spacing refers to the distance from the center of one truss to the center of the next.
How the Math Works
To find the Peak Height, we calculate: (Span / 2) * (Pitch / 12). For a 24ft span with a 6/12 pitch, the peak height is 6 feet above the top plate.
To find the Rafter Length (excluding overhang), we use the Pythagorean theorem: a² + b² = c², where 'a' is the rise and 'b' is half the span (the run).
Material Estimation Example
If you are building a 40-foot long shed with trusses spaced 24 inches on center, you divide 40 by 2, which equals 20 spaces. You then add 1 for the starting truss, totaling 21 trusses for the project.
function calculateTruss() {
var span = parseFloat(document.getElementById('trussSpan').value);
var pitch = parseFloat(document.getElementById('trussPitch').value);
var overhangInches = parseFloat(document.getElementById('trussOverhang').value);
var buildLength = parseFloat(document.getElementById('buildLength').value);
var spacingInches = parseFloat(document.getElementById('trussSpacing').value);
if (isNaN(span) || isNaN(pitch) || isNaN(overhangInches) || isNaN(buildLength)) {
alert("Please enter valid numerical values.");
return;
}
// 1. Calculate Peak Height (Rise)
// Rise = (Span / 2) * (Pitch / 12)
var halfSpan = span / 2;
var peakHeight = halfSpan * (pitch / 12);
// 2. Calculate Rafter Length (Hypotenuse of the triangle)
// Length = sqrt(rise^2 + run^2)
var rafterLengthBase = Math.sqrt(Math.pow(peakHeight, 2) + Math.pow(halfSpan, 2));
// Adjust for overhang (the overhang adds to the horizontal run)
var overhangFeet = overhangInches / 12;
var overhangRise = overhangFeet * (pitch / 12);
var overhangHypotenuse = Math.sqrt(Math.pow(overhangFeet, 2) + Math.pow(overhangRise, 2));
var totalRafterLength = rafterLengthBase + overhangHypotenuse;
// 3. Calculate Number of Trusses
// (Length / Spacing) + 1
var spacingFeet = spacingInches / 12;
var trussCount = Math.ceil(buildLength / spacingFeet) + 1;
// 4. Calculate Surface Area (Total Roof)
// Area = 2 sides * (Rafter Length * Building Length)
var surfaceArea = 2 * (totalRafterLength * buildLength);
// Display Results
document.getElementById('resPeakHeight').innerText = peakHeight.toFixed(2) + " ft";
document.getElementById('resRafterLength').innerText = totalRafterLength.toFixed(2) + " ft";
document.getElementById('resTrussCount').innerText = trussCount + " units";
document.getElementById('resSurfaceArea').innerText = Math.round(surfaceArea).toLocaleString() + " sq ft";
document.getElementById('trussResults').style.display = 'block';
}