function calculateRoofPitch() {
var rise = parseFloat(document.getElementById('roofRise').value);
var run = parseFloat(document.getElementById('roofRun').value);
var resultDiv = document.getElementById('roofResult');
if (isNaN(rise) || isNaN(run) || run <= 0 || rise < 0) {
alert('Please enter valid positive numbers for Rise and Run.');
return;
}
// Calculations
var pitchFactor = (rise / run) * 12;
var angleRad = Math.atan(rise / run);
var angleDeg = angleRad * (180 / Math.PI);
var gradePercent = (rise / run) * 100;
var rafterLength = Math.sqrt(Math.pow(rise, 2) + Math.pow(run, 2));
// Formatting
var pitchDisplay = pitchFactor.toFixed(2).replace(/\.00$/, '') + " / 12";
var angleDisplay = angleDeg.toFixed(2) + "°";
var gradeDisplay = gradePercent.toFixed(2) + "%";
var rafterDisplay = rafterLength.toFixed(2);
// Update DOM
document.getElementById('pitchVal').innerHTML = pitchDisplay;
document.getElementById('angleVal').innerHTML = angleDisplay;
document.getElementById('gradeVal').innerHTML = gradeDisplay;
document.getElementById('rafterVal').innerHTML = rafterDisplay;
// Generate Description
var desc = "";
if (pitchFactor < 3) {
desc = "This is a low-slope roof. Specialized materials like EPDM or TPO membrane are recommended rather than standard shingles to prevent water backup.";
} else if (pitchFactor >= 3 && pitchFactor <= 9) {
desc = "This is a conventional slope roof. Standard asphalt shingles are perfectly suited for this pitch range (3/12 to 9/12).";
} else {
desc = "This is a steep-slope roof. While excellent for shedding snow and water, it may require special installation techniques and safety harnesses for maintenance.";
}
document.getElementById('pitchDescription').innerHTML = desc;
// Show Results
resultDiv.style.display = 'block';
}
Understanding Roof Pitch
Roof pitch, also known as roof slope, is a critical measurement in construction that describes the steepness of a roof. It is mathematically expressed as the vertical "rise" over the horizontal "run." In the United States and many other regions, this is traditionally expressed as a ratio over 12 inches (e.g., 4/12 or 6/12).
How to Measure Roof Pitch
To manually calculate your roof pitch, you need two measurements:
Rise: The vertical distance from the bottom of the roof section to the peak.
Run: The horizontal distance from the outer edge of the wall to the point directly under the peak.
Using the Pythagorean theorem (a² + b² = c²), our calculator also provides the rafter length, which is the actual diagonal length of the roofing timber needed to bridge that span.
Why Roof Pitch Matters
The pitch of your roof dictates more than just the aesthetic of your home; it determines which roofing materials are viable:
Pitch Category
Ratio
Recommended Material
Flat Roof
0/12 to 2/12
Built-up roof, PVC, Rubber
Low Slope
2/12 to 4/12
Metal panels, Double-coverage shingles
Standard Slope
4/12 to 9/12
Asphalt shingles, Wood shakes
Steep Slope
9/12 and up
Tile, Slate, Shingles
Common Examples
– 4/12 Pitch: For every 12 inches of horizontal run, the roof rises 4 inches. This equals an angle of approximately 18.4°.
– 12/12 Pitch: This is a 45-degree angle where the rise and run are equal. It is common in alpine regions to shed heavy snow.