Baluster Spacing Calculator

How many balusters fit between two posts with equal gaps under the 4 inch sphere rule, the exact on-centre spacing and layout marks for deck and stair rails.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Baluster Spacing Calculator?

Railings look right when every gap between balusters is the same, and they pass inspection when no gap is wide enough for a 4 inch sphere. Getting both means solving for the number of balusters first and then spreading the leftover space evenly, rather than starting at one post at 4 in and ending with an odd gap at the other.

Enter the clear distance between posts, the baluster width and the maximum gap your code allows. The calculator returns the number of balusters, the actual gap, the on-centre spacing, the position of the first baluster from the post and a full list of layout marks. Choose 4 in for IRC guards, 4-3/8 in for the open side of IRC stairs, 100 mm or 125 mm for other codes, or type your own.

Stair mode takes the rake angle from the riser and tread or in degrees and converts the level spacing into distances along the sloped rail, which is where you mark them.

  • Baluster count, equal gap, on-centre spacing and first position
  • IRC 4 in and 4-3/8 in, 100 mm and 125 mm presets or a custom limit
  • Stair mode from rise and run or degrees, with marks along the rail
  • Layout table of every centre and an elevation sketch
  • Multiple identical sections; imperial fractions or millimetres
Read the guide: Baluster Spacing and the 4 Inch Sphere Rule, With the Math

How to use the Baluster Spacing Calculator

  1. Choose imperial or metric and level rail or stair rail.
  2. Enter the clear length between the inside faces of the posts and the baluster width.
  3. Pick the maximum gap for your code or enter a custom figure a little under the limit.
  4. For a stair, enter the riser height and tread run or the rake angle directly.
  5. Read the count, gap and on-centre spacing, then mark the centres from the left post using the layout table.

Worked examples

8 ft deck section with 2x2 balusters

Input

96 in between posts, 1-1/2 in balusters, 4 in limit

Output

17 balusters, 3-15/16 in gap, 5-7/16 in on centre, first centre 4-11/16 in from the post

The exact gap is 3.917 in and the exact spacing 5.417 in. Marking from one post keeps the last gap equal to the first.

Turned balusters with a safety margin

Input

72 in between posts, 2-1/2 in balusters, 3-7/8 in limit

Output

11 balusters, 3.71 in gap, 6.21 in on centre

Using a limit a little under 4 in leaves room for balusters that are not perfectly straight.

Stair rail at 7-3/4 over 10

Input

120 in along the rail, 1-1/2 in balusters, rake from 7-3/4 in rise and 10 in run (37.8°), 4 in limit

Output

17 balusters, 3.85 in level gap, 6.77 in on centre along the rail

The rail covers only 94.85 in of level run, so the spacing along the rail is the level spacing divided by cos 37.8°.

Background and insight

With n balusters of width b in a clear length L there are n + 1 gaps, so gap = (L - n b) / (n + 1). Requiring gap to be no more than the limit g gives n = ceil((L - g) / (b + g)). For 96 in between posts, 1-1/2 in balusters and a 4 in limit that is 17 balusters with 3.92 in gaps at 5.42 in on centre. Marking every centre from one post, rather than stepping off the spacing, stops rounding from adding up.

The IRC (Section R312.1.3) says required guards must not have openings that allow a 4 in sphere to pass, with two exceptions: 4-3/8 in on the open side of stairs and 6 in for the triangle formed by the riser, tread and bottom rail. England uses 100 mm (Approved Document K), as does the National Building Code of Canada, and Australia's NCC uses 125 mm. On a stair the balusters are vertical, so the clear gap is measured level: the calculator works in the level run (rail length x cos of the rake) and divides back by the cosine for marks along the rail.

Common use cases

  • Deck and porch railings

    Lay out balusters between posts with equal gaps that meet the 4 in rule.

  • Stair balustrades

    Convert level spacing into marks along a raked handrail or stringer.

  • Ordering balusters

    Count balusters for several identical sections in one go.

  • Metal and cable infill checks

    Check gaps for metal pickets or glass panels against a 100 mm or 125 mm limit.

Tips and limitations

  • Measure between the posts at the rail height; posts are not always plumb.
  • Set the limit slightly under the code value, say 3-7/8 in, so a bowed baluster does not fail the sphere test.
  • Start the layout at a centre mark rather than an edge if you want a baluster centred on a feature.
  • Stair guards also need the 6 in triangle rule at the bottom rail and a handrail at the code height.
  • Guard height (36 in in most US residential codes, 42 in in many commercial and some local codes) is separate from spacing.

Frequently asked questions

How do you calculate baluster spacing?

Work out how many balusters you need with n = (L - g) / (b + g), rounded up, where L is the space between posts, b the baluster width and g the maximum gap. Then the gap is (L - n b) / (n + 1) and the on-centre spacing is b + gap.

What is the 4 inch rule for balusters?

The IRC requires that a 4 in sphere cannot pass through any opening in a required guard. In practice it means every clear gap must be less than 4 in. The open sides of stairs may allow 4-3/8 in.

How many balusters do I need for 8 feet?

With 1-1/2 in balusters and a 4 in limit, 17 balusters fit in 96 in with gaps of 3.92 in. With 1-1/4 in balusters you need 18. The exact number depends on the clear distance between the posts.

How do you space balusters on stairs?

Use the level distance. The 4 in or 4-3/8 in limit applies square to the vertical balusters, so multiply the rail length by the cosine of the stair angle, solve for the spacing, then divide the spacing by the cosine to mark it along the rail.

What is the maximum baluster gap in the UK?

100 mm for dwellings under Approved Document K, so a 100 mm sphere must not pass through. Canada uses 100 mm as well and Australia 125 mm under the NCC.

Where should the first baluster go?

One full gap from the post: the first baluster edge sits at the calculated gap from the post face, and its centre is gap plus half the baluster width. With equal gaps the layout is symmetric, so the last baluster sits the same distance from the far post.

Is there an in-depth guide to the Baluster Spacing Calculator?

Yes. “Baluster Spacing and the 4 Inch Sphere Rule, With the Math” covers the background, how it works, common pitfalls and worked examples. Read the full guide.