Fence Calculator
Enter the length of your fence, the spacing between posts and any gates to see how many posts, rails and pickets you need. A picket and gap size gives the picket count.
How to use this fence calculator
- Measure the whole fence line in feet, including the gate openings.
- Enter the post spacing, center to center. This is often 6 or 8 feet.
- Pick an open run or a closed loop. A loop has the same number of posts as sections, while a run needs one more post than sections.
- Enter the number of gates, the gate width and how many extra posts each gate needs.
- Enter the number of rails per section and the picket width and gap if you are building a picket fence.
- Add a price per linear foot if you want a cost estimate, then press Calculate.
How to calculate how many fence posts, rails and pickets you need
The calculator removes the gates from the fence length, divides the rest into sections and counts parts from there.
- Fence length without gates = total length – gates x gate width
- Sections = fence length without gates / post spacing, rounded up
- Posts = sections + 1 for an open run, or sections for a closed loop, plus extra posts for gates
- Rails = sections x rails per section
- Pickets = fence length without gates x 12 / (picket width + gap), rounded up
- Cost = total length x price per linear foot
Worked example
A fence run is 100 ft long with one 4 ft gate and 8 ft post spacing. The fence without the gate is 100 – 4 = 96 ft. That is 96 / 8 = 12 sections. An open run needs 12 + 1 = 13 line posts, plus 2 gate posts = 15 posts. With 2 rails per section you need 24 rails.
With 5.5 inch pickets and a 0.5 inch gap, each picket takes up 6 inches, so 96 ft x 12 / 6 = 192 pickets. At $28 per linear foot the whole fence costs 100 x 28 = $2,800.00.
Assumptions & limits
- The fence is straight and level. Slopes, steps and corners need extra posts and longer parts.
- The number of posts for gates is a simple default. Your design may share a post between a gate and the fence line.
- Post spacing is the same everywhere. A short last section still counts as a full section.
- The price per linear foot is your own input. The calculator does not look up prices.
- Check local rules for fence height, setbacks and permits before you build.
Frequently asked questions
How do I calculate how many fence posts I need?
Divide the fence length by the post spacing, round up to whole sections and add one post for an open run. A 96 ft fence with 8 ft spacing has 12 sections and needs 13 posts before gate posts.
How far apart should fence posts be?
It depends on the fence type and the materials. Spacing of 6 or 8 feet is common for panels and rails, but check the product instructions and local rules.
How many pickets do I need?
Divide the fence length in inches by the width of one picket plus the gap and round up. With 5.5 inch pickets and a 0.5 inch gap, you need 2 pickets for each foot of fence.
How many rails are there per section?
Most picket fences use 2 or 3 rails. Enter the number your design uses and the calculator multiplies it by the sections.
Do I subtract gates from the fence length?
Yes. The calculator subtracts the gate widths before counting sections, then adds extra posts for each gate.
Is the cost based on posts and pickets?
No. The cost uses the price per linear foot that you enter, because installed or supplied prices differ so much.
Related calculators
Related articles
Last updated: November 2026