Guide

How to measure a fence line and place gates

A fence estimate is only as good as the measurements behind it. Walk the line once, side by side, and place each gate by its distance from the start of its side.

Last reviewed October 17, 2026

Open the fence calculator

1. Mark the ends and corners

Drive a stake at each end and every corner of the fence line. Every change of direction starts a new straight side. If the fence is near a boundary, confirm the line against your survey or plat first.

2. Measure each straight side

Measure from stake to stake along each side, including the gate openings. Write the sides down in order as you walk the line; that order tells the calculator which sides share a corner post.

On sloped ground, the distance along the slope is longer than the level distance. Panels can be stepped (each level) or racked (following the slope), and rails span differently in each case. Check which your product needs and measure the distance it spans.

3. Place each gate

For every gate, measure from the start of its side to where the gate opening begins, then the opening width. Use the post-to-post opening the gate maker specifies, not the width of the gate leaf.

4. Choose a maximum post spacing

Pre-built panels set the spacing for you. For a fence built from rails and pickets, the maximum span comes from the rail size and the maker’s guidance. The calculator divides each stretch into the fewest equal sections that don’t exceed it.

Why gates and corners change the count

For one straight side with no gates, posts = sections + 1. Every gate splits a side into two stretches and adds a post; every corner between joined sides is one shared post, not two. Examples at 8 ft maximum spacing:

Fence post counts for example layouts
LayoutSectionsPosts
One 100 ft side1314
One 40 ft side, 4 ft gate starting at 10 ft68
Two 50 ft sides joined at a corner1415
Four 25 ft sides closed into a square1616

Before you dig

Call 811 before digging post holes. Post depth, fence height and setbacks are often set by local code or HOA rules, and some places require a permit.