Fence Calculator for Irregular Yards
This free fence calculator works out everything you need to fence a yard of any shape: angled lots, L-shaped gardens, pie-shaped corner lots, or runs that stop at the house. Enter the length of each side, add your gates, and choose your post spacing. You’ll get the total fence length, posts, panels or sections, rails, pickets, and post concrete, plus an optional cost estimate, with every step of the math shown.
1. Fence sides
2. Fence details
3. Pickets (optional)
4. Prices (optional)
Show step-by-step working
Why Irregular Yards Need a Different Fence Calculator
Most fence calculators assume a rectangle: give them a length and a width and they double it. Real yards rarely work that way. A lot can be pie-shaped, a side can angle in toward the street, and one side is often the house itself, which needs no fence at all.
Irregular yards also have more corners, and every corner needs a post. If you divide the total length by the post spacing and ignore the corners, you’ll come up short on posts and panels. This calculator works side by side, so every corner and every gate is counted.
How to Use the Fence Calculator
1. Enter the fence sides
- Measure each straight run of fence from corner to corner, and enter them in order as Side 1, Side 2, Side 3…
- Leave out any side that doesn’t need fencing, such as the wall of the house or an existing fence you’re keeping.
- Tick “Fence goes all the way around” only if the fence closes back on itself with no wall in the loop.
- Use “+ Add side” for more sides, or × to remove one.
2. Fill in the fence details
- Post spacing / panel width: the distance from one post to the next. Most wood panels are 8 ft (2.4 m); vinyl panels are often 6 or 8 ft.
- Gates: how many gates and how wide each one is. Gate openings are removed from the fence length.
- Rails per section: horizontal rails between posts. Fences up to about 4 ft usually use 2 rails; 6 ft privacy fences usually use 3. Choose “None” for ready-made panels or chain link.
- Concrete bags per post: many DIY guides use about 2 bags of fast-setting concrete per post. Leave blank to skip.
3. Pickets and prices (optional)
- Picket width and gap: a common wood picket is 3.5 in wide. For a privacy fence with no gaps, enter a gap of 0.
- Prices: enter the price per panel, per post, and per gate to see a total cost.
Press Calculate fence to see the totals, then open “Show step-by-step working” to follow every calculation.
The Formulas Behind the Calculator
Step 1: Fence length
Add up all the sides, then take out the gate openings:
Fence length = Sum of all sides − (Number of gates × Gate width)
Step 2: Panels or sections
Each side is divided by the post spacing and rounded up, so a short leftover piece still gets its own panel and every corner lands on a post. Each gate then takes the place of one section:
Panels = the larger of ( Sum of ⌈Side ÷ Spacing⌉ − Gates ) and ⌈Fence length ÷ Spacing⌉
The second part makes sure that wide gates never leave you with too few panels. (⌈ ⌉ means round up.)
Step 3: Posts
A straight run of fence always needs one more post than it has sections. Each gate breaks the fence into a separate run, and each run needs its own end post:
Posts = Panels + Number of separate runs
- Open fence (ends at the house or a wall): runs = gates + 1
- Closed loop with gates: runs = number of gates
- Closed loop with no gate: runs = 0, so posts = panels
This count already includes corner posts, end posts, and gate posts.
Step 4: Rails and pickets
Rails = Panels × Rails per section
Pickets = ⌈Fence length in inches ÷ (Picket width + Gap)⌉
Worked Example 1: A Backyard That Ends at the House
A backyard is fenced on three sides, 60 ft, 40 ft, and 60 ft, and the house forms the fourth side. There’s one 4-ft gate, posts every 8 ft, 2 rails per section, and 3.5-in pickets with 0.5-in gaps.
- Total boundary = 60 + 40 + 60 = 160 ft
- Fence length = 160 − (1 × 4) = 156 ft
- Sections per side: 60 ÷ 8 = 7.5 → 8, 40 ÷ 8 = 5, 60 ÷ 8 → 8. Total = 21
- Panels = larger of (21 − 1 = 20) and (156 ÷ 8 = 19.5 → 20) = 20 panels
- Runs = 1 gate + 1 (open fence) = 2, so posts = 20 + 2 = 22 posts
- Rails = 20 × 2 = 40 rails (8 ft each)
- Pickets = 156 × 12 = 1,872 in ÷ (3.5 + 0.5) = 468 pickets
- Post concrete = 22 × 2 = 44 bags
These are the numbers behind the “Try an example” button.
Worked Example 2: A Metric Garden With a Full Loop
A garden is fenced all the way around: sides of 12 m, 9 m, 12 m, and 9 m, with one 1-m gate. Posts are every 2.4 m, with 3 rails per section.
- Total boundary = 12 + 9 + 12 + 9 = 42 m
- Fence length = 42 − 1 = 41 m
- Sections per side: 12 ÷ 2.4 = 5, 9 ÷ 2.4 = 3.75 → 4, 5, 4. Total = 18
- Panels = larger of (18 − 1 = 17) and (41 ÷ 2.4 = 17.08 → 18) = 18 panels
- Closed loop with 1 gate = 1 run, so posts = 18 + 1 = 19 posts
- Rails = 18 × 3 = 54 rails (2.4 m each)
- Post concrete = 19 × 2 = 38 bags
Notice the second rule did the work here: subtracting one section for the gate gave 17, but 41 m of fence still needs 18 panels.
Worked Example 3: Estimating the Cost
Using the backyard from Example 1, say panels cost $65, posts $18, and the gate $120. (These are example prices. Check your local supplier.)
- Panels: 20 × $65 = $1,300
- Posts: 22 × $18 = $396
- Gate: 1 × $120 = $120
- Total = $1,816, before concrete, screws, hinges, latches, and any labor
Common Post Spacing by Fence Type
| Fence type | Typical post spacing | Typical rails |
|---|---|---|
| Wood privacy (6 ft) | 6–8 ft (1.8–2.4 m) | 3 |
| Wood picket (3–4 ft) | 8 ft (2.4 m) | 2 |
| Vinyl panels | 6 or 8 ft, set by the panel width | Built into panel |
| Chain link | Up to 10 ft (3 m) | Top rail only |
| Split rail | 8–10 ft, set by the rail length | 2–3 |
These are general figures. Use the spacing your fence product or local code calls for, especially in windy areas, where closer posts are stronger.
Tips for Measuring an Irregular Yard
- Measure each straight run separately, from corner post to corner post. Don’t measure diagonally across the yard.
- Follow the property line, not the lawn edge. Many places require fences to sit a little inside the line. Check with your local office or HOA, and call your local utility-locating service before you dig.
- Curved boundaries: break a curve into several short straight sides. Each one adds a post, which is how curved fences are actually built.
- Slopes: measure the horizontal distance, not along the ground. A stepped fence on a slope may need extra posts at each step.
- Got the map area? Our Map Area Calculator shows the perimeter of any lot, which is a good starting point for total fence length.
Common Mistakes to Avoid
- Dividing the total length by the spacing: this skips corner posts and leaves you short. Work side by side, as this calculator does.
- Forgetting the end post: a straight run of 5 sections needs 6 posts, not 5.
- Counting the gate as fence: the gate opening needs gate hardware, not a panel.
- Not rounding up: 7.5 panels means you need 8, and you cut the last one to fit.
- Fencing the house wall: leave out any side that’s already a wall or an existing fence.
Related Calculators
- Irregular Shape Perimeter Calculator: total boundary length from coordinates
- Map Area Calculator: trace your lot on a map to get its perimeter
- Concrete Slab Calculator: for a pad by the gate or a shed base
- Garden & Plot Area Calculator: area inside the fence

One Comment