Skip to content

Post and Rail Fence Calculator — Posts, Rails & Wire

Calculate posts, rails, postcrete and wire mesh for post and rail fencing. Ideal for gardens, paddocks and rural boundaries in the UK.

Total length of fencing needed

Include stock wire mesh

Add wire mesh for livestock or pet containment

Include wastage allowance

Adds 10% extra for cutting waste and off-cuts

10% is standard for post and rail fencing


Enter your supplier price for a cost estimate

Enter your supplier price for a cost estimate

Enter your supplier price for a cost estimate

How We Calculate This

Our post and rail calculator works by dividing your fence run length by the post spacing to get the number of bays, then adding one post for the end of the run. Rails are counted geometrically: because rails must butt-join at the centre of a post (never mid-bay), each rail can only span a whole number of bays.

The formula

Bays = Fence length ÷ Post spacing (rounded up)
Posts = Bays + 1
Bays per rail = Rail length ÷ Post spacing (rounded down, min 1)
Rails = ⌈Bays ÷ Bays per rail⌉ × Number of rail lines
Post length = Fence height + 600mm (burial depth)

For example, a 20m fence run at 1.8m spacing needs ⌈20 ÷ 1.8⌉ = 12 bays, so 13 posts. Each 3.6m rail spans two 1.8m bays (3.6 ÷ 1.8 = 2), so one rail line needs ⌈12 ÷ 2⌉ = 6 rails; with 3 rail lines that is 6 × 3 = 18 rails, every joint landing on a post. Post length for a 1.2m fence is 1.2m + 0.6m = 1.8m.

If you pick a post spacing that does not divide evenly into the rail length (for example 2.4m spacing with 3.6m rails), each rail has to be cut down to a single bay with off-cut waste, so the calculator counts one rail per bay and shows a warning. Pair 3.6m rails with 1.8m spacing, or 4.8m rails with 2.4m spacing, for waste-free joints.

Post length, depth and timber treatment

The calculator works out the post length you need to buy by adding the burial depth to your chosen fence height. The default 600mm (2ft) burial is the usual working depth for domestic post and rail fencing; taller fences, gate posts, corner posts and exposed or soft ground should go deeper (often 750mm or more), and a useful guide is to set roughly a quarter to a third of the total post length below ground. So a 1.2m fence at 600mm depth needs a 1.8m post. Any post in permanent ground contact must be pressure-treated to Use Class 4 (UC4) per BS EN 335:2013 and BS 8417 - ordinary UC3 timber buried in soil can rot off at the groundline within a few years.

Post and rail fencing tips

  • Use UC4 pressure-treated timber for all ground contact posts
  • Butt rail ends at the centre of a post — never leave a joint mid-bay between posts
  • Stagger the joints of the top, middle and bottom rails onto different posts
  • On sloping ground, use closer post spacing and step the rails
  • Pre-drill nail holes in hardwood rails to prevent splitting
  • For paddock fencing, place rails on the inside so stock pushes against posts

Frequently Asked Questions

Was this calculator helpful?

Last updated: February 2026

Verified against UK standards · estimates only, confirm with your supplier.