Truss Roof Geometry Calculator
Use this calculator to estimate key geometric dimensions and material quantities for a standard gable truss roof. Input your building's span, length, desired roof pitch, truss overhang, and spacing to get instant calculations for roof rise, rafter length, total roof area, and estimated truss and chord material lengths.
Calculation Results:
Calculated Roof Rise: 0.00 m
Individual Rafter Length (Top Chord): 0.00 m
Total Roof Surface Area: 0.00 sq m
Estimated Number of Trusses: 0 units
Total Top Chord Material Length: 0.00 m
Total Bottom Chord Material Length: 0.00 m
function calculateTrussRoof() {
var buildingSpan = parseFloat(document.getElementById("buildingSpan").value);
var buildingLength = parseFloat(document.getElementById("buildingLength").value);
var roofPitch = parseFloat(document.getElementById("roofPitch").value);
var trussOverhang = parseFloat(document.getElementById("trussOverhang").value);
var trussSpacing = parseFloat(document.getElementById("trussSpacing").value);
// Input validation
if (isNaN(buildingSpan) || buildingSpan <= 0) {
alert("Please enter a valid Building Span (greater than 0).");
return;
}
if (isNaN(buildingLength) || buildingLength <= 0) {
alert("Please enter a valid Building Length (greater than 0).");
return;
}
if (isNaN(roofPitch) || roofPitch = 90) {
alert("Please enter a valid Roof Pitch (between 1 and 89 degrees).");
return;
}
if (isNaN(trussOverhang) || trussOverhang < 0) {
alert("Please enter a valid Truss Overhang (0 or greater).");
return;
}
if (isNaN(trussSpacing) || trussSpacing <= 0) {
alert("Please enter a valid Truss Spacing (greater than 0).");
return;
}
// Convert pitch to radians
var pitchRadians = roofPitch * (Math.PI / 180);
// Calculate half span
var halfSpan = buildingSpan / 2;
// 1. Calculated Roof Rise (vertical height from wall plate to ridge)
var calculatedRoofRise = halfSpan * Math.tan(pitchRadians);
// 2. Individual Rafter Length (length of one top chord member over the span)
var individualRafterLength = Math.sqrt(Math.pow(halfSpan, 2) + Math.pow(calculatedRoofRise, 2));
// 3. Total Roof Surface Area
// Each roof plane's length along the slope is (individualRafterLength + trussOverhang)
// Each roof plane's width is the building length
var totalRoofSurfaceArea = 2 * (individualRafterLength + trussOverhang) * buildingLength;
// 4. Estimated Number of Trusses
// Add 1 for the first truss at the start of the building length
var estimatedNumberOfTrusses = Math.ceil(buildingLength / trussSpacing) + 1;
// 5. Total Top Chord Material Length
// Each truss has two top chords, and each includes the overhang
var totalTopChordMaterial = estimatedNumberOfTrusses * 2 * (individualRafterLength + trussOverhang);
// 6. Total Bottom Chord Material Length
// Each truss has one bottom chord equal to the building span
var totalBottomChordMaterial = estimatedNumberOfTrusses * buildingSpan;
// Display results
document.getElementById("calculatedRoofRise").textContent = calculatedRoofRise.toFixed(2);
document.getElementById("individualRafterLength").textContent = individualRafterLength.toFixed(2);
document.getElementById("totalRoofSurfaceArea").textContent = totalRoofSurfaceArea.toFixed(2);
document.getElementById("estimatedNumberOfTrusses").textContent = Math.round(estimatedNumberOfTrusses);
document.getElementById("totalTopChordMaterial").textContent = totalTopChordMaterial.toFixed(2);
document.getElementById("totalBottomChordMaterial").textContent = totalBottomChordMaterial.toFixed(2);
}
// Run calculation on page load with default values
window.onload = calculateTrussRoof;
.truss-roof-calculator {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f9f9f9;
padding: 25px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 700px;
margin: 20px auto;
border: 1px solid #e0e0e0;
}
.truss-roof-calculator h2 {
color: #2c3e50;
text-align: center;
margin-bottom: 20px;
font-size: 1.8em;
}
.truss-roof-calculator p {
color: #555;
line-height: 1.6;
margin-bottom: 15px;
}
.calculator-inputs label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #34495e;
font-size: 0.95em;
}
.calculator-inputs input[type="number"] {
width: calc(100% – 22px);
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 1em;
box-sizing: border-box;
}
.calculator-inputs .input-description {
font-size: 0.85em;
color: #777;
margin-top: -5px;
margin-bottom: 15px;
}
.calculator-inputs button {
background-color: #3498db;
color: white;
padding: 12px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1.1em;
width: 100%;
transition: background-color 0.3s ease;
margin-top: 15px;
}
.calculator-inputs button:hover {
background-color: #2980b9;
}
.calculator-results {
background-color: #ecf0f1;
padding: 20px;
border-radius: 8px;
margin-top: 30px;
border: 1px solid #dcdcdc;
}
.calculator-results h3 {
color: #2c3e50;
margin-top: 0;
margin-bottom: 15px;
font-size: 1.4em;
border-bottom: 2px solid #bdc3c7;
padding-bottom: 10px;
}
.calculator-results p {
margin-bottom: 10px;
font-size: 1.05em;
color: #34495e;
}
.calculator-results p strong {
color: #2c3e50;
min-width: 200px;
display: inline-block;
}
.calculator-results span {
font-weight: bold;
color: #e74c3c;
}
Understanding Truss Roof Geometry
A truss roof is a structural framework of interconnected members, typically made of wood or metal, that forms the roof structure. Trusses are designed to efficiently transfer loads to the building's exterior walls, allowing for wider spans and more open interior spaces compared to traditional stick-built roofs.
Key Components and Terminology:
- Building Span: This is the horizontal distance between the outer edges of the supporting walls. It dictates the overall width of the truss.
- Building Length: The total length of the structure along the ridge line, which determines how many trusses are needed.
- Roof Pitch (Slope): The angle of the roof surface relative to a horizontal plane, usually expressed in degrees or as a ratio (e.g., 4/12). A steeper pitch allows for better water runoff and can create more attic space.
- Roof Rise: The vertical distance from the top of the wall plate to the peak (ridge) of the roof. It's directly related to the span and pitch.
- Rafter Length (Top Chord): The length of the sloped member of the truss that forms the roof surface, from the wall plate to the ridge. This is a critical dimension for roofing material estimation.
- Truss Overhang: The portion of the truss that extends horizontally beyond the exterior wall, forming the eaves. This provides protection for the walls and can be an aesthetic feature.
- Truss Spacing: The center-to-center distance between adjacent trusses. Common spacings are 0.6m (24 inches) or 1.2m (48 inches), depending on local building codes and roofing material requirements.
- Bottom Chord: The horizontal member of the truss that typically forms the ceiling joist for the space below.
How the Calculator Works:
This calculator uses basic trigonometry and geometry to derive the roof's dimensions:
- Roof Rise: Calculated using the half-span and the tangent of the roof pitch (
Rise = (Span / 2) * tan(Pitch)).
- Rafter Length: Determined using the Pythagorean theorem, based on the half-span and the calculated roof rise (
Rafter Length = sqrt((Span / 2)^2 + Rise^2)).
- Total Roof Surface Area: This is the sum of the areas of the two sloped roof planes. Each plane's length along the slope is the rafter length plus the overhang, multiplied by the building length (
Area = 2 * (Rafter Length + Overhang) * Building Length).
- Number of Trusses: Estimated by dividing the building length by the truss spacing and adding one for the starting truss (
Number of Trusses = ceil(Building Length / Spacing) + 1).
- Total Top Chord Material: The sum of all top chord lengths for all trusses, including the overhang portion (
Total Top Chord = Number of Trusses * 2 * (Rafter Length + Overhang)).
- Total Bottom Chord Material: The sum of all bottom chord lengths for all trusses (
Total Bottom Chord = Number of Trusses * Span).
These calculations provide essential figures for planning, material ordering, and budgeting for your truss roof project. Always consult with a structural engineer and local building codes for final design and construction.