Fence Calculator
This fence calculator finds the perimeter, 2 × (length + width), then divides by post spacing for posts and sections, and by picket width plus gap for pickets.
A fence calculator turns two yard measurements into a full material list. Find the perimeter (2 × length + 2 × width), divide by post spacing to get sections and posts, multiply sections by rails per section, and divide the length in inches by picket width plus gap for pickets. A 40 × 30 ft yard at 8 ft spacing needs 18 posts, 36 rails, and 280 pickets.
Enter your yard length and width, post spacing, rails per section, picket width, and the gap between pickets above. The calculator returns posts, pickets, rails, sections, and the total perimeter in one pass, so you can price the whole fence instead of counting each part separately.
How the fence calculator works
The calculator assumes you are fencing all four sides of a rectangle, so the fence closes back on itself.
- Perimeter = 2 × (length + width)
- Sections = perimeter ÷ post spacing, rounded up
- Posts = sections. A closed loop has no loose end, so the last section finishes on the first post.
- Rails = sections × rails per section
- Pickets = (perimeter × 12) ÷ (picket width + gap), rounded up
Picture a 24 ft straight run at 8 ft spacing: 3 sections, but 4 posts, because both ends need one. Bend that same 24 ft into a closed triangle and the ends meet, so 3 sections need only 3 posts.
How many fence posts do I need?
For a closed perimeter: posts = perimeter ÷ spacing, rounded up.
For a straight run or a fence that ends at the house: posts = run length ÷ spacing, rounded up, plus one.
Then check the corners. Every corner needs its own post, and each side has to be divided into sections that fit between its own corners. Do the division side by side: a 30 ft side at 8 ft spacing needs 4 sections (30 ÷ 8 = 3.75, rounded up). When your side lengths are not multiples of the spacing, adding up the sides this way can give one or two more posts than the perimeter shortcut. Use the larger number.
Worked examples
These results match what the calculator returns for the same inputs.
Example 1: 40 × 30 ft backyard, 8 ft spacing, 2 rails, 5.5 in pickets, 0.5 in gap
- Perimeter: 2 × (40 + 30) = 140 ft
- Sections: 140 ÷ 8 = 17.5, rounded up to 18
- Posts: 18 (sides check: 5 + 5 + 4 + 4 sections = 18)
- Rails: 18 × 2 = 36
- Pickets: (140 × 12) ÷ (5.5 + 0.5) = 1,680 ÷ 6 = 280
Example 2: 60 × 40 ft yard, 6 ft spacing, 2 rails, 3.5 in pickets, 2 in gap (a spaced picket fence)
- Perimeter: 2 × (60 + 40) = 200 ft
- Sections: 200 ÷ 6 = 33.33, rounded up to 34
- Posts: 34 (sides check: 10 + 10 + 7 + 7 = 34)
- Rails: 34 × 2 = 68
- Pickets: 2,400 ÷ 5.5 = 436.4, rounded up to 437
Example 3: 48 × 32 ft privacy fence, 8 ft spacing, 3 rails, 5.5 in boards butted tight (0 in gap)
- Perimeter: 2 × (48 + 32) = 160 ft
- Sections and posts: 160 ÷ 8 = 20 (sides check: 6 + 6 + 4 + 4 = 20)
- Rails: 20 × 3 = 60
- Pickets: 1,920 ÷ 5.5 = 349.1, rounded up to 350
Wood boards shrink as they dry. If you butt green pressure-treated pickets tight, gaps will open later; a privacy fence calculator helps compare board-on-board and shadowbox layouts, which use more pickets.
Fence material per 100 feet (straight run)
Quick reference for a straight 100 ft run with posts at both ends:
| Post spacing | Sections | Posts | Rails (2 per section) | Rails (3 per section) |
|---|---|---|---|---|
| 6 ft | 17 | 18 | 34 | 51 |
| 8 ft | 13 | 14 | 26 | 39 |
| 10 ft | 10 | 11 | 20 | 30 |
Pickets per 100 feet
| Picket width | Gap | Coverage per picket | Pickets per 100 ft |
|---|---|---|---|
| 5.5 in (1x6) | 0 in | 5.5 in | 219 |
| 5.5 in (1x6) | 0.5 in | 6 in | 200 |
| 5.5 in (1x6) | 2 in | 7.5 in | 160 |
| 3.5 in (1x4) | 0 in | 3.5 in | 343 |
| 3.5 in (1x4) | 0.5 in | 4 in | 300 |
| 3.5 in (1x4) | 2.5 in | 6 in | 200 |
| 3.5 in (1x4) | 3.5 in | 7 in | 172 |
Pickets = 1,200 ÷ coverage per picket, rounded up. For a different length, scale it: 250 ft of 6 in coverage is 3,000 ÷ 6 = 500 pickets.
Typical post spacing by fence type
| Fence type | Typical spacing |
|---|---|
| Wood privacy or picket | 6–8 ft (8 ft matches standard rail length) |
| Vinyl panel | Panel width, usually 6 or 8 ft |
| Chain link | Up to 10 ft |
| Wire or field fence | 8–12 ft, often with T-posts between wood posts |
Always follow the manufacturer’s instructions for panel systems, since posts must line up with the panel brackets. Tighten spacing in exposed, high-wind spots.
Post depth and concrete
A widely used rule of thumb:
- Set at least one-third of the above-ground height in the ground. A 6 ft fence needs about 2 ft of embedment, so buy 8 ft posts.
- Add about 6 in of extra depth for a gravel base, which lets water drain away from the post end.
- Go below the frost line where frost heave is a risk or your local code requires it. In cold climates that can be 3–4 ft or more.
- Dig the hole about three times the post width. For a 4x4 (3.5 in actual), that is a 10–12 in hole.
The fence post depth calculator applies these rules to your height and frost depth. The fence post concrete calculator then tells you how much concrete each hole needs.
How to measure your yard
- Walk the fence line and mark corners with stakes. Run a string between them.
- Measure each side along the string, not along the ground’s curves.
- Note gates and their widths. Mark where each gate post goes.
- Find your property line. Use a survey or plat, not a neighbor’s fence. Many towns require a setback, a permit, and a height limit (often 6 ft in back yards and 3–4 ft in front).
- Call 811 a few days before digging so buried utilities are marked.
If you are only fencing three sides because the house forms the fourth, this calculator will over-count. Add up the three sides by hand and use the straight-run rule (one extra post), or use the fence post calculator for a single run.
Common mistakes
- Forgetting the end post on a straight run. Sections + 1, not sections.
- Using the perimeter shortcut when sides don’t divide evenly. Check each side so every corner gets a post.
- Leaving no gap between wood pickets. Wood swells when wet; 1/4–1/2 in is typical for spaced styles.
- Skipping waste. Add about 5–10% to pickets and rails for split boards, bad cuts, and a few spares for future repairs.
- Ignoring grade. On a slope, racked or stepped sections can change how many pickets and posts you need.
Pricing the material list
Once you have counts, price them with the fence cost calculator, and plan finish coats with the fence stain calculator. For picket-only counts on a known length, the fence picket calculator is faster.
Fence height limits, setbacks, pool-barrier rules, and frost depths vary by town. Check with your local building department and HOA before you buy materials.
Frequently asked questions
How many fence posts do I need?
Divide the fence length by the post spacing and round up to get the number of sections. A closed loop around a yard needs one post per section; a straight run needs one more for the far end. A 140 ft perimeter at 8 ft spacing needs 140 ÷ 8 = 17.5, rounded up to 18 posts. A 100 ft straight run at 8 ft needs 13 sections and 14 posts.
How far apart should fence posts be?
6 to 8 ft is standard for wood privacy and picket fences, and 8 ft is the most common because rails come in 8 ft lengths. Vinyl panel fences use the panel width, usually 6 or 8 ft. Chain link posts are typically up to 10 ft apart. Never exceed your rail or panel length, and use closer spacing in high-wind areas.
How many pickets do I need for 100 feet of fence?
Divide 1,200 inches (100 ft × 12) by the picket width plus the gap. 5.5 in pickets with a 0.5 in gap cover 6 in each, so 100 ft needs 200 pickets. Butted tight with no gap, 5.5 in pickets need 219. 3.5 in pickets with a 2.5 in gap also need 200.
How many rails per fence section?
Two rails (top and bottom) are standard for fences up to about 4 ft tall. Most 6 ft privacy fences use three rails, with the middle one keeping pickets from cupping and warping. Rails = sections × rails per section, so 18 sections with 2 rails need 36 rails.
How deep should fence posts be set?
A common rule of thumb is to bury at least one-third of the post's above-ground height, so about 2 ft for a 6 ft fence, which is why 8 ft posts are standard for 6 ft fences. Dig about 6 in deeper for a gravel drainage base, and go below your local frost line where it is deeper, or where your building department requires it.
Does the fence calculator include gates?
No. The counts cover a continuous fence line. For each gate, subtract the opening width from the picket count (a 4 ft gate removes 8 pickets at 6 in coverage), and plan a heavier post on each side of the opening. Gates usually need 4x6 or larger posts, sturdier hinges, and a deeper footing.
Estimates only. Verify quantities with your supplier before purchasing.