Decking calculator

Deck Railing & Baluster Calculator

A deck railing calculator that turns the clear length of a railing section and your baluster width into the baluster count you need to meet the standard 4-inch guard opening limit, and the actual spacing you will get. Gaps wider than the limit are a safety problem, and a wrong count shows up only after the rail is built. Enter the section length and get the spacing right.

  • Free to use
  • No sign-up
  • Formula and sources shown
Deck Railing & Baluster Calculator

Got the number? Save it before it gets lost.

A result on a screen is easy to lose. Save this estimate in the app and it stays with the project, ready when you order.

Save this estimate in the app

4 in is the standard IRC guardrail maximum.

Balusters needed

22

Actual gap between balusters

3.78 in

Space the balusters evenly. Calculate each section between posts separately, and check your local code.

Turn this result into a priced plan

Save it to a project, add the rest of your materials, and send a client-ready quote. No retyping, no spreadsheet, no lost numbers.

Open this calculator in the app

Formula

Balusters = ceil[(Clear span − Max gap) ÷ (Baluster width + Max gap)]; Actual gap = (Clear span − Balusters × Width) ÷ (Balusters + 1)

Worked example. A 120 in clear span with 1.5 in balusters and a 4 in max gap: (120 − 4) ÷ 5.5 = 21.09, rounded up to 22 balusters. Actual gap = (120 − 33) ÷ 23 = 3.78 in.

Work out the count from the widest gap you can allow. Subtract the maximum gap from the clear rail length, divide by the baluster width plus the maximum gap, and round up. For a 120 in section with 1.5 in balusters and a 4 in gap, that gives 22 balusters with gaps of about 3.78 in. Check the finished gaps, because the real spacing is what the limit applies to.

How to use the deck railing calculator

  1. Measure the clear span of one railing section, from the inside face of one post to the inside face of the next, in inches.
  2. Enter the actual width of your baluster. A 2×2 wood baluster is 1.5 in, and metal balusters are often 5/8 to 3/4 in.
  3. Keep the maximum gap at 4 inches, or lower it to leave a safety margin.
  4. Read the number of balusters for that section.
  5. Repeat for each section and add the results. Do not enter the total length of several sections at once.

Baluster spacing formulas

A section with n balusters has n + 1 gaps: one between each pair of balusters and one at each end beside a post. Every gap must be at most the maximum gap.

Balusters = ceil[ (Clear span − Max gap) ÷ (Baluster width + Max gap) ]

Actual gap = (Clear span − Balusters × Baluster width) ÷ (Balusters + 1)

Center-to-center spacing = Baluster width + Actual gap

A simpler shortcut, clear span ÷ (width + gap) rounded down, is not safe. For the 120 in example it gives 21 balusters, which leaves gaps of 4.02 in, slightly over the 4 in limit. Rounding up from the formula above always keeps every gap at or under the limit.

Deck baluster examples

Example 1: 120 in section, 1.5 in balusters, 4 in max gap

  • (120 − 4) ÷ 5.5 = 21.09, rounded up = 22 balusters
  • Actual gap = (120 − 22 × 1.5) ÷ 23 = 3.78 in
  • Center-to-center = 1.5 + 3.78 = 5.28 in

Example 2: 6 ft post spacing, 3.5 in posts, 1.5 in balusters

  • Clear span = 72 − 3.5 = 68.5 in
  • (68.5 − 4) ÷ 5.5 = 11.73, rounded up = 12 balusters
  • Actual gap = 3.88 in

Example 3: same section with 3/4 in round metal balusters

  • (68.5 − 4) ÷ 4.75 = 13.58, rounded up = 14 balusters
  • Actual gap = (68.5 − 14 × 0.75) ÷ 15 = 3.87 in

Example 4: 24 ft railing in four 6 ft sections

  • Posts = 4 + 1 = 5 (straight run, not counting corner or stair posts)
  • Balusters = 12 per section × 4 = 48
  • Top and bottom rails = 2 per section × 4 = 8 rails

Why add a safety margin?

