Baluster and Spindle Spacing Calculator
Plan railing layouts with code-compliant gaps. This calculator takes railing length, baluster width, max gap allowance, and layout style to deliver the exact number of balusters, on-center spacing, center marks, and edge measurements for each spindle.
Inputs
Advanced
Total balusters: 0
| Section | Length | Mode | Balusters | Gap |
|---|
Results
Advertisement
Running Mark-Out Table
| Baluster # | Near edge | Center mark | Far edge |
|---|---|---|---|
| Calculate a layout to see mark-out measurements. | |||
Explanation
Release Updates
v1.1 (June 6, 2026)
- Added layout modes for equal end gaps, fixed post buffers, and centered max internal gaps.
- Added a running mark-out table with near edge, center mark, and far edge measurements for each baluster.
- Added stair railing spacing, multi-section totals, CSV export, print layout, and code guidance for 4-inch / 100 mm checks.
Baluster spacing is a safety and code compliance problem as much as it is a layout problem. Most residential codes require that a 4 inch sphere cannot pass through a guardrail opening. That means the clear gap between balusters must be less than or equal to the code limit, and the spacing should be uniform so the railing looks professional. This calculator focuses on precision building by solving for the smallest whole number of balusters that keeps every gap at or below the maximum allowable gap.
The default equal-end layout treats the entered railing length as the clear length between the inside faces of the posts, then creates matching end gaps and internal gaps. Fixed-buffer mode keeps your entered offsets from each post and solves only the internal gaps between balusters. Centered max-gap mode uses the maximum internal gap where possible, then centers the baluster run by splitting the remaining space at the ends.
The calculator then outputs the number of balusters, the exact gap, the on-center spacing, and a running mark-out table. The table gives the near edge, center mark, and far edge for every baluster so you can mark the rail directly instead of doing repeated field arithmetic. For material estimation, section totals provide a quick combined baluster count across several deck panels.
If your rail has a cap, shoe rail, or decorative trim, measure from the inside faces of the end posts at the exact elevation where the balusters are installed. Stair mode uses riser rise and tread run to calculate the stair angle, then converts horizontal on-center spacing into sloped spacing along the rail. Always confirm local requirements for stair openings, guard height, and handrail clearances, since those values can change the allowable gap or baluster placement.
Formula
Equal end gaps: N = ceil((L - Gmax) / (B + Gmax)), then
gap = (L - N x B) / (N + 1).
Fixed buffers: clear = railing - startBuffer - endBuffer, then
gap = (clear - N x B) / (N - 1).
Center marks use nearEdge + B / 2. Stair mode uses
angle = atan(rise / run) and slopedSpacing = horizontalSpacing / cos(angle).
Baluster Spacing Code: 4-Inch and 100 mm Sphere Rules
In many U.S. residential guardrail applications, openings are commonly checked with a 4-inch sphere rule. In the UK, Approved Document K uses a 100 mm sphere rule for guarding in buildings that may be used by children under five. Always verify the code adopted by your local jurisdiction before building.
| Region / reference | Common opening check | Use in calculator |
|---|---|---|
| U.S. IRC-style guardrail check | 4 in / 102 mm | Set max gap to 4 in |
| UK Approved Document K-style check | 100 mm | Set max gap to 100 mm |
| Custom local requirement | User entered | Set max gap manually |
Example Calculation
A 96 inch clear railing length with 1.5 inch balusters and a 4 inch maximum gap returns 17 balusters in equal-end mode. The exact gap is 3.92 inches, on-center spacing is 5.42 inches, and the first center mark is 4.67 inches from the inside face of the post. Fixed-buffer mode with 1.5 inch buffers on both ends returns 18 balusters with 3.88 inch internal gaps.
FAQs
Why does the calculator sometimes return a gap smaller than the max?
Because it finds the smallest whole number of balusters that keeps all gaps below the limit, which produces a slightly smaller gap.
What if my posts are not symmetrical?
Enter different start and end buffers to reflect the real field conditions.
Does on-center spacing include the post buffer?
No. Post buffers are separate end offsets. On-center spacing is measured only from one baluster center to the next.
Can I use this for metal or glass rail systems?
The math applies to any evenly spaced vertical elements, but verify manufacturer requirements.
Is the 4 inch rule universal?
It is common in many regions, but always verify your local building code.
How it works
This calculator finds the minimum baluster count that satisfies the selected gap rule, builds a running mark-out table, and optionally converts horizontal spacing to sloped stair spacing. All calculations run client-side.
Common Baluster Spacing Mistakes
Using nominal lumber size instead of actual width
A 2x2 baluster is often not exactly 2 inches wide. Measure the actual installed width before calculating.
Ignoring tapered or turned spindles
Use the narrowest part of the spindle when checking the largest possible opening.
Forgetting end gaps
Some layouts need equal end gaps between the first/last baluster and the posts, while others need fixed post buffers.
Measuring the wrong rail line on stairs
For sloped rails, measure along the rail or calculate the horizontal spacing and convert it to sloped spacing.
Disclaimer
Results are for planning. Always verify local building codes and safety requirements for guardrails and stair railings.
