{
    "name": "Fence Post Quantity Calculator",
    "url": "https://calculators.geekmidst.com/calculators/fence-post-quantity-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/fence-post-quantity-calculator.md",
    "category": "Construction",
    "description": "Count fence posts, bays and rails for one or more straight fence sections at a maximum post spacing, for an open run or a closed loop.",
    "summary": "Each straight section needs enough bays to keep posts within the maximum spacing. Corners share a post, and a closed loop needs one post fewer than an open run.",
    "also_called": [
        "Fence calculator",
        "Fence post spacing calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "sections",
            "label": "Straight section lengths",
            "type": "textarea",
            "default": "10, 20, 10",
            "unit": "m"
        },
        {
            "name": "spacing",
            "label": "Maximum post spacing",
            "type": "number",
            "default": "2.4",
            "unit": "m"
        },
        {
            "name": "layout",
            "label": "Fence line",
            "type": "segmented",
            "default": "open",
            "options": {
                "open": "Open run",
                "closed": "Closed loop"
            }
        },
        {
            "name": "rails_per_bay",
            "label": "Rails per bay",
            "type": "number",
            "default": "2"
        },
        {
            "name": "spare",
            "label": "Spare allowance",
            "type": "number",
            "default": "0",
            "unit": "%",
            "optional": true
        }
    ],
    "outputs": [
        {
            "key": "posts",
            "label": "Posts",
            "format": "integer"
        },
        {
            "key": "bays",
            "label": "Bays",
            "format": "integer"
        },
        {
            "key": "rails",
            "label": "Rails",
            "format": "integer"
        },
        {
            "key": "total_length",
            "label": "Fence length",
            "format": "number"
        },
        {
            "key": "corner_posts",
            "label": "End and corner posts (included)",
            "format": "integer"
        }
    ],
    "formula": {
        "text": "Bays = Σ ⌈Lᵢ ÷ s⌉;  Posts = Bays + 1 (open run) or Bays (closed loop);  Rails = Bays × rails per bay",
        "variables": {
            "Lᵢ": "length of each straight section",
            "s": "maximum post spacing"
        }
    },
    "worked_example": {
        "inputs": {
            "sections": "10, 20, 10",
            "spacing": "2.4",
            "layout": "open",
            "rails_per_bay": "2",
            "spare": "0"
        },
        "steps": [
            "Bays: ⌈10 ÷ 2.4⌉ = 5, ⌈20 ÷ 2.4⌉ = 9, ⌈10 ÷ 2.4⌉ = 5 → 19.",
            "Open run: posts = 19 + 1 = 20 (corners shared).",
            "Rails = 19 × 2 = 38."
        ],
        "result": "A 40 m fence in three straight runs with posts at most 2.4 m apart needs 20 posts and 38 rails."
    },
    "interpretation": "Corner and end posts usually need to be heavier and braced, so order them separately from the line posts.",
    "assumptions": [
        "Posts are evenly spaced within each section, at or below the maximum spacing.",
        "Adjacent sections share a corner post."
    ],
    "limitations": [
        "Gates, gate posts, post concrete and fixings are not counted."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Why does each section round up separately?",
            "answer": "A corner must have a post, so each run is divided on its own; leftover length cannot carry over a corner."
        },
        {
            "question": "How deep should posts go?",
            "answer": "Depth depends on post height, wind exposure and soil; follow the fence supplier’s guidance."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Wall Stud Quantity Calculator",
            "url": "https://calculators.geekmidst.com/calculators/wall-stud-quantity-calculator"
        },
        {
            "name": "Concrete Calculator",
            "url": "https://calculators.geekmidst.com/calculators/concrete-calculator"
        },
        {
            "name": "Length Converter",
            "url": "https://calculators.geekmidst.com/calculators/length-converter"
        }
    ],
    "disclaimer": "Quantities are estimates. Confirm requirements with your engineer or supplier before ordering materials.",
    "publisher": "GM¹X CalcVerse"
}