How to use this fence calculator
- Choose imperial or metric units. The displayed inputs convert while preserving the same physical measurements.
- Choose prefabricated panels or vertical pickets. Enter the fence height, maximum center-to-center post spacing, post face width and rail settings.
- Add a straight run for each line of fence. Enter each run's measured length. Add gate openings by width and by their starting distance from that run's start post.
- For corners or connected endpoints, give only the endpoints that truly share one physical post the same group name. Leave other groups blank.
- For panel mode, enter the product's usable panel width. For picket mode, enter board width and the largest desired clear gap.
- Optionally add a material allowance, purchase increments, concrete hole measurements, currency and real supplier prices.
- Review the drawing, required quantities, rounded shopping list and assumptions. Download a CSV or Excel workbook, or print the project estimate.
Every result is calculated in the browser. This tool estimates quantities; it does not specify a safe fence, footing, gate assembly or code-compliant design.
How to measure fence runs
Measure each straight section along the planned fence centerline, from one intended post center to the next endpoint. For a turning boundary, record each straight leg as a separate run rather than combining the legs into a diagonal or perimeter guess. Name each run and use endpoint post groups only when two run endpoints are the same physical post location.
Mark gates before entering lengths. A gate opening is measured along its run from the run's start post to the opening's first boundary. The calculator treats each opening as a no-infill interval with two boundary-post positions. Confirm whether a real gate shares a boundary post with a corner, terminal, or another gate assembly; this estimator counts a shared corner only when you explicitly group run endpoints, and it does not design gate hardware.

