Skip to the calculator
CalcBuilt

Baluster Spacing Calculator

Calculate how many balusters fit between two railing posts and the exact gap and on-center spacing that keeps every opening under the 4 in code limit.

By CalcBuilt Editorial TeamUpdated September 10, 2026Formulas checked against manufacturer specs, see how we calculate.

Quick answer: To space balusters, subtract one maximum gap from the opening, divide by the baluster width plus the gap and round up for the count, then split the leftover space evenly among the gaps. A 72 in opening with 1.5 in balusters and a 4 in maximum gap takes 13 balusters with a 3.75 in gap, 5.25 in on center.
Your measurements
rails per sectionPost spacingHeight
Fence elevation: posts at a set spacing, rails between them, pickets covering the run.
Results update as you type. The link in your address bar saves these entries.

Results

Balusters
13 balusters
1.5 in wide, laid out so no gap exceeds 4 in
Actual gap
3.75 in
14 equal gaps including one at each post. Planning estimate; local code and the inspector govern.
On-center spacing
5.25 in
Baluster width plus one gap; mark the rail at this interval
First baluster center
4.5 in
From the post face: one full 3.75 in gap plus half the baluster width, then every 5.25 in

Baluster Spacing formula

Balusters = (Opening - max gap) / (baluster width + max gap), rounded up
Actual gap = (Opening - Balusters x baluster width) / (Balusters + 1)
On-center spacing = baluster width + actual gap
First baluster center = actual gap + baluster width / 2  (half gap option: actual gap / 2 + baluster width / 2)

Worked example

A deck rail section with a 54 in opening between posts, 1.25 in square metal balusters and the 4 in maximum gap: 54 - 4 = 50, and 50 / (1.25 + 4) = 9.52, so 10 balusters. Actual gap = (54 - 10 x 1.25) / 11 = 41.5 / 11 = 3.77 in, and the on-center spacing is 1.25 + 3.77 = 5.02 in.

Mark the first baluster center 3.77 + 0.625 = 4.40 in from the post face, then every 5.02 in after that. The last gap lands at 3.77 in against the far post.

Quick reference

Balusters by opening width (1.5 in balusters, 4 in maximum gap, full gap at each post)
OpeningBalustersActual gapOn center
36 in63.86 in5.36 in
48 in84.00 in5.50 in
60 in113.63 in5.13 in
72 in133.75 in5.25 in
96 in173.92 in5.42 in

How to space balusters evenly

Measure the clear opening between the posts, not the post centers. Subtract one maximum gap, divide by the baluster width plus that gap, and round up. That is the fewest balusters that keep every opening under the limit. Then divide the space left over (opening minus all the baluster widths) by the number of gaps, which is one more than the balusters. Every gap comes out the same and a little under the maximum.

Lay out from one post: the first baluster center sits one gap plus half a baluster from the post face, and every center after it is one baluster width plus one gap further along. Mark the top and bottom rails together with a story pole so the balusters stay plumb.

Layout choices and code

The full-gap layout puts the same gap at the posts as between balusters and is the look for a single section. The half-gap option belongs to prebuilt panels and to a pattern that repeats across several openings. The inspector pushes a 4 inch sphere at every opening and does not care whether the gaps match.

R312.1.3 applies the sphere to every opening, including under the bottom rail, so a bottom rail more than 4 inches off the deck fails. Stair guards get 4-3/8 inches between balusters and 6 inches at the tread, riser and bottom rail triangle. A guard is required where the drop exceeds 30 inches (R312.1.1) and stands 36 inches above the finished decking (R312.1.2). It must take a 200 lb push at the top (Table R301.5). A notched 4x4 post fails that test; DCA 6 through-bolts an unnotched post with a DTT tie.

What this calculator leaves out

This counts balusters for one opening. Run each section separately; a 1/2 inch difference changes the count. Not included: posts, top and bottom rails, the 2x6 cap, post hardware, and the connectors metal balusters need, two per baluster. A bottom rail over 6 feet gets a foot block at mid-span, or it sags.

Stairs need a separate graspable handrail 34 to 38 inches above the nosings, 1-1/4 to 2 inches round or a Type II profile (R311.7.8).

