The Fence Length Calculator works out how many meters of fencing a rectangular yard or site needs once gates and openings are taken out. It is the starting figure for counting panels, posts and rails.
How to use the Fence Length calculator
- Enter Site length and Site width in meters, measured along the line where the fence will stand.
- Enter Combined gate/opening width: add the widths of all gates and gaps, such as a 3 m driveway gate and a 1.2 m garden gate (4.2 m total).
- Read the fence length, then divide by the panel or bay width to count sections.
How the fence length calculation works
From perimeter to fence
The calculator finds the rectangle's perimeter, 2 × (length + width), and subtracts the openings. If the openings add up to more than the perimeter, it stops with an error, which usually means a unit mix-up.
If one side borders a neighbor's existing fence or a building, that side should not be counted. Enter the site as usual and add that side's length to the openings field, which removes it from the total.
Panels, posts and slopes
Panel fences come in fixed bay widths, so divide each straight run by the bay width and round up. Each run needs one more post than it has bays, and corners and gate posts are often heavier. Gates are bought separately and need their own posts on each side.
Sloping ground does not change the horizontal length much, but stepped panels may need extra height. Check property lines before building; local rules may also limit fence height or require a permit.
Worked example
Site length: 30 m · Site width: 18 m · Combined gate/opening width: 4.2 m
- Perimeter: 2 × (30 + 18) = 96 m.
- Openings: 3 m driveway gate + 1.2 m garden gate = 4.2 m.
- Fence length: 96 − 4.2 = 91.8 m.
Result: 91.8 m
Assumptions and limits
Rectangular perimeter; no shared fences or terrain slope. Post spacing and panel package sizes excluded.
Formula and worked examples last checked November 20, 2026. Spotted a problem? Report an error.
Frequently asked questions
How do I calculate how much fencing I need?
Add up all the sides the fence will run along and subtract gate widths. For a rectangle that is 2 × (length + width) minus openings, which is what this calculator does.
How do I convert fence length to feet?
Divide meters by 0.3048. 91.8 m is about 301 ft. Panel widths vary by product, so check the one you plan to use before counting sections.
How many fence posts do I need?
For one straight run, divide the length by the post spacing, round up, and add one. Each corner, end and gate adds posts, so count each straight run separately.
Should I include the side shared with a neighbor?
Only if you are building a fence there. If an existing fence or wall already covers a side, add its length to the openings field so it is subtracted from the total.