Fence post spacing and bay layout
Post spacing here means the distance from one post center to the next. For one uninterrupted straight run and a chosen maximum center spacing, the tool divides the line into the fewest equal bays that do not exceed that limit. When the chosen panel width requires narrower bays, that panel-width limit also constrains the layout.
bay count = ceiling(run length ÷ maximum allowed center spacing)actual center spacing = run length ÷ bay countPanel-constrained center spacingmaximum center spacing = min(user spacing limit, usable panel width + post face width)The calculator's evenly spaced result is a layout model, not a recommendation for a particular fence. The appropriate spacing depends on the actual post, rail, panel or picket system; wind exposure, grade, soil and local requirements; and the manufacturer's instructions. Do not copy an example spacing into a structural design without checking those conditions.
How to calculate the number of fence posts
For one straight open run with no gates, the number of post positions is the number of bays plus one. Across separate runs, count the endpoints of each run unless they are explicitly marked as the same shared physical post. The calculator de-duplicates matching endpoint group names; it does not infer a corner merely because two lengths look related.
Gate openings split a run into separate fence spans. Each nonzero span is divided independently, and the posts at both ends of the opening are retained as gate-boundary posts. This is why applying “bays plus one” once to the total net length would be wrong for a fence with interruptions. Intermediate bay posts are placed at equal intervals within each separate span.
How gates affect fence material quantities
Gate widths are subtracted from net infill length and excluded from ordinary panel or picket bays. Each opening has a boundary on each side. The tool counts those boundary positions as posts, except where a boundary is exactly a run endpoint or where separately entered run endpoints share a named post group.
Actual gate assemblies can require larger or different posts, hinges, latches, braces, extra rails, hardware, clearances, and allowance for slope or swing. Those are not estimated here. Verify gate manufacturer instructions and identify whether the opening dimensions refer to the clear passage, gate leaf, or post-to-post span before ordering.
Fence panels versus vertical pickets
Prefabricated panels simplify the quantity model: one cut-to-fit infill unit per calculated bay. Enter the panel's usable width, not a nominal catalog measurement that includes a post or overlap unless the manufacturer defines it that way. The calculator assumes each panel can be fitted to its bay. Some systems cannot be trimmed, use separate posts, or specify exact opening dimensions, so treat the panel count as a takeoff starting point.
With individual pickets, the calculator counts boards in each clear bay using the entered board face width and maximum gap. It redistributes the resulting gap evenly inside each bay. Decorative end spacing, overlapping boards, stepped terrain, tapered cuts and actual board-width variation are not represented. The chosen style describes the infill count only; it is not a claim that all fence products use the same layout.
How to calculate picket counts and gaps
The width available for infill in a bay is its actual post-center spacing minus one post face width. The estimator finds the largest whole number of boards that fits while keeping the equally redistributed clear gap no greater than the entered maximum.
clear width = actual center spacing − post face widthboard count = ceiling((clear width + maximum gap) ÷ (board width + maximum gap))equal gap (more than one board) = (clear width − board count × board width) ÷ (board count − 1)One-board bays have no internal gap in this simplified model. Check the first and last board margins, picket attachment method, board overlap or spacing rules, and any visual pattern separately. Boards are counted bay by bay, so gaps between posts are not inadvertently treated as continuous.
How to calculate fence rails
Enter the number of rail spans per bay and the length of the stock rail you intend to buy. Required rail length is the sum of clear post-face-to-post-face bay widths multiplied by rails per bay. The purchase model reserves one full stock piece for each continuous span, then applies any allowance and purchase increment; it does not reuse offcuts between bays.
The selected stock length must be at least as long as the largest clear bay. This avoids implying that short material can span a bay. The estimate does not calculate rail height, joinery, fastening, splices, brace rails, corner construction or a cut plan. Some manufacturers specify rail count and spacing for a specific panel or post system. For example, one product installation guide describes different rail arrangements by its own panel orientation; that instruction applies to that system only, not all fences. See the product-specific installation guide example and follow the instructions for the material you select.
Optional concrete volume: formula and limitations
If enabled, the tool estimates the geometric volume of equal cylindrical holes using your entered diameter and depth, multiplied by the unique post count. It divides that volume by the label yield entered per bag and rounds the bag count up to your selected purchase increment.
volume = unique posts × π × (hole diameter ÷ 2)² × hole depthbags = ceiling((volume ÷ stated bag yield) × (1 + allowance ÷ 100))This calculation does not subtract the volume displaced by posts and assumes identical cylinders with no over-excavation, irregular walls, collars, spillage or unused remainder. Bag yield is product-specific; enter the labeled yield rather than a generic assumed bag size. Most importantly, the calculator does not recommend hole diameter, footing depth or concrete placement. Confirm design and installation requirements with the product manufacturer, relevant local authority, and qualified local professionals where appropriate.
Independently checked imperial and metric examples
Imperial: 24 ft open run at maximum 8 ft spacing
Bays = ceiling(24 ÷ 8) = 3. Actual spacing = 24 ÷ 3 = 8 ft center to center. Posts = 3 + 1 = 4. With 4-inch posts, each clear infill span is 8 − 4/12 = 7⅔ ft. At two rails per bay, required rail length is 3 × 2 × 7⅔ = 46 ft. If each continuous span uses an 8 ft stock piece, six pieces are reserved (three bays × two rails), without offcut reuse.
Metric: 10 m open run at maximum 2.5 m spacing
Bays = ceiling(10 ÷ 2.5) = 4. Actual spacing = 10 ÷ 4 = 2.5 m. Posts = 4 + 1 = 5. With 100 mm posts, clear span = 2.5 − 0.1 = 2.4 m. At two rails per bay, required rail length = 4 × 2 × 2.4 = 19.2 m. If each rail span uses a 3 m stock piece, eight pieces are reserved.
Imperial: 24 ft run with a 4 ft interior gate
Put the gate at 10 ft from the start. The remaining fence spans are 10 ft and 10 ft. Each span needs ceiling(10 ÷ 8) = 2 bays, with 5 ft actual spacing. Total = 4 bays. The two spans each have 3 post positions, so there are 6 unique posts, including both gate boundaries. Net infill is 24 − 4 = 20 ft. This demonstrates why one global bays-plus-one calculation across the line would undercount posts.
These examples assume straight level centerlines, equal spacing per gate-free span, 4-inch/100-mm post face widths where stated, and two rails per bay. They are arithmetic checks only; the fence materials and installation system may require a different layout.
Fence post-spacing reference tables
Tables below show geometric bay and post counts for uninterrupted straight open runs, with no gates, no shared endpoints, and no panel-width restriction. The entered spacing is treated as a maximum; actual spacing is evenly divided. These examples are not structural spacing recommendations.
Imperial open-run quantities
| Run length | Max. spacing | Bays | Posts | Actual spacing |
|---|---|---|---|---|
| 24 ft | 8 ft | 3 | 4 | 8 ft |
| 25 ft | 8 ft | 4 | 5 | 6.25 ft |
| 50 ft | 8 ft | 7 | 8 | 7.14 ft |
| 100 ft | 8 ft | 13 | 14 | 7.69 ft |
Metric open-run quantities
| Run length | Max. spacing | Bays | Posts | Actual spacing |
|---|---|---|---|---|
| 10 m | 2.5 m | 4 | 5 | 2.5 m |
| 12 m | 2.5 m | 5 | 6 | 2.4 m |
| 20 m | 2.5 m | 8 | 9 | 2.5 m |
| 30 m | 2.5 m | 12 | 13 | 2.5 m |
For a run length that is not a whole multiple of the maximum spacing, the calculator divides the run evenly. For example, a 25 ft run at 8 ft maximum spacing uses four equal 6.25 ft bays rather than a short leftover bay.
Common fence ordering mistakes
- Using perimeter alone. A gate or corner changes how many separate spans and endpoint posts exist.
- Counting a gate as normal infill. Gate width is not panel or picket width; enter openings explicitly.
- Double-counting a corner post. Use the same endpoint group only when two run ends are one actual post; do not group unrelated lines.
- Ignoring panel fit. Nominal panel width, post-center spacing, clear opening and trimmability are not always the same measurement.
- Confusing center spacing with clear width. The infill span is reduced by the post face width.
- Assuming one rail layout fits every product. Confirm rail count, attachment, stock length and any panel requirements with its manufacturer.
- Using a generic concrete yield. Product labels differ; use the actual bag yield and account for site variability separately.
- Rounding the required length prematurely. The tool keeps calculated lengths through the estimate and rounds only the chosen purchase units.
- Forgetting gate hardware, fasteners or finishing. These are outside the material takeoff and need a separate project list.
- Treating the allowance as guaranteed waste coverage. It is an optional buffer, not a guarantee or installation recommendation.
Estimate fence material costs from real prices
Enter the supplier's current price for each selected material. The calculator multiplies those prices by the rounded purchase quantities, such as panel count, rail stock-piece count or concrete-bag count. A blank price remains “Price not entered”; it is never replaced with a typical or invented price. Partial prices are labeled as a subtotal, not a complete project total.
Compare like-for-like products and include items that are outside this calculator: gate leaves and hardware, fasteners, caps, braces, finishing products, delivery, taxes, labor, tools and waste or return terms. Supplier packaging may impose minimum quantities or increments, so use the increments shown on your quote.
Local regulations, utilities and site conditions
Before buying or digging, verify property lines, easements, permits, fence-height or visibility requirements, and any local or neighborhood restrictions with the authorities that apply to your property. Requirements differ by jurisdiction and site, and this estimator does not determine them.
Identify buried services before excavation. In the United States, the 811 Before You Dig service explains how to request a utility locate; outside the U.S., contact the applicable local one-call or utility-locating service. Wait for required markings and follow the local process. Also check slope, drainage, soil, frost, wind exposure, existing structures and access with a qualified local professional when they affect the design. No calculated quantity certifies that a fence or footing is safe.
Fence calculator FAQs
How many fence posts do I need for a 24-foot run?
At a maximum 8-foot spacing with no gate, the estimate is 3 bays and 4 posts. If a gate, corner, constrained panel width or shared endpoint changes the layout, the count changes.
Does fence post spacing mean center to center?
Yes. The entered maximum and displayed actual spacing are center-to-center distances between adjacent post locations. Clear infill width subtracts one post face width.
How are gate posts counted?
Each entered gate splits a run into separate fence spans. Its two boundaries are post positions and are not counted as ordinary fence infill. Posts shared by connected runs are deduplicated only through matching endpoint groups.
Can I use the result for any fence panel or picket system?
No. Panel trimming, post dimensions, rail arrangements, fasteners and picket edge gaps vary. Treat the result as a material-planning estimate and verify the exact manufacturer's system.
Does the calculator recommend post-hole depth or concrete footing size?
No. Optional concrete volume is a cylinder arithmetic estimate using your own entered hole dimensions and product yield. It is not a footing design or burial-depth recommendation.
Why is my cost shown as a subtotal or “Price not entered”?
Only prices you enter are used. If some selected materials are unpriced, the sum is a partial subtotal and identifies missing prices; when no prices are entered, no project cost is displayed.
Does it include gate hardware, fasteners or delivery?
No. The estimate covers the displayed posts, panels or pickets, rail stock and optional concrete. Gate assemblies, hardware, fasteners, taxes, delivery, labor and tools should be budgeted separately.
Can I export more than one fence run?
Yes. The live estimate, report, CSV and Excel workbook use the same calculation result and include each entered run and gate.
Sources and further checks
- Example product-specific fence panel installation guide — consult the manufacturer's instructions for your selected system; rail examples are not universal.
- 811 Before You Dig — United States utility-locate information. Use the applicable local one-call service elsewhere.
- Fence guide photo by QY Liu — local optimized copy used under the Unsplash License.
Worked examples and tables above are independently checked geometric arithmetic. They do not replace product instructions, site measurements or local approvals.