Fence on a Slope Calculator
The diagram appears here after a calculation with a fence height entered for the diagram.
This fence on a slope calculator compares stepped and racked layouts using the rise and horizontal run of your fence line. Enter the measurements, then choose the panel or section basis. It shows slope, angle and section geometry so you can see how the ground changes the layout before ordering.

How the fence on a slope calculator works
A stepped fence keeps each panel level and changes height between sections. A racked fence follows the slope within the panel’s permitted movement. Use the calculator to compare geometry, then check whether your chosen product can actually use that arrangement.
Measure rise and horizontal run
Your rise is the vertical difference between the ends, while horizontal run is the level distance rather than a tape laid on the hillside. A level line or suitable survey helps you separate those measurements. If your ground includes several crests or dips, you’ll need separate stretches, because one average slope won’t describe the changes that individual fence sections must follow.
Slope and fence length formulas
Slope percent = rise ÷ horizontal run × 100. Slope angle = arctangent(rise ÷ run). Length along the slope = square root(run² + rise²).
For a racked panel with fixed sloping length, horizontal coverage = panel length × cosine(angle). A level stepped panel uses its horizontal width instead, subject to the actual product’s connection details.
Worked example: a four-foot rise
A 40-foot horizontal run rising 4 feet has a 10% slope and an angle of about 5.71 degrees. Its sloping length is about 40.20 feet. A fixed 8-foot racked length projects about 7.96 feet horizontally, so five cannot cover the full 40-foot run.
You need six sections on that basis. Five level 8-foot stepped sections cover 40 feet horizontally.

Compare gaps, cuts and product limits
Stepped panels can leave triangular gaps beneath them, while racking depends on how far the panel and its connections can move. Your choice therefore affects containment and appearance as well as the material layout. A gate also needs clearance throughout its opening arc.
You shouldn’t assume a prefabricated panel can rack simply because a fence built from loose boards could follow the same ground.
Use the layout to check post lengths
Your exposed post lengths can change along a hillside, so individual locations need checking before you choose stock lengths and buried depths. This calculator supplies geometry, not a retaining-wall or footing design. When the profile changes sharply, separate stretches can meet at a known post.
You’ll still need to compare the arrangement with local requirements and the manufacturer’s hillside instructions before cutting panels or marking holes.
Frequently Asked Questions
Should I enter the hillside tape length as run?
No. Run means horizontal distance. Tape length along the slope is longer and belongs to a different measurement.
Can every fence panel be racked?
No. The permitted movement depends on its construction and connections. Check the exact product instructions.
Does this calculate retaining walls?
No. It plans fence geometry only. Retained soil and special foundations need their own separate design.
Sources & References
Method notes · Checked 10 November 2026
Published references
- Trex Fencing FDS: Building a fence on a hillside. Manufacturer explanation of stepped and racked arrangements and the need for a product that accommodates the slope.
- NIST: International foot and metric conversion. The international foot is exactly 0.3048 metres. Calculations use consistent units before area and volume conversion.
Our calculation and planning assumptions
The ground is modeled as a straight, constant slope. Trigonometry supplies geometry; the product manufacturer determines whether a panel may rack to that angle. Fence height changes the diagram only.
Stepped support extras represent one step at each downhill support, not cumulative site rise; racked geometry adds no extra post stock.
Results are preliminary planning estimates. Confirm the actual fence system, local requirements and installation conditions before construction.