Code limits that apply

  • IRC R312.1.3checked

    No opening passes a 4 in sphere; 4-3/8 in on a stair's open side, 6 in at the tread triangle

    If you miss it: 2x2 cedar laid out at a full 4 in dries to a 4-1/8 in gap; the inspector pushes a sphere and every baluster gets respaced

  • IRC R312.1.1

    Guard on any open side more than 30 in above the floor or grade measured 36 in out

    If you miss it: A low deck measured at the house is over 30 in at the far corner on sloping grade; a guard gets added after the fact

  • IRC R312.1.2

    Guard 36 in min above the finished deck or floor, 34 in min on a stair above the nosings

    If you miss it: Posts cut 36 in above the joists finish an inch short once the decking goes on; every post is replaced or capped

  • IRC Table R301.5

    Guard top rail takes a 200 lb concentrated load in any direction at any point

    If you miss it: A notched 4x4 post snaps at the notch under a 200 lb push; DCA 6 wants an unnotched post, two 1/2 in bolts and a DTT tie

  • IRC R311.7.8

    Handrail on 4 or more risers, 34 to 38 in above the nosings, 1-1/4 to 2 in round or Type II

    If you miss it: A 2x6 cap on the stair guard is not a handrail; a separate graspable rail goes on after the guard is built

  • IBC 1015.3

    Guards 42 in min in commercial and multifamily buildings; the 4 in sphere rule still applies

    If you miss it: A 36 in residential-style rail on a restaurant patio or apartment balcony is 6 in short and gets rebuilt

Rows marked checked produce a warning in the results when an entry crosses the limit. The others are on the plans or on site and this calculator does not test them. Local amendments can be stricter; the adopted edition and the inspector govern.

Mistakes that cost money

  • Laying out at a full 4 in gap fails once 2x2 cedar shrinks; inspectors push a sphere, so lay out at 3-1/2 to 3-3/4 in.
  • Measuring post center to center instead of face to face throws every gap off; a 4x4 post is 3-1/2 in wide, a 6x6 is 5-1/2.
  • Stair guards allow 4-3/8 in between balusters and 6 in at the tread, riser and bottom rail triangle (R312.1.3), not the flat 4 in.
  • Guard height is 36 in above the finished decking (R312.1.2); posts cut 36 in above the joists end up 1 in short.
  • A notched 4x4 guard post fails the 200 lb load test; DCA 6 wants an unnotched post, two 1/2 in bolts and a DTT tie.
  • A 2x6 cap is not a stair handrail; stairs need a graspable 1-1/4 to 2 in rail at 34 to 38 in (R311.7.8).

Key facts

  • The IRC requires that no opening in a guard allow a 4 in sphere to pass; the IBC uses the same limit for most occupancies.
  • Residential guards must be at least 36 in tall wherever the drop to the surface below is more than 30 in; commercial guards are 42 in.
  • A 2x2 wood baluster is 1.5 in square, so at the 4 in maximum gap balusters land no more than 5.5 in on center.
  • The triangle formed by a stair tread, riser and bottom rail may not pass a 6 in sphere.
  • Wood shrinks as it dries, so a layout that starts at exactly 4 in can fail inspection later; aim for 3.5 to 3.75 in.

Frequently asked questions

How many balusters do I need for a 6 ft railing section?

With 1.5 in balusters and a 4 in maximum gap, a 72 in opening between posts needs 13 balusters at 5.25 in on center with a 3.75 in gap.

What is the maximum space between balusters?

Under the IRC, no opening in a guard may let a 4 in sphere pass. Most builders lay out at 3.5 to 3.75 in so the balusters still pass once the wood dries and shrinks.

How tall does a deck railing have to be?

36 inches from the finished deck surface to the top of the guard (IRC R312.1.2), required wherever the drop is more than 30 inches (R312.1.1). Commercial and multifamily guards are 42 inches (IBC 1015.3). Stairs also need a graspable handrail 34 to 38 inches above the tread nosings, and the guard posts must hold a 200 lb push, which a notched 4x4 will not.

Do the gaps next to the posts have to match the others?

No. Code only requires that every gap stays under 4 in. Equal gaps look best on a single section; a half gap at the posts suits a pattern that repeats across many sections.

Sources and references

Next steps for this project

  1. Post Holes
  2. Floor Joists
  3. Deck
  4. Stairs
  5. Baluster Spacing
  6. Fence
  7. Board feet

The usual order for a framing, decks & fences project. See all framing, decks & fences calculators.

Embed this calculator

Results are estimates based on standard formulas and typical product specifications. Confirm quantities with your supplier and local code before ordering.