Fence on a slope calculator

Fence / Layout

Lay out stepped or racked fence bays over a uniform slope or measured terrain stations, with known rail limits and per-post stock lengths.

Enter your inputs

A worked project example is loaded and calculated automatically. Replace the values with your project inputs.

Input notes

Measure horizontal distances, not tape length along the slope. A negative elevation change descends from the start; a positive change ascends. Survey mode uses one horizontal-station, ground-elevation pair per line in feet, starts at station zero and retains a post at every measured grade break. Use one continuous straight fence run with no gates or shared branches; place a survey point wherever the grade changes.

All sections divide into equal horizontal bays within your entered center spacing. Actual post width is measured along this run; zero means centerline-only mathematical geometry. Fence height and clearance are vertical. Stepped panels sit above the higher centerline ground point, so their clear-face gaps are slightly smaller than the reported centerline-envelope maximum. Racked panels maintain the entered vertical clearance. Post tops clear the higher adjacent panel top plus your entered allowance.

Known burial depth, spacing, stock sizes and any rack rating must come from your project plan or selected product; the examples are arithmetic inputs. A clear-rail limit can shorten bays. A rack rating is entered as allowed inches of rise per 12 horizontal inches, and applies only to racked layouts. This does not choose a safe depth, panel, structural span, bracket or product. Enter stock sizes actually available to you; posts without a long-enough match remain flagged.

Choose the option that matches your project.
ft
Enter horizontal run in feet.
ft
Enter signed elevation change in feet.
Choose the option that matches your project.
ft
Enter maximum horizontal post centers in feet.
in
Enter actual post width along run in inches.
ft
Enter vertical fence height in feet.
in
Enter vertical ground clearance in inches.
in
Enter post top allowance in inches.
in
Enter known burial depth in inches.
Choose the option that matches your project.
Choose the option that matches your project.
Enter 1–16 available post stock lengths in feet, separated by commas or newlines. Each length must be greater than zero.

About this calculator

A sloped-run layout divides measured horizontal terrain into bays, then calculates stepped or racked geometry and compares the resulting post lengths with stock sizes you enter.

Steps

  1. Terrain measurements

    Choose the option that matches your project.

  2. Horizontal run

    Enter horizontal run in feet.

  3. Signed elevation change

    Enter signed elevation change in feet.

  4. Survey stations and elevations (available in another mode)

    Each line: horizontal station (ft), ground elevation (ft). Separate the two values with a comma. Use 2–30 points; start at station zero and list stations in increasing order. Elevations may be negative.

  5. Fence slope method

    Choose the option that matches your project.

  6. Maximum horizontal post centers

    Enter maximum horizontal post centers in feet.

  7. Actual post width along run

    Enter actual post width along run in inches.

  8. Vertical fence height

    Enter vertical fence height in feet.

  9. Vertical ground clearance

    Enter vertical ground clearance in inches.

  10. Post top allowance

    Enter post top allowance in inches.

  11. Known burial depth

    Enter known burial depth in inches.

  12. Clear rail length constraint

    Choose the option that matches your project.

  13. Maximum clear rail length (available in another mode)

    Enter maximum clear rail length in feet.

  14. Known panel rack rating

    Choose the option that matches your project.

  15. Entered maximum rack rise per foot (available in another mode)

    Enter maximum rack rise per foot in inches per foot.

  16. Available post stock lengths

    Enter 1–16 available post stock lengths in feet, separated by commas or newlines. Each length must be greater than zero.

Formula

Split each measured terrain section into equal bays within entered horizontal post centers. A clear racked rail spans (horizontal centers − post width) × sqrt(1 + grade²); an entered rail limit may require more bays. Stepped bottoms are level above the higher endpoint; racked bottoms follow grade at entered vertical clearance. Post top is the higher adjacent panel top plus the entered allowance; required post length = top − local ground + known burial. Choose the shortest sufficient entered stock length or flag no match.

Notation: sqrt gives the square root.

Interpret the result

Panel and post counts describe the selected spacing and slope method. Stock quantities are based only on the entered sizes; they do not establish embedment, rail suitability, or a code-compliant fence.

Worked example

A 32-ft horizontal run at a maximum 8-ft center spacing gives ceil(32 ÷ 8) = 4 bays. Four panels require 5 shared post locations, so the example returns 4 panels and 5 posts.

Example result: 4 panels; 5 posts

Example inputs
Terrain measurements
Uniform slope
Horizontal run
32 ft
Signed elevation change
-2 ft
Fence slope method
Stepped, level panels
Maximum horizontal post centers
8 ft
Actual post width along run
4 in
Vertical fence height
6 ft
Vertical ground clearance
2 in
Post top allowance
0 in
Known burial depth
24 in
Clear rail length constraint
No rail length constraint entered
Known panel rack rating
Rack rating not assessed
Available post stock lengths
8,10,12

FAQs

Should I measure along the ground or horizontally?

Enter horizontal station distances and elevations on one consistent datum; do not substitute tape distance along the slope.

What do the layout marks refer to?

Use the stated origin, centerline or face reference, and units shown with the result. Display rounding may differ from the internal coordinates.

Does this approve the selected dimensions or product?

No. It lays out the dimensions you enter and does not establish structural capacity, product cutting permission, or installation compliance.

Additional examples and limits

Stepped and racked examples

A 32-ft horizontal run dropping 2 ft, divided into four 8-ft bays, has a 6-in drop per bay. With 6-ft vertical panels, 2-in clearance, no post-top allowance and a known 24-in burial, the first stepped post needs 8.166667 ft and the other four need 8.666667 ft. The entered 8/10/12-ft stock list therefore gives five 10-ft posts. A 4-in actual post width leaves 92 in between faces; the first panel's clear-face ground gap ranges from 2.125 to 7.875 in.

Racked panels on that terrain require 8.166667-ft posts throughout. Their clear rail geometry is (92/12) × sqrt(1 + (2/32)²) = approximately 7.68163 ft, and vertical ground clearance remains 2 in. The rail geometry excludes connection allowances; one rail line is not a complete fence bill of materials.

Flat boundary: an 8-ft run with one 6-ft panel, zero clearance and known 2-ft burial uses two exactly 8-ft posts. At a surveyed hill of (0,0), (8,2), (16,0) ft, stepped panels with zero clearance and post-width deduction require post lengths of 10, 8 and 10 ft, including that same burial. The intermediate post is shared once and takes the higher adjacent panel top.

Survey transitions, actual post-face deduction, stock selection and entered constraints are part of this calculator's stated model. Use at most 30 terrain points, 500 panels and 16 entered post stock sizes. Repeated/backward stations, consumed openings, over-limit rack slopes and excessive layouts are rejected before panel allocation. Unknown subsegment terrain, gates, corners/branches, curved routes, product-specific hinges/brackets/insertion lengths, cut permission, engineering, pool/code approval, excavation design and prices are excluded.