Civil Engineering Calculator

Rafter Length Calculator

Calculate the theoretical length and roof angle of a sloped rafter from the horizontal run and vertical rise.

Roof Geometry

Theoretical right-triangle geometry of a sloped rafter

Rafter Length (L)Horizontal Run = 3000 mmVertical Rise = 1000 mmθ

Roof Parameters

mm

Horizontal projection of the rafter.

mm

Vertical height gained over the horizontal run.

Engineering Tip

Always verify your theoretical calculations with physical testing and standard safety factors before real-world application.

Rafter Length

3,162.28mm

Roof Angle

18.43°

Pitch Ratio

0.333

rise / run

Governing Formula

L = √(R² + H²)
Lmm

Theoretical Rafter Length

Rmm

Horizontal Run

Hmm

Vertical Rise

Governing Formula

θ = tan⁻¹(H / R)
θ°

Roof Pitch Angle

Hmm

Vertical Rise

Rmm

Horizontal Run

Calculation Assumptions

  • Right-triangle roof geometry
  • Run and rise measured horizontally/vertically
  • Theoretical rafter centerline
  • No seat-cut or ridge deductions

Engineering Code

Python
import math

def calculate_rafter_length(run, rise):
    """
    Calculate the theoretical rafter length
    from horizontal run and vertical rise.

    run: Horizontal run (mm)
    rise: Vertical rise (mm)

    Returns:
        Rafter length (mm)
        Roof angle (degrees)
        Pitch ratio (rise/run)
    """

    if run <= 0 or rise <= 0:
        raise ValueError("Run and rise must be greater than zero.")

    length = math.sqrt(run**2 + rise**2)
    angle = math.degrees(math.atan2(rise, run))
    pitch = rise / run

    return length, angle, pitch


# Example Usage
run = 3000       # mm
rise = 1000     # mm

length, angle, pitch = calculate_rafter_length(run, rise)

print(f"Rafter Length: {length:.2f} mm")
print(f"Roof Angle: {angle:.2f} degrees")
print(f"Pitch Ratio: {pitch:.3f}")
MATLAB
function [L, theta, pitch] = calculate_rafter_length(run, rise)
    % Calculate theoretical rafter length
    % from horizontal run and vertical rise.
    %
    % run  = Horizontal run (mm)
    % rise = Vertical rise (mm)

    if run <= 0 || rise <= 0
        error('Run and rise must be greater than zero.');
    end

    L = sqrt(run^2 + rise^2);

    theta = atan2d(rise, run);

    pitch = rise / run;
end

% Example Usage
run = 3000;
rise = 1000;

[L, theta, pitch] = calculate_rafter_length(run, rise);

fprintf('Rafter Length: %.2f mm\n', L);
fprintf('Roof Angle: %.2f degrees\n', theta);
fprintf('Pitch Ratio: %.3f\n', pitch);

Technical Explanation: Rafter Length

In roof framing, the rafter forms the primary inclined structural member that transfers roof loads (dead load, live load, snow, wind) to the wall plates and ultimately to the foundation. Determining the theoretical rafter length from the horizontal run and vertical rise is a fundamental geometric task in carpentry, timber framing, and light-gauge steel roof construction. This calculator applies the Pythagorean theorem and trigonometric relationships to compute the sloped rafter length and roof pitch angle for right-triangle roof geometries.

Governing Formula: Pythagorean Theorem

When a roof is idealized as a right triangle, the rafter corresponds to the hypotenuse, the horizontal run (R) is the adjacent side, and the vertical rise (H) is the opposite side. The theoretical rafter length (L) is therefore:

L = √(R² + H²)

This relationship holds for any right triangle and is independent of units, provided R and H are expressed in the same unit (e.g., both in millimeters or both in meters). For example, with a 3000 mm horizontal run and a 1000 mm rise, the theoretical rafter length is approximately 3162.28 mm.

Roof Pitch Angle Derivation

The roof pitch angle (θ) relative to the horizontal plane is obtained from the inverse tangent of the rise-to-run ratio:

θ = arctan(H / R)

In computational implementations, the two-argument arctangent function atan2(H, R) is preferred over a simple arctan(H/R) because it correctly handles all quadrants and avoids division-by-zero errors when R = 0. The output angle is typically expressed in degrees for construction use, where common residential roof pitches range from 15° (4:12) to 45° (12:12).

Input Parameters and Physical Meaning

Each input to this calculator corresponds to a measurable geometric property of the roof:

  • Horizontal run (R): The horizontal distance from the outer edge of the wall plate to the centerline of the ridge board (for a symmetrical gable roof). This is half the building span for a simple gable.
  • Vertical rise (H): The vertical height from the top of the wall plate to the top of the ridge board. Together with the run, it defines the roof slope.

Common mistakes include confusing total building width with run (run is typically half the width for a gable), mixing units (e.g., run in meters, rise in millimeters), or neglecting to account for ridge board thickness when laying out actual cuts.

Engineering Interpretation of Rafter Length

