Deck Baluster Spacer

What this calculator does

The Deck Baluster Spacer calculates even, code-compliant spacing for the pickets (balusters) on a deck or stair railing. Enter the total run length, the baluster width, and the maximum allowed gap — typically the 4-inch code rule that prevents a child's head from passing through — and the tool works out the exact spacing and number of balusters so the gaps are equal and legal. It handles the fiddly division that makes railing layout frustrating, including the center-to-center spacing you need for consistent placement. Everything runs in your browser, so you can check the numbers on site with your phone. The tool turns a layout job that usually involves repeated trial measurements into a single calculation you can trust before you drill a single hole or cut a single picket.

How to use it

The formula or method

Equal spacing comes from dividing the run into equal gaps rather than equal balusters. The tool finds how many balusters fit such that every gap is at or below your maximum (commonly the 4-inch code sphere), then computes the gap as (run minus total baluster width) divided by (number of gaps). The number of gaps is one more than the number of balusters when both ends sit against posts. The center-to-center distance is the gap plus one baluster width, which is what you mark along the rail to keep spacing consistent without accumulating measurement error.

A worked example

A railing run of 96 inches between posts, with 1.5-inch balusters and a 4-inch maximum gap. The tool calculates that 19 balusters leave gaps of about 3.69 inches each, safely under the 4-inch limit. Center-to-center spacing is 3.69 plus 1.5, or about 5.19 inches. Mark every 5.19 inches along the rail and the gaps come out even. Try 18 balusters instead and the gaps grow to about 3.95 inches, still legal but uncomfortably close to the limit, which is why the tool nudges you toward the count that keeps a safety margin.

Common mistakes and practical tips

Frequently asked questions

What is the 4-inch rule?

Building codes require that a 4-inch sphere cannot pass through any gap in a railing, to prevent small children from slipping through. Inspectors test it with an actual 4-inch ball.

Why center-to-center spacing?

Because marking the center of each baluster along the rail keeps every gap equal without the measurement error that accumulates when you measure gap to gap.

Does the rule change for stairs?

Often yes. Stair balusters are measured along the slope, and some codes apply the 4-inch rule to the gap along the rail, which effectively tightens the spacing. Check your local code.

How many balusters do I need?

The tool calculates the count that keeps every gap at or below your maximum. Add one or two spares for cuts and mistakes.

Inputs

Outputs

Why it’s useful

Building a deck railing that is both even and code-compliant is harder than it looks — equal gaps require precise division, and exceeding the 4-inch rule can fail an inspection or create a safety hazard. This calculator takes the guesswork out of the layout, helping deck builders, homeowners, and inspectors get the spacing right the first time. It is equally useful for level runs and stairs, and it saves the wasted time of re-spacing pickets after a layout goes wrong. It is a practical safety-and-aesthetics tool for anyone building or repairing a railing, and the center-to-center output makes it easy to mark consistent positions along the entire run without accumulating measurement errors.

Fun facts