This fence on a slope calculator works out how many posts, sections, rails, and bags of concrete you need when your fence runs up or down a hill, and how long the posts must be. Compare a stepped fence (level panels) against a racked fence (panels that follow the ground) before you buy.
Schematic side view, not to scale. Labels update with your numbers.
Enter the horizontal run of the fence line, the total elevation change from the high end to the low end, your fence height, and the widest panel or rail section you plan to use. Choose stepped or racked, your post size, and your local frost depth if you know it. Press Calculate to see posts, sections, rail length, post length, hole depth, concrete bags, a post-by-post table, and a side-by-side comparison of both methods.
On flat ground a fence is easy to plan: divide the run by the panel width, round up, and add one post. On a hill the numbers change. A 40-foot run that falls 30 inches needs five panels if you step them, but if you rack them parallel to the ground the longer sloped distance can push you to six. Miss that and you are a panel short on Saturday afternoon with the auger rental due back.
Slope also changes post length. With stepped panels each post must reach the top of the higher panel, so on a 6-inch step a 6-foot fence needs posts about 6 inches taller than on level ground, and deeper holes to match. Homeowners use a fence on a slope calculator to order lumber and concrete once, contractors use it to quote jobs, and anyone fencing a pool, a dog run, or a paddock uses it to check the gap under each panel. Gaps over roughly 4 inches let small pets and children through, so the step drop is shown in plain numbers.
Everything starts from the run and rise you enter. The tool uses these formulas:
√(run² + rise²). Slope % = rise ÷ run × 100. Angle = arctan(rise ÷ run).⌈run ÷ max width⌉; racked = ⌈slope length ÷ max width⌉. Posts = sections + 1.(π × (hole diameter ÷ 2)² − post width²) × embed, plus 10% waste. A 60 lb bag is taken as 0.45 cu ft and an 80 lb bag as 0.60 cu ft.These follow common industry rules of thumb, not a specific code section. No national building code sets fence post depth. Frost depth, permits, height limits, and setbacks vary by city, county, and HOA, so confirm them locally. Every safety-related figure is rounded toward more posts, deeper holes, and longer posts. The results are planning estimates, not engineering, permit, or inspection approval.
Say a fence run is 40 ft long and drops 30 in. You want a 72 in fence with 8 ft sections, stepped, on 4×4 posts, and you left frost depth blank.
Switch to racked and the 40.08 ft slope length divided by 8 ft is just over 5, so you need 6 sections and 7 posts. Posts are shorter (10 ft stock) and there is no stepped gap, but you need 121 ft of rail and 42 bags of 60 lb concrete.
You either step the panels, keeping each one level and dropping at each post, or rack them so the rails follow the ground. Stepped suits steeper ground and rigid panels. Racked gives a continuous line on gentle slopes. Set posts plumb either way, and measure post spacing horizontally.
Racked looks smoother and leaves no big gaps, but it needs panels that can flex and it uses more material. Stepped works with any panel and is often easier to build, but leaves triangular gaps under each step. On slopes over about 12.5%, stepped is often the practical choice.
It depends on the product. Many vinyl and aluminum panels rack roughly 1.5 inches per foot or less. Custom wood rails can follow steeper ground. Check the manufacturer's racking limit before you buy.
A common rule is to bury at least one-third of the post length, never less than 24 inches, and below the local frost line. On a slope, size the embed from the tallest post, because stepped fences need taller posts. This calculator rounds that depth up to the next 6 inches.
Measure the run horizontally for stepped fences, since each panel stays level. For racked fences, panel length is measured along the slope, which is slightly longer. This tool uses the run for stepped and the slope length for racked.
Permit rules depend on your city, county, and HOA, and mostly cover height and setbacks. Slopes can also count toward the measured height of a fence, especially at the downhill side. Ask your local building department before you buy materials.
Calculator by Toolwick