{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"fence"},"result":{"entity_type":"calculator","id":"fence","calculator_id":"fence","canonical_url":"https://tttkmbb.com/construction/fence","name":"Fence Calculator","title":"Fence Calculator – Posts, Rails and Pickets from Length, Post Spacing and Gates","category":"construction","category_name":"Construction & Home","tool_name":"estimate_fence_materials","featured_mcp_tool":false,"description":"Estimates the posts, rails and pickets for a straight run of wooden fence from the total length, the maximum post spacing, the number and width of gates, the rails per section and the picket width plus gap.","use_when":"You need a material list (posts, rails, pickets) for a picket, privacy or post-and-rail fence of a known length.","do_not_use_when":"You need concrete for the post holes (use cylinder for the hole volume and concrete-slab for bags), or the fence is chain-link or panel fencing sold per panel (divide the length by the panel width instead).","inputs":[{"name":"unit_system","label":"Unit system","type":"enum","required":false,"default":"metric","values":[{"value":"metric","label":"Metric (m, cm, mm, m²)","aliases":["si","metres","meters"]},{"value":"imperial","label":"Imperial / US customary (ft, in, ft²)","aliases":["us","feet","inches"]}],"description":"Unit system of the length inputs (metric: m / cm / mm; imperial: ft / in). Outputs are reported in both systems.","example":"metric"},{"name":"total_length","label":"Total fence length","type":"number","unit":"m or ft","required":true,"max":100000,"exclusive_min":0,"description":"Overall length of the fence line including gate openings (m or ft).","example":30},{"name":"post_spacing","label":"Maximum post spacing","type":"number","unit":"m or ft","required":false,"max":20,"exclusive_min":0,"description":"Maximum centre-to-centre distance between posts; sections are spaced evenly at or below this. Default 2.4 m (metric) or 8 ft (imperial).","example":2.4},{"name":"gates","label":"Gates","type":"integer","required":false,"default":0,"min":0,"max":50,"description":"Number of gate openings in the run; each takes a bay between two posts.","example":0},{"name":"gate_width","label":"Gate width","type":"number","unit":"m or ft","required":false,"max":10,"exclusive_min":0,"description":"Width of each gate opening. Default 1 m (metric) or 3 ft (imperial).","example":1},{"name":"rails_per_section","label":"Rails per section","type":"integer","required":false,"default":2,"min":1,"max":5,"description":"Horizontal rails between each pair of posts: 2 for fences up to about 1.2 m / 4 ft, 3 for 1.8 m / 6 ft privacy fences.","example":3},{"name":"picket_width","label":"Picket width","type":"number","unit":"mm or in","required":false,"max":1000,"exclusive_min":0,"description":"Width of one picket/board in millimetres (metric) or inches (imperial). Optional; enables the picket count.","example":90},{"name":"picket_gap","label":"Gap between pickets","type":"number","unit":"mm or in","required":false,"default":0,"min":0,"max":1000,"description":"Gap between pickets (0 for a solid privacy fence), in mm or in.","example":10}],"outputs":[{"name":"fence_length_m","label":"Fenced length (excl. gates)","type":"number","unit":"m","decimals":2,"description":"total_length − gates × gate_width."},{"name":"fence_length_ft","label":"Fenced length (excl. gates)","type":"number","unit":"ft","decimals":2,"description":"Same length in feet."},{"name":"sections","label":"Fence sections","type":"integer","decimals":4,"description":"ceil(fence_length / post_spacing)."},{"name":"posts","label":"Posts","type":"integer","decimals":4,"description":"sections + gates + 1 (straight run; gate posts included)."},{"name":"actual_post_spacing_m","label":"Actual post spacing","type":"number","unit":"m","decimals":3,"description":"fence_length / sections."},{"name":"actual_post_spacing_ft","label":"Actual post spacing","type":"number","unit":"ft","decimals":3,"description":"Actual spacing in feet."},{"name":"rails","label":"Rails","type":"integer","decimals":4,"description":"sections × rails_per_section."},{"name":"pickets","label":"Pickets","type":"integer","decimals":4,"description":"ceil(fence_length / (picket_width + picket_gap)); only when picket_width is given."}],"input_schema":{"type":"object","properties":{"unit_system":{"description":"Unit system of the length inputs (metric: m / cm / mm; imperial: ft / in). Outputs are reported in both systems.","type":"string","enum":["metric","imperial"],"default":"metric","examples":["metric"]},"total_length":{"description":"Overall length of the fence line including gate openings (m or ft). Unit: m or ft.","type":"number","maximum":100000,"exclusiveMinimum":0,"examples":[30],"x-unit":"m or ft"},"post_spacing":{"description":"Maximum centre-to-centre distance between posts; sections are spaced evenly at or below this. Default 2.4 m (metric) or 8 ft (imperial). Unit: m or ft.","type":"number","maximum":20,"exclusiveMinimum":0,"examples":[2.4],"x-unit":"m or ft"},"gates":{"description":"Number of gate openings in the run; each takes a bay between two posts.","type":"integer","minimum":0,"maximum":50,"default":0,"examples":[0]},"gate_width":{"description":"Width of each gate opening. Default 1 m (metric) or 3 ft (imperial). Unit: m or ft.","type":"number","maximum":10,"exclusiveMinimum":0,"examples":[1],"x-unit":"m or ft"},"rails_per_section":{"description":"Horizontal rails between each pair of posts: 2 for fences up to about 1.2 m / 4 ft, 3 for 1.8 m / 6 ft privacy fences.","type":"integer","minimum":1,"maximum":5,"default":2,"examples":[3]},"picket_width":{"description":"Width of one picket/board in millimetres (metric) or inches (imperial). Optional; enables the picket count. Unit: mm or in.","type":"number","maximum":1000,"exclusiveMinimum":0,"examples":[90],"x-unit":"mm or in"},"picket_gap":{"description":"Gap between pickets (0 for a solid privacy fence), in mm or in. Unit: mm or in.","type":"number","minimum":0,"maximum":1000,"default":0,"examples":[10],"x-unit":"mm or in"}},"additionalProperties":false,"required":["total_length"]},"output_schema":{"type":"object","properties":{"fence_length_m":{"description":"total_length − gates × gate_width. Unit: m.","type":"number","x-unit":"m"},"fence_length_ft":{"description":"Same length in feet. Unit: ft.","type":"number","x-unit":"ft"},"sections":{"description":"ceil(fence_length / post_spacing).","type":"integer"},"posts":{"description":"sections + gates + 1 (straight run; gate posts included).","type":"integer"},"actual_post_spacing_m":{"description":"fence_length / sections. Unit: m.","type":"number","x-unit":"m"},"actual_post_spacing_ft":{"description":"Actual spacing in feet. Unit: ft.","type":"number","x-unit":"ft"},"rails":{"description":"sections × rails_per_section.","type":"integer"},"pickets":{"description":"ceil(fence_length / (picket_width + picket_gap)); only when picket_width is given.","type":"integer"}}},"formula":"fence_length = total_length − gates × gate_width; sections = ceil(fence_length / post_spacing); posts = sections + gates + 1; actual_spacing = fence_length / sections; rails = sections × rails_per_section; pickets = ceil(fence_length / (picket_width + picket_gap)).","method":"Assumes one straight run with posts at both ends and gates as extra bays; for a closed loop (fence all the way round) subtract 1 post, and add one post per corner or change of direction. Gate hardware, post concrete and cap rails are not included.","sources":[{"name":"Lowe's – How to build a wood fence (posts 6–8 ft on centre, 3 rails for 6 ft pickets)","url":"https://www.lowes.com/n/how-to/install-a-wood-fence","type":"reference","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"100 ft, 8 ft spacing, one 4 ft gate, 2 rails, 5.5 in pickets with 0.5 in gap","inputs":{"unit_system":"imperial","total_length":100,"post_spacing":8,"gates":1,"gate_width":4,"rails_per_section":2,"picket_width":5.5,"picket_gap":0.5},"expected":{"fence_length_ft":96,"fence_length_m":29.26,"sections":12,"posts":14,"actual_post_spacing_ft":8,"rails":24,"pickets":192},"url":"https://tttkmbb.com/api/v1/calculate/fence?unit_system=imperial&total_length=100&post_spacing=8&gates=1&gate_width=4&rails_per_section=2&picket_width=5.5&picket_gap=0.5"},{"name":"30 m, 2.4 m spacing, no gate, 3 rails, 90 mm pickets with 10 mm gap","inputs":{"unit_system":"metric","total_length":30,"post_spacing":2.4,"gates":0,"rails_per_section":3,"picket_width":90,"picket_gap":10},"expected":{"fence_length_m":30,"sections":13,"posts":14,"actual_post_spacing_m":2.308,"actual_post_spacing_ft":7.571,"rails":39,"pickets":300},"url":"https://tttkmbb.com/api/v1/calculate/fence?unit_system=metric&total_length=30&post_spacing=2.4&gates=0&rails_per_section=3&picket_width=90&picket_gap=10"}],"faq":[{"q":"How deep should posts go?","a":"About one third of the post length, below the local frost line: a 1.8 m (6 ft) fence typically uses 2.4 m (8 ft) posts set 60 cm (2 ft) deep in concrete."},{"q":"Why are the actual spacings smaller than the maximum?","a":"The run is divided into equal sections so that no bay exceeds post_spacing; e.g. 30 m at a 2.4 m maximum needs 13 sections of 2.31 m."}],"tags":["fence calculator","fence posts","pickets","fence rails","privacy fence","how many fence posts"],"related":[{"calculator_id":"decking","reason":"Boards and joists for a deck alongside the fence."},{"calculator_id":"concrete-slab","reason":"Bags of concrete for post footings."},{"calculator_id":"cylinder","reason":"Volume of a round post hole."}],"links":{"html":"https://tttkmbb.com/construction/fence","markdown":"https://tttkmbb.com/construction/fence.md","json":"https://tttkmbb.com/construction/fence.json","api":"https://tttkmbb.com/api/v1/calculate/fence","schema":"https://tttkmbb.com/api/v1/calculators/fence","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:23:14Z"}