The calculated rafter length serves several practical purposes in design and construction:

  • Material procurement: Knowing the theoretical length helps select appropriate lumber lengths (e.g., 3.6 m, 4.2 m, 4.8 m) to minimize waste and offcuts.
  • Span verification: Rafter length directly determines the unsupported span, which must be checked against span tables for the selected lumber grade, species, spacing, and design loads (snow, wind, dead load) per codes such as IRC, ASCE 7, or Eurocode 5.
  • Layout and marking: Carpenters use the run and rise to step off rafter cuts with a framing square. The theoretical length provides a check against cumulative layout errors.
  • Structural analysis: In simplified hand calculations, the rafter is modeled as an inclined beam or truss chord. Its length influences axial forces, bending moments, and deflection under load.

Note that this calculator provides geometric length only. It does not perform structural capacity checks, which require separate analysis of bending stress, shear, deflection, lateral torsional buckling, and connection design.

Units and Unit Consistency

This calculator accepts inputs in consistent linear units (typically millimeters or meters). The Pythagorean formula is dimensionally homogeneous, meaning:

  • If R and H are in millimeters, L will be in millimeters.
  • If R and H are in meters, L will be in meters.

Mixing units (e.g., run in meters, rise in millimeters) will produce incorrect results. Always convert to a common unit before calculation. For imperial users: 1 inch = 25.4 mm; 1 foot = 304.8 mm.

Assumptions and Limitations

The theoretical rafter length produced by this tool relies on several explicit geometric assumptions:

  • Right-triangle geometry: The roof is modeled as a perfect right triangle with horizontal run and vertical rise. Curved, compound-slope, or irregular roofs are not represented.
  • Zero-thickness members: The calculation ignores ridge board thickness, wall plate thickness, and any offset due to heel height or birdsmouth depth.
  • No overhang: The computed length is from wall plate to ridge centerline only. Eave overhangs, fascia, and soffit details must be added separately.
  • Idealized cuts: Birdsmouth (seat) cuts, plumb cuts, and tail cuts are not included. Actual timber cutting length will be longer or shorter depending on these details.
  • Small deformation: The geometry assumes the rafter remains straight under load. Deflection under service loads is not considered.

This calculator is intended for geometric layout and preliminary estimation. Final rafter design, including species selection, grade, spacing, load combinations, and connection detailing, must comply with applicable building codes and be verified by a qualified designer.

Practical Construction Considerations

While the theoretical length is a necessary starting point, actual rafter fabrication requires additional adjustments:

  • Ridge board thickness: For a butt joint at the ridge, each rafter is shortened by half the ridge board thickness.
  • Birdsmouth (seat) cut: The notch that seats the rafter on the wall plate removes material and effectively shortens the structural length. Standard practice limits birdsmouth depth to no more than one-third of the rafter depth to preserve shear capacity.
  • Heel height: The vertical distance from the top of the wall plate to the top of the rafter at the bearing point affects insulation depth and eave details.
  • Overhang and tail: Eave overhangs extend the rafter beyond the wall plate and must be added to the theoretical length for ordering and cutting.
  • Fascia and soffit: Additional length may be required for fascia board attachment and soffit framing.

Always produce a detailed rafter layout drawing or use a framing square to step off all cuts before final cutting. The theoretical length from this calculator should be treated as a geometric baseline, not a complete fabrication dimension.

Typical Applications

This rafter length calculator is commonly used in:

  • Residential construction: Gable roofs, shed roofs, and dormers for houses, garages, and sheds.
  • Agricultural buildings: Barns, equipment sheds, and storage structures with simple pitched roofs.
  • Light commercial framing: Small retail buildings, workshops, and warehouses with timber or light-gauge steel rafters.
  • Roof retrofit and repair: Verifying existing rafter lengths for replacement or reinforcement work.

Real-World Engineering Cases

Heavy Snow Loads and Excessive Span

During a severe winter storm, a residential garage roof collapsed. The builder had calculated the rafter length correctly for the pitch but ignored the maximum allowable unsupported span. The exceptionally long rafters couldn't handle the localized bending moment caused by the accumulated snow.

Engineering Lesson

Rafter length isn't just a geometric hypotenuse; it dictates a structural beam's span. Always verify if the calculated length exceeds the maximum allowable span for your chosen lumber grade and local environmental loads.

The Birdsmouth Cut Weakness

A framing crew calculated the exact rafter lengths but cut the birdsmouth notches too deep to make the roof sit lower on the wall plates. This excessive notching drastically reduced the effective structural depth of the rafters at the bearing point, leading to shear cracking over time.

Engineering Lesson

Pure geometry must be balanced with structural integrity. While calculating the exact rafter length is crucial, remember that any notches or cuts will reduce its effective cross-section. Standard practice dictates never notching a rafter more than one-third of its depth.

Frequently Asked Questions

How is rafter length calculated?

Rafter length is calculated as the hypotenuse of the right triangle formed by the horizontal run and vertical rise: L = √(R² + H²).

Is rafter length the same as roof slope?

No. Rafter length is the actual sloped geometric length. Roof slope describes the relationship between vertical rise and horizontal run, commonly expressed as a ratio or angle.

Does this calculator include overhang?

No. The calculated value is based only on the specified horizontal run and vertical rise. Rafter overhang should be added separately according to the roof geometry.

Does this calculate the actual timber cutting length?

Not directly. Actual cutting length depends on details such as birdsmouth cuts, ridge connections, ridge-board thickness, fascia, and overhang. This calculator provides the theoretical geometric rafter length.