HomeConstruction & Home › Fence Calculator

Fence Calculator

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.

When to use

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).

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)).

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.

Inputs

ParameterTypeUnitRequiredDescription
unit_systemenum: metric | imperialdefault metricUnit system of the length inputs (metric: m / cm / mm; imperial: ft / in). Outputs are reported in both systems.
total_lengthnumberm or ftyesOverall length of the fence line including gate openings (m or ft). Range: > 0, ≤ 100000
post_spacingnumberm or ftnoMaximum centre-to-centre distance between posts; sections are spaced evenly at or below this. Default 2.4 m (metric) or 8 ft (imperial). Range: > 0, ≤ 20
gatesintegerdefault 0Number of gate openings in the run; each takes a bay between two posts. Range: ≥ 0, ≤ 50
gate_widthnumberm or ftnoWidth of each gate opening. Default 1 m (metric) or 3 ft (imperial). Range: > 0, ≤ 10
rails_per_sectionintegerdefault 2Horizontal 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. Range: ≥ 1, ≤ 5
picket_widthnumbermm or innoWidth of one picket/board in millimetres (metric) or inches (imperial). Optional; enables the picket count. Range: > 0, ≤ 1000
picket_gapnumbermm or indefault 0Gap between pickets (0 for a solid privacy fence), in mm or in. Range: ≥ 0, ≤ 1000

Outputs

OutputTypeUnitDescription
fence_length_mnumbermtotal_length − gates × gate_width.
fence_length_ftnumberftSame length in feet.
sectionsintegerceil(fence_length / post_spacing).
postsintegersections + gates + 1 (straight run; gate posts included).
actual_post_spacing_mnumbermfence_length / sections.
actual_post_spacing_ftnumberftActual spacing in feet.
railsintegersections × rails_per_section.
picketsintegerceil(fence_length / (picket_width + picket_gap)); only when picket_width is given.

Example

100 ft, 8 ft spacing, one 4 ft gate, 2 rails, 5.5 in pickets with 0.5 in gap: {"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}{"fence_length_ft":96,"fence_length_m":29.26,"sections":12,"posts":14,"actual_post_spacing_ft":8,"rails":24,"pickets":192}

30 m, 2.4 m spacing, no gate, 3 rails, 90 mm pickets with 10 mm gap: {"unit_system":"metric","total_length":30,"post_spacing":2.4,"gates":0,"rails_per_section":3,"picket_width":90,"picket_gap":10}{"fence_length_m":30,"sections":13,"posts":14,"actual_post_spacing_m":2.308,"actual_post_spacing_ft":7.571,"rails":39,"pickets":300}

GET 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

Machine access

Sources

FAQ

How deep should posts go?

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.

Why are the actual spacings smaller than the maximum?

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.

Related calculators