A gap that is only just under 4 inches leaves no room for post lean, board movement or a tape-measure error. Many builders design to about 3.5 inches. For the 120 in section, a 3.5 in design gap needs 24 balusters and gives 3.36 in gaps, at the cost of 2 more baluster(s). Check with your inspector if your area measures openings strictly.

Deck guard rules at a glance (IRC)

ItemTypical requirement
Guard needed when the walking surface is above grade byMore than 30 in
Guard height on residential decksAt least 36 in
Opening between balustersMust not pass a 4 in sphere
Guard height on stairs (from tread nosings)At least 34 in
Open side of stairsMust not pass a 4⅜ in sphere; the triangle at the bottom rail may be up to 6 in
Load on top rail200 lb in any direction
Gap below the bottom railGenerally also kept under 4 in

Typical limits in commonly adopted editions of the IRC (Sections R312 and R301.5). Section numbers and some limits change between editions and local codes, so confirm with your building department.

Baluster widths by type

Baluster typeTypical actual width
Wood 2×21.5 in
CompositeAbout 1.5 in
Square metalAbout 5/8 to 3/4 in
Round metalAbout 5/8 to 3/4 in

Widths vary by product. Use the dimension in your manufacturer's data sheet.

How many balusters per foot?

With 1.5 in balusters and gaps near 3.8 in, centers are about 5.3 in apart, so you need about 2.3 balusters per foot of clear span. With a 3.5 in design gap it is about 2.5 per foot. Use these only as a quick check; calculate each section for an exact count.

Multiple sections and posts

Each section has its own end gaps beside the posts, so count each one separately. Entering the total length of several sections can undercount. For example, three sections of 65.5 in need 36 balusters in total, while one 196.5 in run gives 35.

Posts (straight run) = Number of sections + 1

Rails = 2 × Number of sections (top and bottom)

Add posts at corners, stair landings and gates. Check your railing system's maximum post spacing and rail span; many systems use 6 ft, and some allow 8 ft.

Stair railings

Railings on stairs follow the slope of the stair, and the code openings differ from a level guard (see the table above). Measure the sloped length of each section, calculate the balusters, and then check the actual openings with a 4⅜ in sphere. Stairs with four or more risers also need a graspable handrail, usually 34 to 38 in above the tread nosings. Use the stair calculator for the stair geometry.

Estimating railing cost

Cost = Balusters × Price per baluster + Rails × Price per rail + Posts × Price per post

Example only: at $2.50 per baluster, the 22 balusters in Example 1 cost $55.00. Rails, posts, hardware, brackets and delivery are extra.

Common deck railing mistakes

  • •Measuring from post center to post center instead of the clear span.
  • •Entering the total length of several sections instead of one section at a time.
  • •Rounding the baluster count down, which can leave gaps over the limit.
  • •Forgetting the gap at each end beside the posts.
  • •Leaving more than 4 inches under the bottom rail.
  • •Using the nominal baluster size instead of the actual width.
  • •Assuming a railing that looks sturdy meets the 200 lb load requirement. Use a tested system and follow the post attachment instructions.

Metric conversions

FromTo
4 inches101.6 millimetres
4⅜ inches111 millimetres
1.5 inches38 millimetres
34 inches864 millimetres
36 inches914 millimetres

Balusters per section: quick reference table

Most railings are built in sections of 6 or 8 feet between posts, so the table below works out the common section lengths for the two baluster sizes you will meet most often. Both tables design to a 3.75 in gap, which leaves a safety margin under the 4 in code limit for post lean, wood movement and tape-measure error. Run your exact clear span through the calculator above for the final count.

Clear spanBalusters (1.5 in wood)Actual gapCenter-to-center
36 in (3 ft)73.19 in4.69 in
48 in (4 ft)93.45 in4.95 in
60 in (5 ft)113.63 in5.13 in
72 in (6 ft)133.75 in5.25 in
84 in (7 ft)163.53 in5.03 in
96 in (8 ft)183.63 in5.13 in

1.5 in wood balusters (2×2) with a 3.75 in design gap. Counts use the ceiling formula, so every gap is at or under the design gap.

