A gambrel roof, often recognized by its distinctive two-sided shape with a shallow upper slope and a steeper lower slope, is a common feature in barns, Dutch colonial homes, and other structures where maximizing interior headroom is desirable. Gambrel roof trusses are specifically engineered to support this unique geometry. This calculator helps determine key dimensions for building these trusses based on your roof's span and the desired rafter angles.
The Math Behind the Gambrel Roof Truss
Calculating gambrel roof truss dimensions involves trigonometry and geometric principles. The primary inputs are the total span width of the roof, the angles of the lower and upper rafters, and any desired overhang.
Span Width (S): The total horizontal distance the roof covers from one outside wall to the other.
Lower Rafter Angle (α): The angle of the steeper, lower portion of the roof with respect to the horizontal.
Upper Rafter Angle (β): The angle of the shallower, upper portion of the roof with respect to the horizontal.
Overhang (O): The horizontal extension of the roof beyond the exterior walls.
Key Calculations:
The calculator determines the lengths of the various structural members of the truss. Here's a simplified breakdown of the calculations performed:
Half Span Calculation:
The horizontal distance from the center peak to the wall plate is S / 2.
Peak Height Calculation:
The total height from the wall plate to the peak is determined by the rafter angles and the span. Let W_L be the horizontal run of the lower rafter and W_U be the horizontal run of the upper rafter.
We know W_L + W_U = S / 2.
Also, tan(α) = H / W_L and tan(β) = H / W_U, where H is the total height.
From these, W_L = H / tan(α) and W_U = H / tan(β).
Substituting into the span equation: H / tan(α) + H / tan(β) = S / 2.
Solving for H: H = (S / 2) / (1 / tan(α) + 1 / tan(β)).
This height H is the sum of the vertical rise of the lower and upper sections.
Rafter Length Calculations:
Once the height and horizontal runs are known:
Lower Rafter Length = sqrt(W_L^2 + H_L^2), where H_L is the vertical rise of the lower section.
Upper Rafter Length = sqrt(W_U^2 + H_U^2), where H_U is the vertical rise of the upper section.
The calculation needs to accurately break down the total height H into H_L and H_U based on the angles and their distribution across the span. A common method is to first solve for the horizontal runs W_L and W_U based on the total span and the *ratio* of tangents, then calculate heights.
A more direct approach often used is to find the horizontal projection of each rafter section. Let the horizontal distance from the center peak to where the angle changes be x. Then the horizontal run of the upper rafter is x and the horizontal run of the lower rafter is (S/2) - x.
The total height H is related by tan(β) = H / x and tan(α) = H / ((S/2) - x).
Solving for x: x = H / tan(β) and (S/2) - x = H / tan(α).
Substitute: (S/2) - H/tan(β) = H/tan(α).
S/2 = H/tan(α) + H/tan(β) = H * (1/tan(α) + 1/tan(β)).
H = (S/2) / (1/tan(α) + 1/tan(β)).
Once H is known, we find x: x = H / tan(β).
And the horizontal run of the lower section: W_L = (S/2) - x.
The vertical rise of the upper section is H_U = H (this is incorrect, H is total height)
Correcting: The total height H is calculated. The horizontal run of the upper section is W_U = H / tan(β). The horizontal run of the lower section is W_L = (S/2) - W_U.
The vertical rise of the upper section is H_U = W_U * tan(β).
The vertical rise of the lower section is H_L = W_L * tan(α).
Note: H_U + H_L should equal H. The formula for H is the key.
Upper Rafter Length = sqrt(W_U^2 + H_U^2) Lower Rafter Length = sqrt(W_L^2 + H_L^2)
Overhang Calculation:
The overhang adds extra length to the lower rafters, extending horizontally beyond the wall plate. The actual length added to the lower rafter to create the overhang depends on the lower rafter angle.
Overhang Length = Overhang / cos(α)
The total length of the lower rafter including overhang is Lower Rafter Length + Overhang Length.
How to Use the Calculator
Roof Span Width: Enter the total horizontal distance the roof needs to cover in feet.
Lower Rafter Angle: Input the desired angle (in degrees) for the steeper, lower section of the roof. Common angles are between 45° and 70°.
Upper Rafter Angle: Input the desired angle (in degrees) for the shallower, upper section of the roof. Common angles are between 15° and 45°.
Overhang: Enter the desired horizontal extension of the roof beyond the walls in feet (e.g., 1 ft, 1.5 ft). If no overhang is desired, enter 0.
Click "Calculate Truss Dimensions".
Example Calculation
Let's calculate for a roof with:
Roof Span Width: 30 ft
Lower Rafter Angle: 55°
Upper Rafter Angle: 30°
Overhang: 1.5 ft
The calculator will output the calculated dimensions for the lower and upper rafters, including the overhang extension for the lower rafter.
function calculateGambrelTruss() {
var spanWidth = parseFloat(document.getElementById("spanWidth").value);
var lowerRafterAngleDeg = parseFloat(document.getElementById("lowerRafterAngle").value);
var upperRafterAngleDeg = parseFloat(document.getElementById("upperRafterAngle").value);
var overhang = parseFloat(document.getElementById("overhang").value);
var resultDiv = document.getElementById("result");
// Input validation
if (isNaN(spanWidth) || spanWidth <= 0 ||
isNaN(lowerRafterAngleDeg) || lowerRafterAngleDeg = 90 ||
isNaN(upperRafterAngleDeg) || upperRafterAngleDeg = 90 ||
isNaN(overhang) || overhang < 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
if (lowerRafterAngleDeg x = H / tan(upperRafterAngleRad)
// tan(lowerRafterAngleRad) = H / (halfSpan – x) => (halfSpan – x) = H / tan(lowerRafterAngleRad)
// Substitute x: halfSpan – (H / tan(upperRafterAngleRad)) = H / tan(lowerRafterAngleRad)
// halfSpan = H * (1/tan(upperRafterAngleRad) + 1/tan(lowerRafterAngleRad))
// H = halfSpan / (1/tan(upperRafterAngleRad) + 1/tan(lowerRafterAngleRad))
var term1 = 1 / Math.tan(upperRafterAngleRad);
var term2 = 1 / Math.tan(lowerRafterAngleRad);
var totalHeight = halfSpan / (term1 + term2);
var upperRafterHorizontalRun = totalHeight / Math.tan(upperRafterAngleRad);
var lowerRafterHorizontalRun = halfSpan – upperRafterHorizontalRun;
// Sanity check: Ensure lower horizontal run is positive
if (lowerRafterHorizontalRun <= 0) {
resultDiv.innerHTML = "Angles result in an invalid geometry. Adjust angles.";
return;
}
var upperRafterVerticalRise = upperRafterHorizontalRun * Math.tan(upperRafterAngleRad);
var lowerRafterVerticalRise = lowerRafterHorizontalRun * Math.tan(lowerRafterAngleRad);
// Recalculate total height to ensure consistency, though the initial H is based on this sum.
// This is more for verification.
var calculatedTotalHeight = upperRafterVerticalRise + lowerRafterVerticalRise;
// Use the initially calculated totalHeight for rafter length calculations to maintain consistency based on the primary equation.
// Calculate actual rafter lengths (hypotenuse)
var lowerRafterLength = Math.sqrt(Math.pow(lowerRafterHorizontalRun, 2) + Math.pow(lowerRafterVerticalRise, 2));
var upperRafterLength = Math.sqrt(Math.pow(upperRafterHorizontalRun, 2) + Math.pow(upperRafterVerticalRise, 2));
// Calculate the additional length needed for the overhang
var overhangAddedLength = overhang / Math.cos(lowerRafterAngleRad);
var totalLowerRafterWithOverhang = lowerRafterLength + overhangAddedLength;
var formattedResult = "