Fence on a slope calculator
Lay out stepped or racked fence bays over a uniform slope or measured terrain stations, with known rail limits and per-post stock lengths.
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
- Terrain measurementsTerrain measurements (available in another mode)
Choose the option that matches your project.
- Horizontal runHorizontal run (available in another mode)
Enter horizontal run in feet.
- Signed elevation changeSigned elevation change (available in another mode)
Enter signed elevation change in feet.
- Survey stations and elevationsSurvey 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.
- Fence slope methodFence slope method (available in another mode)
Choose the option that matches your project.
- Maximum horizontal post centersMaximum horizontal post centers (available in another mode)
Enter maximum horizontal post centers in feet.
- Actual post width along runActual post width along run (available in another mode)
Enter actual post width along run in inches.
- Vertical fence heightVertical fence height (available in another mode)
Enter vertical fence height in feet.
- Vertical ground clearanceVertical ground clearance (available in another mode)
Enter vertical ground clearance in inches.
- Post top allowancePost top allowance (available in another mode)
Enter post top allowance in inches.
- Known burial depthKnown burial depth (available in another mode)
Enter known burial depth in inches.
- Clear rail length constraintClear rail length constraint (available in another mode)
Choose the option that matches your project.
- Maximum clear rail lengthMaximum clear rail length (available in another mode)
Enter maximum clear rail length in feet.
- Known panel rack ratingKnown panel rack rating (available in another mode)
Choose the option that matches your project.
- Entered maximum rack rise per footEntered maximum rack rise per foot (available in another mode)
Enter maximum rack rise per foot in inches per foot.
- Available post stock lengthsAvailable post stock lengths (available in another mode)
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.