Clear spanBalusters (0.75 in metal)Actual gapCenter-to-center
36 in (3 ft)83.33 in4.08 in
48 in (4 ft)103.68 in4.43 in
60 in (5 ft)133.59 in4.34 in
72 in (6 ft)163.53 in4.28 in
84 in (7 ft)183.71 in4.46 in
96 in (8 ft)213.65 in4.40 in

0.75 in metal balusters with a 3.75 in design gap. Thinner balusters need more pieces per section: an 8 ft section takes 21 metal balusters against 18 wood ones, so compare the cost per foot of railing, not the price of one baluster.

Marking out balusters: center marks

Knowing how many balusters you need is only half the job. The other half is marking their positions on the rail so the gaps come out even, with the same gap beside each post as between the balusters. Marking by eye or with a fixed spacer block usually leaves an odd gap at one post, which is the detail an inspector and every visitor will notice.

First center mark = Actual gap + (Baluster width ÷ 2) (measured from the post face)

Next center marks = First mark + Center-to-center spacing, repeated

Example: marking out the 120 in section with 22 balusters

  • Actual gap is 3.78 in and the baluster width is 1.5 in, so the first center mark is 3.78 + 0.75 = 4.53 in from the post face
  • Center-to-center spacing is 5.28 in, so the marks fall at 4.53, 9.81, 15.09, 20.37 in, and so on
  • The last center mark is at 120 − 4.53 = 115.47 in, which leaves the same 3.78 in gap beside the far post
  • Check the last gap before you drill or cut: if it does not match the first, one of the marks is wrong

Cut a spacer block to the actual gap, not to the code maximum, and use it to check each position as you go. A block cut to 3.78 in keeps every gap identical, while a 4 in block would leave the last gap short. On a long run, mark all the centers on the top rail first, then transfer them to the bottom rail with a square so the balusters stand plumb.

Balusters per stair tread

Stair railings are counted per tread, because each tread is one step of the sloped run. The formula is the same shape as the level formula, with the tread depth standing in for the clear span. Measure along the slope of the rail, not the horizontal run, and then check the actual openings with a 4⅜ in sphere, which is the opening limit on the open side of stairs under the IRC.

Balusters per tread = ceil[ Tread depth ÷ (Baluster width + Max gap) ]

Tread depth1.5 in wood balusters0.75 in metal balusters
10 in2 per tread3 per tread
11 in2 per tread3 per tread
11.25 in (two deck boards)3 per tread3 per tread

Calculated with a 4 in maximum gap. Two balusters per tread is typical for 10 to 11 in treads with 1.5 in balusters, and three per tread is common with thinner balusters. Work out your stair geometry first with the stair calculator, then count the balusters per tread.

A stair with 5 treads and 2 balusters per tread needs 10 balusters on that side, plus the newel posts at the top and bottom. Stairs with four or more risers also need a graspable handrail, usually 34 to 38 in above the tread nosings. Use the stair calculator for the risers, treads and run before you order the railing.

Wood, metal and cable railing compared

TypeBaluster widthBalusters per footUpkeepNotes
Wood 2×21.5 inAbout 2.3Paint or stain regularlyCheapest per piece; can twist or split
CompositeAbout 1.5 inAbout 2.3WashMatches composite decking; check the system rating
Square metalAbout 0.75 inAbout 2.7Wash; touch up chipsSlim look, more pieces per foot
Round metalAbout 0.75 inAbout 2.7Wash; touch up chipsClassic look; needs connectors top and bottom
CableNo balustersNoneRe-tension as cables stretchHorizontal cables about 3 in apart; needs strong posts and a tested system

Balusters per foot at a 3.75 in design gap. Cable railings have no balusters, so the count above does not apply; instead, count about 10 to 12 cables for a 36 in high rail and check that the cables cannot be spread to pass a 4 in sphere.

The cheapest railing is not the one with the cheapest baluster. Metal balusters cost more per piece than wood, and you need more of them per foot, but they need no painting and they keep a slim, open look that suits a view. Wood is cheapest up front and easiest to cut on site, but it needs regular paint or stain and a spare or two for splits. Price the whole section, balusters plus rails, posts, connectors and brackets, before you choose.

