ThisCalculator

Everyday

Balustrade Spacing Calculator: Code & Formula

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Balustrade Spacing Calculator: Code & Formula

This balustrade spacing calculator works out the maximum number of balusters (spindles) you need and the exact gap between them, based on your total railing length, baluster width, and the maximum allowed opening. You enter those three numbers and it returns the number of balusters required and the precise spacing, so you can lay out your railing to meet building code without guesswork.

Formula

The core formula for baluster spacing is:

Number of balusters = ceil( (Total length + Baluster width) / (Baluster width + Max gap) )

Actual gap = (Total length – (Number of balusters × Baluster width)) / (Number of balusters + 1)

Where:

  • Total length – the horizontal distance between the two posts (or between a post and a wall) that the balusters will fill, in inches or millimetres.
  • Baluster width – the thickness of one baluster, measured in the same unit as the total length.
  • Max gap – the largest open space allowed by your local building code, typically 4 inches (100 mm) in many jurisdictions.
  • Number of balusters – always rounded up to the next whole number, because you cannot install a fraction of a baluster.
  • Actual gap – the resulting space between each baluster, which will be equal to or slightly less than the maximum allowed.

Worked Example

Using the default values from the calculator above – a 120-inch railing, 1.5-inch balusters, and a 4-inch maximum gap:

  1. Add the baluster width to the total length: 120 + 1.5 = 121.5
  2. Add the baluster width to the max gap: 1.5 + 4 = 5.5
  3. Divide: 121.5 ÷ 5.5 = 22.09
  4. Round up to the next whole number: 23 balusters
  5. Calculate the actual gap: (120 – (23 × 1.5)) ÷ (23 + 1) = (120 – 34.5) ÷ 24 = 85.5 ÷ 24 = 3.5625 inches

So for a 10-foot railing with 1.5-inch balusters and a 4-inch code limit, you need 23 balusters spaced 3.56 inches apart. The calculator shows the same result: 23 balusters and a 3.56-inch gap.

Why 4 Inches? The Building Code Background

Most residential building codes in the United States and many other countries require that the space between balusters be less than a 4-inch sphere. This rule comes from child safety: a 4-inch sphere approximates the size of a small child’s head, and the intent is to prevent a child from getting stuck between balusters. The same 4-inch rule often applies to guardrails on decks, stairs, and balconies above 30 inches off the ground.

Some jurisdictions may have different limits – for example, 4 inches is common, but some commercial or high-occupancy buildings require 3.5 inches or even less. Always check your local building code before you cut any material. The calculator uses whatever maximum gap you enter, so you can adapt it to your local requirement.

How to Use the Calculator for Stairs and Decks

The same formula works for both straight railings and stair railings, but there is one important difference: on a stair, the balusters are often installed at an angle, so the horizontal distance between them is what matters, not the distance along the slope. Measure the total length along the horizontal projection (the run) rather than the sloped length, or use the sloped length and then adjust the baluster angle accordingly.

For a deck railing, measure the clear opening between the inside faces of the two posts. For a stair railing, measure the horizontal distance from the bottom newel to the top newel, and then account for the pitch. Many carpenters simply measure the sloped length and use that in the calculator, which will give a slightly tighter spacing – that is safe, but you may end up with more balusters than strictly necessary.

Common Mistakes and How to Avoid Them

  • Mixing units – If you measure the railing in inches and the baluster width in centimetres, the result will be wrong. Convert everything to the same unit first.
  • Forgetting to round up – Always round the number of balusters up, never down. Rounding down can create a gap larger than the code allows.
  • Ignoring the first and last gaps – The formula assumes the gap between a post and the first baluster is the same as the gap between balusters. If you want a different end gap, you need a more complex layout.
  • Using the outside-to-outside measurement – Measure from the inside face of one post to the inside face of the other. If you measure the total outside width, you will be off by the post widths.
  • Not accounting for the baluster angle on stairs – On an angled railing, the horizontal gap is the critical dimension. If you input the sloped length, the horizontal gaps will be smaller, which is safe but may look uneven.

Alternatives to Evenly Spaced Balusters

While the calculator above gives equal spacing, some designs use a different approach:

  • Equal gaps with a different end gap – You can set the first and last gaps to a different value (often smaller) and then space the remaining balusters evenly. This requires a slightly more complex calculation.
  • Prefabricated baluster panels – Some manufacturers sell baluster panels where the spacing is already fixed. You just cut the panel to length, but you are limited to the manufacturer’s spacing.
  • Cable railing – Instead of vertical balusters, horizontal cables are used. Cable spacing rules are different – often a 4-inch sphere rule still applies, but the cables are flexible, so tensioning matters.
  • Glass panels – A glass railing has no vertical balusters, so spacing is irrelevant. But the glass panels themselves must meet structural and safety glazing codes.

Each alternative has its own code requirements, so check with your local building department before choosing a different system.

Safety and Inspection Considerations

The 4-inch sphere rule is not just a suggestion – it is a safety requirement that is typically enforced by building inspectors. If you install balusters with a gap larger than allowed, you may be required to redo the work before the project passes inspection. In addition to the spacing, most codes also require:

  • Balusters must be securely attached to the top rail and bottom rail or tread.
  • The railing itself must be at least 36 inches high for residential decks (42 inches for some commercial or multi-family buildings).
  • The railing must withstand a certain lateral force (often 200 pounds applied at any point).
  • Balusters must be spaced so that a 4-inch sphere cannot pass through at any point, including between the bottom rail and the deck surface.

Always verify your local code, as it can differ from the general rule. The calculator helps you with the math, but it does not replace a professional review of your plans.

Frequently Asked Questions

How many balusters do I need for a 12-foot railing?
Assuming a 4-inch max gap and 1.5-inch balusters, a 144-inch railing would need: (144 + 1.5) ÷ (1.5 + 4) = 145.5 ÷ 5.5 = 26.45, rounded up to 27 balusters. The actual gap would be (144 – 27×1.5) ÷ 28 = (144 – 40.5) ÷ 28 = 103.5 ÷ 28 = 3.70 inches.

What is the maximum baluster spacing for a deck railing?
In most US jurisdictions, the maximum clear space between balusters is 4 inches. Some areas may require 3.5 inches for commercial buildings or for railings on stairs. Always check your local code, because it is the legal requirement that governs your project.

Does the baluster width affect the spacing?
Yes. Wider balusters mean you need fewer of them to achieve the same maximum gap, because the baluster itself takes up space. For example, with a 4-inch gap and 2-inch balusters, you would need fewer balusters than with 1-inch balusters on the same railing length.

Can I space balusters closer than the code requires?
Yes, you can always space them closer – that is safer. The code sets a maximum gap, not a minimum. However, closer spacing means more balusters, higher material cost, and a more visually dense railing.

How do I measure the railing length for stairs?
Measure the horizontal run of the stair railing (the distance from the bottom newel to the top newel measured horizontally, not along the slope). If you measure the sloped length, the balusters will be closer together horizontally, which is safe but may look overly tight. For a precise layout, use the horizontal run.

What if my balusters are not rectangular?
The formula uses the width of the baluster at its widest point in the direction of the gap. For round or turned balusters, use the diameter. For tapered balusters, use the widest point, because the gap is measured at the narrowest opening between two balusters, which is usually at the widest part of the baluster.

Related

Formula used
in total | Total railing length | in | 120 | 0
in balw | Baluster width | in | 1.5 | 0
in maxgap | Max gap allowed | in | 4 | 0
out count | Number of balusters | - | ceil((total + balw) / (balw + maxgap)) | 0
out gap | Actual gap | in | (total - (count * balw)) / (count + 1) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.