King Post Truss Design Calculator
Use this calculator to determine key dimensions for building a King Post roof truss. This tool helps you calculate the rise, chord lengths, web lengths, and angles based on your desired span, pitch, and lumber dimensions.
Calculated Truss Dimensions:
| Total Truss Rise (Peak Height): | |
| Top Chord Segment Length (Heel to Peak): | |
| Total Top Chord Length (incl. overhangs): | |
| King Post Length: | |
| Diagonal Web Length (each): | |
| Heel Height: | |
| Top Chord Angle: | |
| Total Linear Feet of Lumber (for one truss): | |
Note: These calculations are for a standard King Post truss geometry and do not account for structural loads, connections, or specific building codes. Always consult with a qualified engineer or professional for final truss design and safety.
function calculateTruss() {
var trussSpan = parseFloat(document.getElementById('trussSpan').value);
var roofPitchRise = parseFloat(document.getElementById('roofPitchRise').value);
var roofPitchRun = parseFloat(document.getElementById('roofPitchRun').value);
var overhangLength = parseFloat(document.getElementById('overhangLength').value);
var topChordDepthIn = parseFloat(document.getElementById('topChordDepth').value);
var bottomChordDepthIn = parseFloat(document.getElementById('bottomChordDepth').value);
// Input validation
if (isNaN(trussSpan) || isNaN(roofPitchRise) || isNaN(roofPitchRun) || isNaN(overhangLength) || isNaN(topChordDepthIn) || isNaN(bottomChordDepthIn) ||
trussSpan <= 0 || roofPitchRise <= 0 || roofPitchRun <= 0 || overhangLength < 0 || topChordDepthIn <= 0 || bottomChordDepthIn <= 0) {
alert("Please enter valid positive numbers for all fields. Pitch Run cannot be zero.");
document.getElementById('trussResults').style.display = 'none';
return;
}
// Unit Conversion: inches to feet
var topChordDepthFt = topChordDepthIn / 12;
var bottomChordDepthFt = bottomChordDepthIn / 12;
// Basic Geometry
var halfSpan = trussSpan / 2;
var riseFromPitch = halfSpan * (roofPitchRise / roofPitchRun); // Vertical rise from top of bottom chord to top of top chord at peak
// Top Chord Angle
var topChordAngleRad = Math.atan(riseFromPitch / halfSpan);
var topChordAngleDeg = topChordAngleRad * (180 / Math.PI);
// Vertical projection of top chord depth (used for heel and king post)
var topChordDepthVertical = topChordDepthFt / Math.cos(topChordAngleRad);
// Calculate Outputs
var totalTrussRise = riseFromPitch + bottomChordDepthFt; // From bottom of bottom chord to top of top chord at peak
var topChordSegmentLength = Math.sqrt(Math.pow(halfSpan, 2) + Math.pow(riseFromPitch, 2)); // Length from heel point (top of bottom chord) to peak point (top of bottom chord)
var totalTopChordLength = 2 * (topChordSegmentLength + overhangLength);
var kingPostLength = riseFromPitch – topChordDepthVertical; // Length from top of bottom chord to bottom of top chord
// Diagonal Web Lengths (for King Post truss, from midpoint of half-span to midpoint of rise)
var diagRun = halfSpan / 2;
var diagRise = riseFromPitch / 2;
var diagonalWebLength = Math.sqrt(Math.pow(diagRun, 2) + Math.pow(diagRise, 2));
var heelHeight = bottomChordDepthFt + topChordDepthVertical; // From bottom of bottom chord to top of top chord at wall plate
// Total Linear Feet of Lumber for one truss
var lumberBottomChord = trussSpan;
var lumberTopChords = 2 * (topChordSegmentLength + overhangLength);
var lumberKingPost = kingPostLength;
var lumberDiagonalWebs = 2 * diagonalWebLength;
var totalLumberFeet = lumberBottomChord + lumberTopChords + lumberKingPost + lumberDiagonalWebs;
// Display Results
document.getElementById('resultTotalTrussRise').innerHTML = totalTrussRise.toFixed(2) + " ft";
document.getElementById('resultTopChordSegmentLength').innerHTML = topChordSegmentLength.toFixed(2) + " ft";
document.getElementById('resultTotalTopChordLength').innerHTML = totalTopChordLength.toFixed(2) + " ft";
document.getElementById('resultKingPostLength').innerHTML = kingPostLength.toFixed(2) + " ft";
document.getElementById('resultDiagonalWebLength').innerHTML = diagonalWebLength.toFixed(2) + " ft";
document.getElementById('resultHeelHeight').innerHTML = heelHeight.toFixed(2) + " ft";
document.getElementById('resultTopChordAngle').innerHTML = topChordAngleDeg.toFixed(2) + " degrees";
document.getElementById('resultTotalLumberFeet').innerHTML = totalLumberFeet.toFixed(2) + " ft";
document.getElementById('trussResults').style.display = 'block';
}
.truss-calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #333;
max-width: 800px;
margin: 40px auto;
padding: 25px;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
line-height: 1.6;
}
.truss-calculator-container h2, .truss-calculator-container h3 {
color: #2c3e50;
margin-top: 0;
}
.truss-calculator-container label {
font-weight: 600;
color: #34495e;
margin-bottom: 8px;
}
.truss-calculator-container input[type="number"] {
width: calc(100% – 22px);
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
font-size: 16px;
}
.truss-calculator-container button {
background-color: #3498db;
color: white;
padding: 12px 25px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 17px;
transition: background-color 0.3s ease, transform 0.2s ease;
display: block;
width: fit-content;
margin: 20px auto 0 auto;
}
.truss-calculator-container button:hover {
background-color: #2980b9;
transform: translateY(-2px);
}
.truss-calculator-container .calculator-inputs {
background-color: #ecf0f1;
padding: 25px;
border-radius: 8px;
box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.truss-calculator-container #trussResults {
background-color: #ecf0f1;
padding: 25px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.truss-calculator-container table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.truss-calculator-container table td {
padding: 10px;
border: 1px solid #ddeeff;
text-align: left;
}
.truss-calculator-container table tr:nth-child(odd) {
background-color: #f8fcfd;
}
.truss-calculator-container table tr:nth-child(even) {
background-color: #eef7fc;
}
.truss-calculator-container table td:first-child {
font-weight: 600;
color: #2c3e50;
}
.truss-calculator-container p.note {
font-size: 0.9em;
color: #7f8c8d;
margin-top: 20px;
text-align: center;
}
Understanding Your King Post Truss
A roof truss is a structural framework designed to support a roof, providing strength and stability while efficiently distributing loads to the building's walls. Unlike traditional rafter systems, trusses are prefabricated units that can significantly speed up construction and often use less material for the same span.
The King Post Truss
The King Post truss is one of the simplest and oldest truss designs, commonly used for smaller spans (typically up to 20-25 feet). It consists of a bottom chord, two top chords, a central vertical "king post," and two diagonal web members. This design is efficient for its span range and relatively straightforward to build, making it popular for sheds, garages, and small residential structures.
Key Truss Components & Inputs Explained:
- Truss Span (ft): This is the total horizontal distance the truss will cover, typically the width of your building from outside wall to outside wall. It's the length of your bottom chord.
- Roof Pitch Rise / Run: This defines the steepness of your roof. For example, a "6/12" pitch means the roof rises 6 inches vertically for every 12 inches of horizontal run. A steeper pitch sheds water and snow more effectively but requires more material and height.
- Overhang Length (ft): This is how far the roof extends horizontally beyond the exterior wall of the building. Overhangs protect walls from rain and provide shade.
- Top Chord Lumber Depth (inches): This refers to the vertical dimension of the lumber used for the angled top members of the truss (e.g., a 2×4 has a depth of 3.5 inches, a 2×6 has 5.5 inches). This affects the overall height and strength.
- Bottom Chord Lumber Depth (inches): Similar to the top chord, this is the vertical dimension of the lumber used for the horizontal base member of the truss.
Understanding the Outputs:
- Total Truss Rise (Peak Height): The overall vertical height of the truss, measured from the bottom of the bottom chord to the very top of the peak.
- Top Chord Segment Length: The length of one of the two angled top members, from the heel (where it meets the bottom chord) to the peak.
- Total Top Chord Length (incl. overhangs): The combined linear length of both top chords, including any specified overhangs. This is useful for material estimation.
- King Post Length: The length of the central vertical member that connects the peak of the top chords to the bottom chord.
- Diagonal Web Length (each): The length of each of the two diagonal members that connect the bottom chord to the top chords.
- Heel Height: The vertical height of the truss at the wall plate, measured from the bottom of the bottom chord to the top of the top chord at the wall line.
- Top Chord Angle: The angle (in degrees) that the top chord makes with the horizontal bottom chord. This is crucial for making accurate cuts.
- Total Linear Feet of Lumber: An estimate of the total linear feet of lumber required to build a single truss, useful for budgeting and material purchasing.
Example Calculation:
Let's say you're building a shed with a 20 ft span, a 6/12 roof pitch, a 1 ft overhang, and using 2×4 lumber for both top and bottom chords (which have a nominal depth of 3.5 inches). Inputting these values into the calculator would yield results similar to:
- Total Truss Rise: ~5.29 ft
- Top Chord Segment Length: ~11.18 ft
- King Post Length: ~4.67 ft
- Diagonal Web Length: ~5.59 ft
- Heel Height: ~0.62 ft
- Top Chord Angle: ~26.57 degrees
- Total Linear Feet of Lumber: ~60.21 ft
These dimensions provide the basic geometry for cutting your truss members. Remember to always double-check measurements and consider the thickness of your saw blade (kerf) when making cuts.
Important Considerations for DIY Truss Building:
While this calculator provides essential geometric dimensions, building trusses requires careful attention to structural integrity. Factors like snow load, wind load, lumber grade, connection methods (e.g., gusset plates), and local building codes are critical and not accounted for in this basic calculator. For any structure that will be inhabited or subject to significant loads, it is highly recommended to consult with a qualified structural engineer or use professionally manufactured trusses to ensure safety and compliance.