Full railing takeoff: a 24 ft run

A single section count is not an order. The takeoff below covers a straight 24 ft run of railing in four 6 ft sections, with 1.5 in wood balusters, and shows every line a lumber yard or railing supplier will ask for. Add 5 to 10% spare balusters for splits, knots and miscuts, and add posts at corners, stair landings and gates.

ItemQtyHow it is counted
Posts5Sections + 1 for a straight run
Balusters4812 per section × 4 sections
Top rails4One per section
Bottom rails4One per section
Post caps5One per post
Baluster connectors96Two per baluster, metal baluster systems only
Spare balusters3 to 55 to 10% extra for defects and miscuts

Clear span per section is 68.5 in after 3.5 in posts are taken out of 72 in post spacing, which is why each section needs 12 balusters. Rail brackets and screws come from your railing system; count two brackets per rail end and check the manufacturer's hardware list.

For a whole deck, work out each side separately and add the sections, because corners and stair openings break the run into different lengths. A 16×12 ft deck with railing on three sides has about 40 linear feet of railing, but the sections are two 12 ft sides and one 16 ft side, not one 40 ft run. Count the boards for that deck with the deck calculator and the posts for the corners with the fence post calculator if you are spacing posts along a long run.

How to install balusters evenly

  1. Measure the clear span between the inside faces of the posts, at the rail, not from post center to post center.
  2. Calculate the baluster count and the actual gap with the calculator above, using a design gap of about 3.5 to 3.75 in.
  3. Cut a spacer block to the actual gap and mark the first center on the top rail at one gap plus half a baluster from the post face.
  4. Step along the rail by the center-to-center spacing, marking every center, and check that the last gap matches the first.
  5. Transfer the marks to the bottom rail with a square so the balusters stand plumb.
  6. Install the balusters, then check every opening with a 4 in sphere or a 4 in block. No opening should pass it, including the gap under the bottom rail.
  7. Check the guard height: 36 in minimum on a residential deck, measured from the deck surface, and 34 in minimum on stairs measured from the tread nosings.

Related tools

Assumptions

  • •Uses a 4 inch maximum gap, the widely adopted IRC guard opening limit. Confirm the limit in your local code edition.
  • •Assumes evenly spaced balusters in a straight, level section between two posts, using the clear span. Calculate each section separately.
  • •Does not size posts, rails or connections, and does not guarantee the railing meets load requirements. Use a tested system and follow the manufacturer's instructions.

Sources✓ Verified

  • International Residential Code (IRC) Section R312, Guards and Window Fall Protection. Guard height, 4-inch opening limit and stair guard openings.
  • International Residential Code (IRC) Section R301.5, Live Loads. 200 lb concentrated load on the top rail of guards.
  • AWC DCA 6, Prescriptive Residential Wood Deck Construction Guide. Guard post and connection details for wood decks.
  • ASTM D7032 and ICC-ES AC174. Performance ratings and acceptance criteria for composite deck guardrail systems.
  • Your local building department. Adopted code edition and local amendments.

Formula reviewed November 2026.

4 inches under commonly adopted IRC guard rules: a 4-inch sphere must not pass through any opening. Gaps on the open side of stairs are measured differently, so check your local code.

Subtract the maximum gap from the clear span, divide by the baluster width plus the maximum gap, and round up. A 120 in span with 1.5 in balusters and a 4 in gap needs 22 balusters.

For a 120 in clear span with 1.5 in balusters and a 4 in maximum gap, you need 22 balusters, with gaps of about 3.78 in. If posts take up part of the 10 ft, measure the clear span between posts instead.

With 6 ft post spacing and 3.5 in posts, the clear span is 68.5 in. That needs 12 balusters of 1.5 in width, with gaps of about 3.88 in.

The 4-inch rule says openings in a guard must be small enough that a 4-inch sphere cannot pass through. It is meant to stop young children from slipping through or getting their heads stuck.

