Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Calculate posts, rail sections, and balusters needed for a railing from its length and spacing.
A railing's post count depends on how far apart posts can safely span (typically limited by rail material strength, commonly around 6ft on-center), while its baluster count depends on a completely separate constraint: a code-driven maximum gap (commonly 4 inches, sized to prevent a small child's head passing through). This calculator handles both independently.
Enter your railing's total length, your chosen post spacing (check your rail material's span rating), and your maximum baluster gap (4 inches is a very common residential code maximum, though always verify locally).
Rail Sections = ceil(Length ÷ Post Spacing)
Posts = Rail Sections + 1
Balusters = ceil((Length × 12) ÷ Baluster Gap)
Posts are always one more than the number of sections between them, the same "off-by-one" relationship as fence posts.
The baluster count here is a simplified even-spacing estimate -- real installations typically adjust the actual gap slightly on each section so balusters space out evenly rather than leaving one oddly-sized gap at the end.
Imagine a 30-foot deck edge with 6-foot post spacing and a 4-inch maximum gap. Dividing 30 by 6 gives 5 rail sections, so you need 6 posts. For balusters, convert the length to inches (360) and divide by the 4-inch gap, giving 90 balusters. Adding a small allowance for cutting mistakes or a slightly different final spacing is reasonable when you order.
The calculator divides the whole railing length by the gap. In reality, each section is bounded by posts, and each baluster has its own physical width. A baluster is not a zero-thickness line, so the clear gap between two balusters is the center spacing minus the baluster width. If you are using thick balusters, the same number of pieces will leave smaller gaps than the limit, which is fine for safety. If you are using very thin balusters, check that your spacing still satisfies the clear-opening rule rather than only the center-to-center number.
Spacing is often set by the rail material. Manufactured rail kits publish a maximum span, and going beyond it can make the rail feel flexible. Wood 2x4 top rails and metal or composite systems differ, so read the product literature. Post attachment matters as much as spacing: a railing must resist a specified load pushed against the top rail, and local codes set that requirement. A deck guard is a safety component, so check requirements for height, load, and opening size with your local building department.
Add fasteners, brackets, and top and bottom rails to your shopping list, since they are not counted by post and baluster totals.
It's a common residential building code maximum sized to prevent a young child's head from passing through the gap -- always confirm the exact requirement with your local code, since it can vary.
This calculator assumes one continuous straight run -- an L-shaped or multi-run railing needs a corner post counted separately for each direction change.
Many builders order a few more than the count to allow for damaged or miscut pieces, especially if the material is specialty metal or composite.
Not separately. If your run includes a gate, plan for extra hardware and possibly heavier posts at the gate opening.
No. Height requirements come from local code and are not part of the count calculation.