How the Baluster Spacing & Guard Height Calculator works
Enter the clear distance between two posts of a level railing and the width of one baluster. Get how many you need, the exact gap including the one at each post, and where to mark every baluster, before you cut or screw anything.
How this is calculated
On a level run the balusters and the gaps between them have to fill the distance between the two posts exactly. With n balusters there are n + 1 gaps, because there is a gap at each post as well as between the balusters. This tool makes all of them equal.
gap with n balusters = (clear distance between posts − n × baluster width) ÷ (n + 1)
fewest on paper = the smallest n whose gap is LESS than 4 in
number this tool uses = the smallest n whose gap is 1/16 in or more under 4 in
(one more than the fewest on paper when that gap is within 1/16 in of the limit)
centre to centre = gap + baluster width
near edge of baluster k, from the post = k × gap + (k − 1) × baluster width
centre of baluster k, from the post = near edge + baluster width ÷ 2For 72 in between posts and balusters 1 1/2 in wide: 12 balusters would leave (72 − 12 × 1.5) ÷ 13 = 4.1538 in, which is too wide. 13 leave (72 − 13 × 1.5) ÷ 14 = 3.75 in, and the balusters sit 5.25 in centre to centre.
Exactly at the limit is a fail
The code does not give a maximum gap. It says the guard must not have openings that allow a sphere of a stated diameter to pass. A 4 in ball just goes through a 4 in gap, so this tool takes the stricter reading: a gap equal to the sphere fails, and the code check passes only when every gap is less than the sphere. With 48 in between posts, 8 balusters leave gaps of exactly 4 in, so the tool uses 9, which leave 3.45 in. One of the calculators listed under Sources accepts a gap equal to its maximum; this tool does not.
Why the tool sometimes uses one more than the fewest
The exact gap is rarely a sixteenth, and a tape is read to the nearest 1/16 in. Each mark can therefore be 1/32 in out, and the gap between two marks can come out up to 1/16 in wider than the figure on paper. So the tool will not call a layout good unless the exact gap is at least 1/16 in under the sphere, and it also works out the gaps you would get from the rounded marks, by either column of the table, and holds those under the sphere. Where the fewest balusters on paper would leave less than 1/16 in to spare, it uses one more. That is the case for about one section in four. With 47 3/4 in between posts, 8 balusters give 3.9722 in on paper, but the nearest tape mark puts a gap at 4 in, so the tool starts from 9.
This margin is a choice made in this tool, not a code rule. If you set the count yourself and the gap is under the sphere by less than 1/16 in, the result is shown as a warning, not as a code failure, and both figures are on screen.
Marks, not a stepped-off gap
The mark-out table gives the distance of every baluster from the inside face of one post. Each figure is worked out from the post with the exact gap and then rounded once to the nearest 1/16 in, so an error in one mark is not carried into the next. Stepping a rounded gap along the rail does the opposite: all the rounding ends up in the last gap. With 68 1/2 in between posts and 12 balusters the exact gap is 3.8846 in; a spacer block cut to 3 7/8 in and stepped off from one post leaves the last gap at 4 in.
Stairs are not laid out
The layout is for level runs only. On the open side of a stair the balusters stand plumb between rails that slope, and the gap between two of them depends on the exact slope of the stair, so a small error in measuring the slope changes the gap. This tool does not lay those out. The code tests the openings of a guard on the open side of a stair with a 4 3/8 in sphere (R312.1.3 Exception 2), and the triangle formed by the riser, the tread and the bottom rail with a 6 in sphere (Exception 1). A landing is a level run. The guard height check does cover a stair guard: there the height is measured plumb from the line through the tread nosings, not from a tread.
The code limits
The figures are those of Section R312.1 of the 2021 IRC, in this tool's words. They apply to guards the code requires.
| Rule | Limit | Section | In this tool |
|---|---|---|---|
| Guard required | where the walking surface is more than 30 in above the floor or ground below, at any point within 36 in out from the open edge | R312.1.1 | Checked from the drop you enter |
| Guard height | 36 in at least, above the walking surface | R312.1.2 | Checked |
| Guard height on the open side of a stair | 34 in at least, above the line of the nosings | R312.1.2 Exception 1 | Checked when you choose a stair guard |
| Stair guard whose top serves as the handrail | 34 in to 38 in above the line of the nosings | R312.1.2 Exception 2 | Checked for a stair guard once you answer the question |
| Openings in a guard, from the walking surface to the required guard height | must not let a 4 in sphere through | R312.1.3 | Checked for the gaps between balusters and at the posts of a level run. Not checked under the bottom rail |
| Openings in a guard on the open side of a stair | must not let a 4 3/8 in sphere through | R312.1.3 Exception 2 | Not laid out and not checked |
| Triangle formed by the riser, the tread and the bottom rail on a stair | must not let a 6 in sphere through | R312.1.3 Exception 1 | Not checked |
A drop of exactly 30 in does not require a guard, because the wording is "more than". A guard of exactly 36 in passes, because the wording is "not less than". The drop is the largest one found within 36 in out from the open edge, so ground that slopes away from a deck can require a guard on a deck that is low at the edge itself.
Editions
The 2018 and 2024 texts were read beside the 2021 text. In these three subsections the 2018 edition gives the same figures; the 2021 edition adds floors to the walking surfaces it names. The 2024 edition moves the section from R312 to R321 and reads the same. States and cities amend this section, some to a taller guard or a smaller opening: the edition and amendments your jurisdiction has adopted are what govern.
What this tool does not check
- Strength. Table R301.5 asks a guard to take a 200 lb load at any point along its top, and infill such as balusters to take 50 lb spread over one square foot. How the posts, rails and balusters are fixed decides that.
- The opening under the bottom rail. The opening limit runs from the walking surface up, so the space between the deck and the bottom rail is under the same sphere test.
- Balusters on the open side of a stair, and guards on ramps, which R312.1.1 also names.
- Openings that are not between plumb balusters: horizontal rails, cable, glass or mesh infill, and decorative panels.
- Post spacing and size, handrail shape and grip, and guards in buildings covered by the International Building Code.
- What the guard is made of. Insect screening does not count as a guard (R312.1.1), and exterior plastic composite guards have their own section (R312.1.4).
- Baluster width that varies. Enter the thinnest width, measured, because a thinner baluster leaves a wider gap.
What this calculator is tested against
This tool cannot be published unless it reproduces every example below. 3 are copied from a published source. 15 were worked by hand from the cited rule.
| Example | Expected | Basis |
|---|---|---|
| 72 in between posts, 1 1/2 in balusters | 13 balusters, 14 gaps of 3.75 in, under 4 in | Published WoodCalc, Deck Baluster Spacing: worked example |
| 96 in clear length, 1 1/2 in balusters, 4 in maximum | 17 balusters, gap 3.92 in, 5.42 in centre to centre (the source prints two decimals) | Published Starlight Tools, Baluster and Spindle Spacing Calculator: example calculation |
| 68 1/2 in between posts, 13 balusters of 1 1/2 in | 49 in of open space in 14 gaps of 3.5 in | Published Hunker, How To Calculate Deck Baluster Spacing |
| 48 in between posts: 8 balusters would leave gaps of exactly 4 in | (48 − 8 × 1.5) ÷ 9 = 4 exactly, so one more: 9 balusters, gaps of 3.45 in | By hand 2021 IRC R312.1.3 (a gap equal to the sphere is read as a fail) |
| The same 48 in forced to 8 balusters | gaps of exactly 4 in: fails, 9 needed | By hand 2021 IRC R312.1.3 |
| 96 in between posts forced to 16 balusters | (96 − 24) ÷ 17 = 4.2353 in: over 4 in, fails, 17 needed | By hand 2021 IRC R312.1.3 |
| 47 3/4 in between posts: 8 balusters are under 4 in only on paper | 8 balusters give 3.9722 in, but marked with a tape the first gap lands on 4 in; this tool uses 9, gaps of 3.425 in | By hand Arithmetic: (47.75 − 12) ÷ 9 = 3.9722 in, less than 1/16 in under 4 in, and the nearest 1/16 in mark to 3.9722 is 4 |
| The same 47 3/4 in forced to 8 balusters | under 4 in on paper, so not a code fail, but too close to mark out: reported as a warning, 9 advised | By hand This tool’s marking margin of 1/16 in (not a code rule) |
| 47 7/16 in between posts: 8 balusters leave exactly 1/16 in to spare | (47.4375 − 12) ÷ 9 = 3.9375 in, exactly 1/16 in under 4 in and on the tape: 8 balusters, passes | By hand Arithmetic: (47.4375 − 12) ÷ 9 = 3.9375 in; this tool’s marking margin of 1/16 in |
| Posts exactly 4 in apart | an open 4 in gap is at the limit, so 1 baluster: two gaps of 1.25 in | By hand 2021 IRC R312.1.3 (a gap equal to the sphere is read as a fail) |
| Posts 1 1/4 in apart, narrower than one 1 1/2 in baluster | no baluster fits and none is needed: the opening is 1.25 in | By hand 2021 IRC R312.1.3 |
| Posts 5 in apart with a 6 in wide baluster | the opening is over 4 in and the baluster does not fit in it: no layout, fails | By hand 2021 IRC R312.1.3 |
| Deck exactly 30 in above the ground | not more than 30 in: no guard required by this section | By hand 2021 IRC R312.1.1 (guard required where the drop is more than 30 in) |
| Deck 30 1/16 in above the ground with a 36 in guard | guard required; 36 in is exactly the minimum, passes | By hand 2021 IRC R312.1.1 and R312.1.2 |
| Deck 8 ft above the ground with a 35 15/16 in guard | 1/16 in under the 36 in minimum, fails | By hand 2021 IRC R312.1.2 |
| Open side of a stair, 5 ft drop, guard 34 in above the nosing line | 34 in is the minimum on the open side of a stair, passes | By hand 2021 IRC R312.1.2 Exception 1 |
| Stair guard 39 in high whose top is the handrail | 1 in over the 38 in maximum for a guard top that serves as the handrail, fails | By hand 2021 IRC R312.1.2 Exception 2 |
| Stair guard 39 in high, not said whether its top is the handrail | not a pass until that is answered: over 38 in fails if the top is the handrail | By hand 2021 IRC R312.1.2 Exceptions 1 and 2 |
Sources
- 2021 International Residential Code, Section R312.1, GuardsRead as published on UpCodes (Texas adoption of the 2021 IRC). Where a guard is required (R312.1.1), its height (R312.1.2 and both exceptions) and the 4 in opening limit (R312.1.3) in this tool come from this text. The two stair exceptions to R312.1.3 are named from it and not applied.
- 2018 International Residential Code, Section R312.1, GuardsRead for comparison (Texas adoption). R312.1.1 to R312.1.3 give the same figures; the 2021 text adds floors to the walking surfaces named in R312.1.1.
- 2024 International Residential Code, Section R321.1, GuardsRead for comparison (Oklahoma adoption). The section moves from R312 to R321; R321.1.1 to R321.1.3 read the same as the 2021 text.
- 2021 International Residential Code, Table R301.5, minimum live loadsThe loads a guard and its infill have to take: 200 lb at any point along the top of a guard, 50 lb over one square foot on infill such as balusters. Named in this tool as something it does not check.
- WoodCalc: Deck Baluster Spacing, Code Requirements and How-ToWorked example used as a tested case: 72 in between posts with 1 1/2 in balusters gives 13 balusters and 14 gaps of 3.75 in. It also reads a gap of exactly 4 in as failing the sphere test, and takes a 2x2 baluster to be 1 1/2 in wide.
- Starlight Tools: Baluster and Spindle Spacing CalculatorExample calculation used as a tested case: 96 in clear with 1 1/2 in balusters and a 4 in maximum gives 17 balusters, a 3.92 in gap and 5.42 in centre to centre. Its stated rule accepts a gap equal to the maximum, which differs from this tool.
- Hunker: How To Calculate Deck Baluster SpacingWorked example used as a tested case: 13 balusters of 1 1/2 in in 68 1/2 in between posts leave 49 in of open space in 14 gaps of 3.5 in.