Residential deck guards are typically at least 36 inches high, and a guard is generally required when the walking surface is more than 30 inches above the ground. Stair guards are measured from the tread nosings and are commonly at least 34 inches.

The gap between balusters must be 4 inches or less, and centers are usually about 5 to 5.5 inches apart for 1.5 inch balusters. For example, the 22 balusters in a 120 in section sit about 5.3 inches center to center.

For 1.5 inch balusters with gaps under 4 inches, about 2.3 balusters per foot. Metal 3/4 inch balusters need more, about 2.6 per foot. Calculate each section for an exact count.

Rounding down can leave gaps slightly over the limit. For a 120 in section, a simple divide-and-round-down gives 21 balusters and gaps of 4.02 in. Using the corrected formula and rounding up gives 22 and gaps of 3.78 in.

Many areas require a permit for new decks and railings, and inspectors measure guard height and openings. Check with your local building department before you build.

With 1.5 inch wood balusters and a 4 inch maximum gap, a 10 inch tread needs 2 balusters and an 11.25 inch tread needs 3. With 0.75 inch metal balusters, a 10 inch tread needs 3. Measure along the slope of the rail and check the openings with a 4 3/8 inch sphere.

Mark the first center at one actual gap plus half a baluster from the post face, then step along by the center-to-center spacing. For a 120 inch section with 22 balusters, the first center is 4.53 inches from the post and the marks fall every 5.28 inches, leaving the same 3.78 inch gap at the far post.

Converters to use with the Deck Railing & Baluster Calculator

Switch units, compare bulk and bagged quantities, or check coverage, without leaving BuildCova.

Browse all converters

More decking calculators

Trex Decking CalculatorDeckingTrex Decking CalculatorThis Trex decking calculator counts exactly how many Trex boards, hidden fasteners and joists your deck needs, and what the boards cost in Enhance, Select or Transcend. This is an independent estimator, not affiliated with, endorsed by, or sponsored by Trex Company, Inc. Enter your deck size, pick a Trex line and a board length, and get a full materials list with waste included.Composite Decking CalculatorDeckingComposite Decking CalculatorThis composite decking calculator counts exactly how many composite deck boards, joists and hidden fasteners your deck needs, and what the boards cost in composite, pressure-treated wood or capped PVC. Pick your material, board width and board length, and compare all three materials on the same deck before you buy. The material decides the price, the gap and the lifespan, so compare first.TimberTech Decking CalculatorDeckingTimberTech Decking CalculatorThis TimberTech decking calculator counts exactly how many TimberTech boards, hidden fasteners and joists your deck needs, and what the boards cost in Edge, Prime+ or AZEK, including the wide-plank 7.25 in AZEK board. This is an independent estimator, not affiliated with, endorsed by, or sponsored by TimberTech or AZEK Company. Enter your deck size, pick a line and a board width, and get a full materials list with waste included.Roof Decking CalculatorDeckingRoof Decking CalculatorThis roof decking calculator counts exactly how many 4x8 sheets of plywood or OSB your roof deck needs. Enter the building footprint and the roof pitch, and get a pitch-adjusted sheet count with waste, the true sloped area, and the total weight to haul, plus the thickness the code expects for your rafter spacing. The pitch is the whole job: a sloped roof has more surface than the footprint under it.Decking Calculator AppDeckingDecking Calculator AppThis decking calculator app works like an app, with no download, no account and no install. Open it in your browser, enter your deck size, and get the board count, linear feet, screws and cost instantly. Save the page to your home screen and it behaves like a decking app on your phone, right there at the lumberyard.Wood Decking CalculatorDeckingWood Decking CalculatorThis wood decking calculator counts exactly how many wood deck boards your deck needs, in pressure-treated pine, cedar or redwood, with the right gap for each species, the board count, the linear feet and the cost. Wood is not one material: wet treated pine is installed tight and shrinks open on its own, while dry cedar needs a real gap from day one. This calculator knows the difference.

Material requirements can vary based on product specifications and job conditions. Verify quantities with your supplier before ordering.