Guide
Counting posts, rails and pickets for a fence, with gates and closed loops
A fence looks simple until you stand in the hardware store and need to know how many posts to buy. The count depends on the length, the post spacing, the number of gates and whether the fence closes a loop. This calculator works through those steps, shows the real spacing between posts, and adds up the cost of the parts you price.
Sections and posts
Subtract the gate openings from the total length, divide by the post spacing and round up. That gives the number of sections between posts. A straight, open run needs one more post than sections, because each section has a post at both ends and neighbouring sections share one. A closed loop, such as a fenced yard with no gate, needs exactly as many posts as sections, because the last section ends where the first began.
Gates
A gate is a gap in the fence with its own pair of posts. It cuts the line into separate runs, and each open run needs the extra end post. An open fence with g gates has g + 1 runs, a closed loop with g gates has g runs and no runs when g is zero. The result gives the total posts and splits them into line or end posts and gate posts, two for each gate, which matters because gate posts are usually heavier.
Rails and pickets
Rails are counted as the number of sections times the rails per section, two by default and three for a tall fence. Pickets are counted from the length without gates divided by the picket width plus the gap, rounded up. Picket width and gap are typed in inches for feet or in millimetres for metres. Set the width to 0 to leave pickets out when you are building a panel or wire fence.
Prices
Fill in the price of a post, a rail, a picket and a gate to get a material cost in the currency you choose. Leave the price boxes empty to skip it. The cost covers only those four parts, so concrete, fixings, stain and delivery need to be added.
Edge cases
The gates must not take up the whole length, or the page says so. The post spacing must be above zero, and up to ten gates are accepted. Spacing is the distance from post centre to post centre. The tool does not know about corner posts, which are treated as ordinary posts, so a rectangular yard counts correctly as a closed loop with its corners among the posts.
A worked example
A 120 ft fence with one 4 ft gate has 116 ft of fence to build. At 8 ft spacing that is 15 sections, with a real spacing of 7.7333 ft. The posts total 17, which is 15 line or end posts and 2 gate posts, and there are 30 rails and 232 pickets. A closed yard of 60 m with 2.4 m spacing needs 25 sections and 25 posts, 50 rails and 600 pickets of 90 mm with 10 mm gaps. For a priced job of 200 ft with two gates, there are 24 sections, 27 posts, 48 rails and 384 pickets, and at 14 per post, 9 per rail, 2.40 per picket and 85 per gate the material cost is 1,901.60.
Limits
The calculator assumes straight runs and even spacing. It does not plan sloping ground, post depth, concrete, gate hardware or the length of rails that are sold in fixed sizes. Local rules on fence height, how close to a boundary you can build and whether a permit is needed vary, so check them before you buy.
Related tools
- Concrete Calculator works out the concrete for the post holes.
- Mulch and Gravel Calculator sizes the material for a path or bed along the fence.
- Carpet Calculator applies the same cut-and-waste thinking to rolls of floor covering.
- Lawn Calculator estimates seed or turf for the yard you have just fenced.
Checked against the current version of the Fence Calculator on .

