Baluster Calculator
Enter your railing length, post dimensions, and desired baluster width to instantly find out how many balusters you need and whether your spacing meets the 4-inch code limit. Switch between imperial and metric, enable stair railing mode, and add an optional unit cost to get a full material estimate.
How to calculate the number of balusters
The core formula is straightforward: subtract the total post width from the railing length to get the net span, then divide by the sum of one baluster width and the desired gap. Round down to a whole number, and recalculate the actual gap so all balusters fit evenly. For example, a 12-foot railing with three 3.5-inch posts leaves a net span of 12 ft - (3 x 3.5 in) = 12 ft - 10.5 in = 133.5 inches. With 1.5-inch balusters and a 3.5-inch gap, you divide 133.5 by (1.5 + 3.5) = 5.0, giving 26.7, which rounds down to 26 balusters. The actual gap then becomes (133.5 - 26 x 1.5) / 27 = 3.56 inches, which is within the 4-inch code limit.
Stair railing balusters - why the angle matters
On a staircase the railing follows a slope, but the 4-inch sphere rule is measured horizontally, not along the slope. A baluster with a 3.5-inch gap at 35 degrees actually presents a larger horizontal opening. To be safe, this calculator converts the stair length to its horizontal projection (length x cosine of the angle) before counting balusters. That means you may need slightly more balusters on a staircase than a level run of the same slope length. Always double-check stair railing installations to ensure the horizontal gap at any point is under 4 inches.
On-center spacing vs. gap spacing
Two measurement conventions are used by contractors. Gap spacing is the clear opening between adjacent balusters, which is what the building code cares about. On-center (OC) spacing is measured from the center of one baluster to the center of the next, equal to the baluster width plus the gap. If your balusters are 1.5 inches wide and the gap is 3.56 inches, the on-center spacing is 5.06 inches. Most railing manufacturers publish on-center spacing for their products, so both numbers are shown in the results.
Buying materials - how much to order
Once you know the count, add 10-15% for waste from cuts, defects, or measurement mistakes. For a 26-baluster project, order 29-30 balusters. If you are running multiple railing sections with different lengths, calculate each section separately using the per-section fields and sum the totals. Standard dimensional lumber (2x2) measures 1.5 inches actual, while metal tube balusters are typically 0.75-1 inch wide and sold in standard lengths of 32, 36, or 44 inches for deck heights.
Baluster spacing building code requirements
| Code / Standard | Max gap | Min railing height | Notes |
|---|---|---|---|
| IRC (residential) | 4 in (10.16 cm) | 36 in (91 cm) | Decks 30+ in above grade need railing |
| IBC (commercial) | 4 in (10.16 cm) | 42 in (107 cm) | Higher traffic areas require taller rails |
| Canada NBC | 100 mm (3.94 in) | 900 mm (35.4 in) | Similar 4-inch sphere rule |
| UK Building Regs | 100 mm (3.94 in) | 900 mm (35.4 in) | No gap allowing a 100 mm sphere to pass |
| Stair balusters (IRC) | 4 in (10.16 cm) | 34-38 in along slope | Measured perpendicular to slope |
International Residential Code (IRC) and International Building Code (IBC) requirements for baluster spacing in the United States. Always verify with your local jurisdiction.
Frequently asked questions
How far apart should balusters be?
Building code in the United States (IRC and IBC) requires that no gap between balusters be wide enough to pass a 4-inch sphere. In practice this means the clear space between any two adjacent balusters must be no more than 4 inches. Many installers target 3.5 inches to leave a margin of safety. Local codes may be stricter, so always check with your building department before installation.
How do I calculate the number of balusters I need?
Subtract the total width of all posts from the railing length to get the net span. Divide the net span by (baluster width + desired gap) and round down to a whole number. Then recalculate the actual gap as (net span - number of balusters x baluster width) / (number of balusters + 1). This calculator does all of that automatically and also checks whether your spacing meets the 4-inch code limit.
What is on-center baluster spacing?
On-center (OC) spacing is the distance measured from the center of one baluster to the center of the next. It equals the baluster width plus the gap between balusters. If your balusters are 1.5 inches wide and the gap is 3.5 inches, on-center spacing is 5 inches. Manufacturers and contractors often use OC spacing to lay out balusters quickly with a tape measure.
Do stair balusters use the same spacing rules?
Yes, the 4-inch sphere rule applies to stair railings too, but the measurement is taken horizontally, not along the slope. Because the railing follows the stair angle, a gap that looks correct along the slope may be larger when measured horizontally. This calculator adjusts for the stair angle automatically. Stair railing height is also measured differently: the IRC requires 34 to 38 inches measured perpendicular to the stair nosing.
How high should a deck railing be?
The IRC requires deck railings to be at least 36 inches high for decks that are 30 inches or more above grade. Commercial buildings governed by the IBC must have railings at least 42 inches high. Some local jurisdictions adopt higher requirements, and many homeowners choose 42 inches even for residential decks for extra safety and aesthetics.
How many balusters do I need per linear foot?
A quick rule of thumb is roughly 3 balusters per linear foot of railing when using standard 1.5-inch wide balusters with a 3.5-inch gap. The exact count depends on your baluster width, gap, and post placement. Use this calculator for the precise number - the quick estimate can be off by 2 or 3 balusters on longer runs.