Deck railing calculator

Balusters, posts and rail — spaced so no gap passes a four inch sphere.

Units

Centre to centre. What a post can span is a structural question — take it off your tables.

A 2x2 measures 1.5 in; a square metal baluster is often 0.75.

A 4x4 measures 3.5 in. It comes off the clear span in every bay.

Rails and gates

Top and bottom is two. A mid rail makes it three.

Leave blank to buy rail cut to the bay.

Each gate adds a post.

Material estimate

Enter the railing length and the post spacing to see the balusters.

    Four inches is a limit, not a spacing

    The rule is that no opening in a guard may allow a 4 inch sphere to pass. It says nothing about how far apart to put balusters — it says how far apart you may not put them. So the count is whatever it takes to keep every gap under that on your bay with your balusters, and it is arithmetic rather than a rule of thumb.

    n balusters leave n+1 gaps gap = (clear span − n × baluster width) ÷ (n + 1) so the count is the smallest n where gap < 4 in: n > (span − 4) ÷ (4 + width) 6 ft centres, 4x4 posts, 2x2 balusters clear span 65.07 in 12 balusters gaps of 3.62 in ✓ 11 balusters gaps of 4.05 in ✗

    Why "about five inches apart" fails

    Because a bay is rarely a round number once the post is taken out of it. Six foot centres with 4x4 posts leaves 65.07 inches of actual opening, not 72 — and dividing that by a spacing you picked gives a fraction, which you then round the wrong way. The count above is derived from the limit and lands inside it every time.

    Balusters per bay, 4x4 posts

    Balusters per bay, 4x4 posts
    Bay¾ in balusters1½ in balusters3½ in balustersClear span
    4 ft bay9 at 3.78 in8 at 3.61 in6 at 3.36 in44.5 in
    5 ft bay12 at 3.65 in10 at 3.77 in8 at 3.17 in56.5 in
    6 ft bay14 at 3.87 in12 at 3.88 in9 at 3.7 in68.5 in
    8 ft bay19 at 3.91 in17 at 3.72 in12 at 3.88 in92.5 in

    From this calculator against the IRC's four inch sphere. Every figure is the smallest count that keeps the gaps legal — one fewer fails in every case.

    Two heights, measured from two places

    A guard on a deck, balcony or landing is at least 36 inches above the walking surface. A guard on the open side of a stair is at least 34 inches, measured vertically from a line drawn through the tread nosings. Those are different numbers from different references, which is why a guard running down a flight does not simply carry on at the same height as the one on the deck.

    The stairs are a different calculation

    Two rules change on a raking guard: the infill may not pass a 4.375 inch sphere rather than a 4 inch one, and the triangular opening between the tread, the riser and the bottom rail may not pass a 6 inch sphere. The geometry of a sloped bay is not the geometry of a level one, so this tool does level runs and tells you the stair figures rather than quietly applying the wrong ones.

    Post spacing is not ours to give

    What a guard post can span depends on the guard load the code requires, on how the post connects to the deck frame, and on your jurisdiction. It is also the part of a railing that actually fails, and it fails by putting somebody over an edge. So it is an input here with no suggestion attached. Take it from a prescriptive table for your deck or from whoever designed it — then this page will count everything that hangs off it.

    What governs is your adopted code

    These are the IRC's figures and they have been stable across recent editions, but the edition your building department has adopted is the one that applies, amendments are common, and commercial work follows a different code entirely. Check before you cut.

    The rest of the deck

    The deck board calculator counts the decking with the gap between boards handled properly, and the deck stain calculator works the finish from published coverage — including the spindles, which are most of the surface area on a railing. Underneath, footings and the post depth calculator cover what holds it up, and where the deck has to meet a ramp the wheelchair ramp calculator handles the ADA slope. For the framing itself, the wall framing calculator does the same bays-plus-one arithmetic this page does.

    Elevation of 40 feet of deck guard in seven bays, each filled with balusters spaced under four inches apart.
    Drawn to scale.

    Common questions

    How far apart should deck balusters be?

    Close enough that no gap passes a 4 inch sphere — that is the rule, and it is a maximum rather than a spacing. So the answer depends on the bay and the baluster: 65.07 inches of clear span with 1.5 inch balusters takes 12 of them at 3.62 inch gaps. Eleven would leave 4.05 inch gaps, which fails. "About four inches apart" is how people end up one baluster short in every bay.

    How many balusters do I need?

    Work it per bay and multiply. With a clear span S and balusters of width w, n balusters leave n+1 gaps, so the gap is (S − n·w) ÷ (n+1) and you need the smallest n that puts that under 4 inches. On the worked example — 40 feet of guard at undefined foot centres — that is 12 per bay across 7 bays, or 84 in total.

    How high does a deck railing have to be?

    At least 36 inches above the walking surface for a guard on a deck, balcony or landing, and at least 34 inches on a stair measured vertically from a line drawn through the tread nosings. Those are two different numbers measured from two different references, which is exactly why a guard that runs down a stair does not simply continue at the same height.

    Are the rules different on the stairs?

    Yes, in two ways, and neither is calculated here. The infill on the open side of a stair may not pass a 4.375 inch sphere rather than a 4 inch one, and the triangular opening formed between the tread, the riser and the bottom rail may not pass a 6 inch sphere. A raking guard is a different layout with different geometry, so this tool covers level runs and says so rather than giving you a count that is wrong on the stairs.

    How far apart can the posts be?

    This site will not tell you, and be suspicious of any calculator that does. What a guard post can span is a structural question: it depends on the guard load the code requires, on how the post is connected to the deck frame, and on your jurisdiction. It is also the part of a railing that actually fails, and it fails by putting somebody over the edge. Take the spacing off a prescriptive table for your deck or from whoever designed it, then bring it here.

    Does the post width matter?

    More than people expect. A 4x4 measures 3.5 inches, and that comes off the clear span in every single bay — a undefined foot centre-to-centre spacing is only 65.07 inches of actual opening. Use a 6x6 and you lose two more inches a bay, which can change the baluster count. That is why this calculator asks for the post width rather than working from the centres alone.

    How much rail do I need?

    Two rails per section is the usual build — a top rail and a bottom rail — so the linear footage is simply twice the guard length: 80 feet on the worked example. A mid rail makes it three. Whether you buy rail in long lengths and cut, or buy to the bay, changes the piece count rather than the footage, so the stock length is an optional field.

    Which code edition applies to me?

    The one your building department has adopted, which is not always the newest. The figures here are the IRC's and they have been stable across recent editions, but adoption lags and amendments are common — some jurisdictions require a taller guard above a certain height above grade, and commercial work follows a different code entirely. Check before you cut, not after the inspection.

    Sources

    Code numbers rather than product properties, and stored because the whole baluster calculation follows from one of them: the gap has to be under four inches, so the count per bay is set by the clear span and the baluster width together. What is not stored is post spacing — that is a structural question governed by the guard load, the post connection and your jurisdiction's prescriptive tables, and no single national figure exists. The code edition your building department has adopted is the one that governs; these are the IRC figures and they have been stable across recent editions, but heights above a certain floor level and commercial work differ.

    Unit conversions are exact by definition and need no source.

    How we choose and cite these figures

    By Team MaterialMath. Published . How these figures are sourced and checked.