Framing

Railing Calculator

Count balusters and posts for a railing that meets the 4 inch rule.

ft
in
A 2x2 baluster measures 1.5 in. Metal balusters are often 0.75 in.
ft
Six feet maximum for most deck codes. Closer for taller railings.
Balusters needed
Posts needed
Resulting gap in

What you'll need to order

Prices vary by region and haul distance. Get quotes from at least two local suppliers.

How this calculator works

balusters = railing length × 12 ÷ (baluster width + 3.875)

The 3.875 inch gap keeps a 4 inch sphere from passing through, which is the universal code requirement. Working to 3.875 rather than exactly 4 leaves a margin for construction error.

Switch the site to metric — the control is in the footer — and your inputs, your results and the tables below follow. The formula, the constants, the guidance text and the sources stay in US units on purpose: that is how the standards they come from are written, and restating them would detach each figure from the document you are meant to be able to check it against.

Where these numbers come from

Cited to a specific edition on purpose — table numbers and values move between cycles. Confirm against whichever edition is enforced locally.

Worked example

With railing length 24 ft, baluster width 1.5 in, post spacing 6 ft, this calculator returns 53.58 .

Balusters needed for railing runs of common length

Each row is a link that fills in the calculator above. Send one and the other end sees the same figures you do.

JobSizeBalusters needed
Short deck section 10 ft × 1.5 in × 5 ft 22.33
Typical deck side 24 ft × 1.5 in × 6 ft 53.58
Wrap-around deck 48 ft × 1.5 in × 6 ft 107.2
Porch with square balusters 20 ft × 2 in × 5 ft 40.85
Slim metal balusters 24 ft × 0.75 in × 6 ft 62.27

The gap is worked to 3⅞ in rather than a bare 4 so construction tolerance cannot push it over the limit.

Frequently asked questions

How far apart can balusters be?

Close enough that a 4 inch sphere cannot pass between them. In practice that means a maximum clear gap of just under 4 inches — most builders work to 3.875 inches to leave a margin.

How many balusters do I need?

Divide the railing length in inches by the baluster width plus 3.875. A 24 ft run with 2x2 balusters needs about 54.

How far apart should railing posts be?

Six feet maximum on most decks, and closer where the railing is tall or the guard load is high. The post connection to the framing, not the spacing, is what usually fails.

How tall does a deck railing have to be?

Thirty-six inches for residential decks under the IRC, and 42 inches in many commercial and some local codes. Measure from the walking surface to the top of the rail.

Use the railing calculator on your site, free

Yours to use — no sign-up, nothing to install, and nothing that phones home. Drop this into your page where the calculator should sit:

<iframe id="calcpit-railing-calculator" src="https://www.calcpit.com/embed/railing-calculator/"
        title="Railing Calculator" width="100%" height="790"
        style="border:1px solid #e2e2e2;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://www.calcpit.com/calculators/railing-calculator/">Railing Calculator</a> by CalcPit</p>

<!-- Optional: shrinks the frame to fit. Safe to delete — the height above works without it. -->
<script>addEventListener("message",function(e){
  if(e.origin!=="https://www.calcpit.com"||!e.data||e.data.calcpit!=="railing-calculator")return;
  var f=document.getElementById("calcpit-railing-calculator");if(f)f.style.height=e.data.height+"px";
});</script>

The one condition: leave the credit line under the frame. That attribution is what this costs, and it is the reason it stays free.