Fence Calculator

Plan a level fence with straight runs, shared corners and optional gates. See how gate placement changes panel counts, inspect every opening, and estimate separate-item material costs.

Layout & materials

Plan panels, posts and gates

Try a layout

Fence measurements

Measure runs between post centers. Use the product's maximum center spacing, not nominal panel width. This model uses one post width and equally spaced, cuttable panels on level ground.

Runs and optional gates

Run 1

Gate openings must include the manufacturer's hinge/latch clearance. The two post centers are another post width apart. A gate may start at an open end, but cannot share a corner. Rectangle runs go clockwise from the top left; an L runs right, then down.

Purchase assumptions

Separate-item prices · USD

Prices are illustrative. Enter separate-item prices; use zero for an item already included in a kit so it is not priced twice. Tax, delivery, footings, installation and extra hardware are excluded.

Method, sources and supported layouts

Gate center span = required clear opening + post width. Each fenced segment on either side is divided into ceiling(segment length ÷ maximum center spacing) equal spans. Shared corners count once. Post categories are mutually exclusive; a gate post at an open end is counted as a gate post.

Clear openings subtract one post width from a center span. They are not rail cut lengths: brackets, insertion depths, minimum panel widths and fastening rules depend on the product. No offcut reuse is assumed. The estimate does not design post strength, footing depth, slopes or pool barriers.

Supported limits: 20 separate runs; 0.01–1000 m per run; 10,000 m total; 2000 panel/gate spans; 1000 spare panels. Post width is 0.1–100 cm, center spacing is greater than post width and at most 100 m, and clear gate opening is 0.01–20 m. These are computation limits, not installation recommendations.

See Trex's layout and gate guidance and Freedom's installation instructions. Their product-specific spacings and hardware allowances are not universal. Confirm the actual product, property lines, utilities and local requirements before installation.

How to use this calculator

  1. Choose Measurement units and Layout: a straight run, connected L, rectangular enclosure or separate straight runs. Enter the product's Maximum post-center spacing and Post width.
  2. Enter each Run centerline length, measured between the centers of its end posts. Opposite rectangle sides share a length. Add or remove runs only for a separate-run layout.
  3. For a gate, enter First gate-post center from run start and Required clear gate opening, including the manufacturer's hinge and latch clearance. Keep gate posts away from shared corners.
  4. Enter Spare panels to buy. Expand Separate-item prices to replace the illustrative USD prices; use zero for a cost already included in another kit price.
  5. Review the scaled Post-center layout, working and spare panel counts, unique post counts and Every span and clear opening table. These openings exclude product-specific rail insertion and mounting allowances.
  6. Download the plan and costs CSV, then check actual product dimensions, minimum cut widths, bundled components and site requirements with the supplier or installer.

The Formula

The mathematical logic powering this calculation is:

Gate center span = required clear gate opening + post width.
Split a run into fenced segments before and after its gate. Panels in each segment = ceiling(segment length ÷ maximum post-center spacing).
Actual center spacing = segment length ÷ its panel count. Clear panel opening = actual center spacing − post width.
Unique posts in a simple open chain = panel spans + gate spans + 1; in a closed rectangle, unique posts = panel spans + gate spans. Separate runs retain separate end posts.
Panels to buy = working panels + whole spare panels. Estimated cost = sum of each separate item's quantity × entered unit price. Clear openings are not rail cut lengths.

Worked Example

If you input:

  • Measurement units: Metric
  • Layout: Straight run
  • Maximum post-center spacing: 3 m
  • Post width: 10 cm
  • Run 1 centerline length: 10 m
  • First gate-post center from run start: 3.5 m
  • Required clear gate opening: 2.9 m
  • Spare panels to buy: 0
  • Separate-item prices: Panel $80; end, line and corner posts $20 each; gate posts $30 each; gate $150

Result:

The gate occupies 2.9 + 0.1 = 3 m between its post centers. Each remaining fenced segment is 3.5 m, so each needs ceiling(3.5 ÷ 3) = 2 panels. The plan has 4 working panels, 1 gate and 6 unique posts: 2 end posts, 2 line posts and 2 gate posts. Panel centers are 1.75 m apart, leaving 1.65 m clear openings. With no spares, the separate-item estimate is 4 × $80 + 4 × $20 + 2 × $30 + $150 = $610, excluding tax, delivery, footings, installation and extra hardware.

Frequently Asked Questions

Should I measure from post centers or from the outside edges?

This calculator uses post-center-to-post-center measurements for run lengths and maximum spacing. Post width is entered separately in centimetres or inches and is assumed to be the same for every post. A product's nominal panel width is not necessarily its required post-center spacing. Follow the actual manufacturer's layout dimensions; the plan does not infer them from a panel's advertised size.

Why can moving a gate change how many panels I need?

A gate splits the fence into separate segments, and each segment needs a whole number of panels. A 10 m run with a 3 m gate-center span leaves 7 m of fencing. At a 3 m maximum spacing, two 3.5 m segments need four panels, while segments of 3 m and 4 m need three. Rounding the combined 7 m first would miss this difference. The gate's clear opening already needs its specified hinge and latch allowance; one post width is then added to obtain its center span.

How are shared corners and gate posts counted?

The connected L and rectangular enclosure share one physical post at each corner. Separate runs do not share their endpoints. End, line, corner and gate post categories are mutually exclusive, and a gate post at an open end is counted as a gate post. A gate cannot share a corner in this model because that combination needs a product-specific mounting and support rule. Branching or intersecting fences are not supported.

Are the clear openings the lengths I should cut my rails to?

No. A clear opening is the distance between post faces, calculated as center spacing minus post width. Rails may need additional length for insertion into posts or different allowances for brackets and hardware. The tool assumes cuttable panels and equal spacing within each segment; it does not verify minimum cut widths, picket spacing, mounting compatibility or whether offcuts can be reused. Each working span is allocated one panel blank.

Does this plan handle slopes, footings or structural design?

No. It estimates a level layout using one post width and your product's maximum spacing. It does not design post strength, footing dimensions, wind resistance, soil support, stepped or racked panels, pool barriers or legal boundaries. The computation limits are not construction recommendations. Confirm your product instructions, utilities and local installation requirements independently.

What does the cost estimate include?

It prices working panels, whole spare panels, end posts, line posts, corner posts, gate posts and gates as separate items using your entered USD prices. A spare increases the purchase quantity but not the installed layout. If a kit includes posts or hardware, adjust the separate prices so you do not charge for them twice. The estimate excludes tax, delivery, footings, installation and additional hardware unless included in the entered item prices. It is not a supplier quote or an order guarantee.

What changes when I switch units or export the plan?

Switching metric and imperial converts run lengths, gate dimensions, spacing and post width while preserving the physical project and item prices. Complete blank measurement fields before switching; invalid drafts are preserved. The CSV includes assumptions, canonical metre measurements, every span and clear opening, post categories, spare quantities and separate-item costs. The scaled diagram uses symbolic post markers; the table provides the numerical measurements.

Similar Calculators