Deck Railing Calculator: Posts, Rails and Balusters
A wood deck guard 36 in high along a 20 ft side with a 3 ft stair opening and a 12 ft side, joined at a corner and with posts no more than 6 ft apart, needs 7 rail boards (2 × 4 × 12 ft, with 5% extra), 8 posts, 12 rail pieces and 59 balusters (2 × 2, gaps under 4 in, with 5% extra) for 29 ft of railing. Posts are the stretches split into equal bays no longer than 6 ft, plus one; each bay takes a top and a bottom rail.
Figures based on the sources listed belowUpdated How we calculate
Buy 7 rail boards.
Buy 7 rail boards
29 linear ft + 5% waste = 30.45 linear ft
- Posts (4 × 4): 8 posts (each at least 3 ft), at most 6 ft apart, a post at every corner and end
- Rails (2 × 4: top and bottom): 12 pieces, 6 bays × 2
- Rail boards (2 × 4 × 12 ft): 7 boards, 6 for the cut list, plus waste
- Balusters: 59 balusters, 56 in the bays, plus waste
- Baluster layout: 8 per 51 in bay (4 bays), gap 3.94 in; 12 per 72 in bay (2 bays), gap 3.88 in
- Baluster length: 30 in between the rails, plus any tenon or mounting allowance
- Railing: 29 ft, after openings, post centre to post centre
- Cut list (first-fit, inches): 2 × 72 in + 72 in; 4 × 51 in + 51 in (before waste)
- Guard height: 36 in, at or over the 36 in residential minimum (IRC R312.1.2)
- Gap under the bottom rail: 3 in under the bottom rail
- Largest baluster gap used: under 4 in; the open side of a stair is held to 4 3/8 in
How this number is calculated
29 linear ft + 5% waste = 30.45 linear ft ÷ 4.35 linear ft per rail board = 7 rail boards
Shopping list
- 4 × 4 deck posts, pressure treated
- 2 × 2 deck balusters (36 in)
- Deck post caps
- Exterior structural screws
- Baluster spacing jig
- Tape measure with 1/16 in marks
Your project
- Run 1 length × guard height: 20 × 3 ft
- Run 2 length: 12 ft
- Run 3 length: 0 ft
- Run 4 length: 0 ft
- Runs: Joined end to end at corners (shared corner post)
- Openings in run 1 (stairs, gates): 1
- Width of each opening: 36 in
- Largest post spacing: 6 ft on center (typical for 4 × 4 posts)
- Rail board length: 12 ft
- Baluster: 2 × 2 wood, 1.5 in actual (about 3.8 cm)
- Largest gap allowed: 4 in
- Gap under the bottom rail: 3 in
- Waste: A few spares (5%)
Also pick up
- 4 × 4 deck posts, pressure treated
- 2 × 2 deck balusters (36 in)
- Deck post caps
- Exterior structural screws
- Baluster spacing jig
- Tape measure with 1/16 in marks
Reopen this calculation: /calculators/deck-railing/?s=eyJyb29tIjp7Imxlbmd0aEZ0IjoyMCwid2lkdGhGdCI6M30sImRlZHVjdGlvbnMiOltdLCJ3YXN0ZVBjdCI6MC4wNSwicGFyYW1zIjp7InJ1bjJGdCI6MTIsInJ1bjNGdCI6MCwicnVuNEZ0IjowLCJqb2luZWQiOjEsIm9wZW5pbmdzIjoxLCJvcGVuaW5nV2lkdGhJbiI6MzYsInBvc3RTcGFjaW5nRnQiOjYsInJhaWxTdG9ja0Z0IjoxMiwiYmFsdXN0ZXJUeXBlIjoxLjUsImN1c3RvbUJhbHVzdGVyV2lkdGhJbiI6MSwibWF4R2FwSW4iOjQsImJvdHRvbUdhcEluIjozfX0
Show diagram
Saved projects
No saved projects yet.
Posts for one straight run by post spacing
| Run | Posts at 6 ft | Posts at 5 ft | Posts at 4 ft |
|---|---|---|---|
| 6 ft | 2 | 3 | 3 |
| 8 ft | 3 | 3 | 3 |
| 10 ft | 3 | 3 | 4 |
| 12 ft | 3 | 4 | 4 |
| 16 ft | 4 | 5 | 5 |
| 20 ft | 5 | 5 | 6 |
| 24 ft | 5 | 6 | 7 |
| 30 ft | 6 | 7 | 9 |
Balusters in one bay by bay length
| Bay | 2 × 2 balusters | Gap | 3/4 in metal | Gap |
|---|---|---|---|---|
| 3 ft | 6 | 3.36 in | 7 | 3.41 in |
| 4 ft | 8 | 3.61 in | 9 | 3.78 in |
| 5 ft | 10 | 3.77 in | 12 | 3.65 in |
| 6 ft | 12 | 3.88 in | 14 | 3.87 in |
Rail boards for one straight run by board length
| Run | 8 ft boards | 10 ft boards | 12 ft boards | 16 ft boards |
|---|---|---|---|---|
| 6 ft | 2 | 2 | 1 | 1 |
| 8 ft | 2 | 2 | 2 | 1 |
| 10 ft | 4 | 2 | 2 | 2 |
| 12 ft | 4 | 4 | 2 | 2 |
| 16 ft | 6 | 6 | 3 | 2 |
| 20 ft | 8 | 4 | 4 | 3 |
| 24 ft | 8 | 8 | 4 | 4 |
| 30 ft | 10 | 10 | 5 | 5 |
Methodology & assumptions
Each run is the length of guard along one side of the deck, measured post centre to post centre. Openings for stairs or a gate come out of run 1: with the 20 ft run and one 3 ft opening, 17 ft are left, split into two stretches of 8.5 ft, one each side of the opening, with a post at each end of every stretch. (An opening at the very end of a run saves a post; enter such a side as a run with no opening.) Each stretch is divided into the fewest equal bays that are no longer than the post spacing: 8.5 ft over 6 ft is 2 bays of 51 in. Posts are bays + 1 per stretch, and runs joined at a corner share the corner post. The 6 ft spacing is a typical figure for wood 4 × 4 posts, taken from connector and deck-guide practice, not a number in the model code: the IRC (Table R301.5) asks a guard to resist a 200 lb concentrated load at the top, and what post size, spacing and connection achieve that is a design question, so check your jurisdiction’s deck handout or the AWC prescriptive deck guide (DCA 6) and use closer posts if it says so. Rails: every bay has a top and a bottom rail, cut to the bay length, and the pieces are packed onto stock boards by the first-fit decreasing method (longest piece first, each into the first board with room). The cut list is shown in inches, and each board’s pieces are joined with a plus sign. Saw kerf, a rail that continues over a post, and a rail cap are not modeled; the waste percentage pays for kerf and culls. Balusters: in each bay the clear span is the bay length less a 3.5 in post, and the baluster spacing calculator’s equal-gap method gives the fewest balusters whose gap stays under the largest gap allowed: n balusters of width w leave n + 1 equal gaps of (span − n × w) ÷ (n + 1), and n is the smallest whole number that makes that gap less than 4 in. The IRC requires that a 4 in sphere cannot pass through any opening of the guard (R312.1.3), including the space under the bottom rail; the guard must be at least 36 in high for a residential deck (R312.1.2). The baluster length is the guard height less the gap under the bottom rail and two 1.5 in rails (estimate for 2 × 4 rails laid flat). Posts are not increased by waste; rail boards and balusters carry the extra percentage you pick. Hardware (post brackets, hold-downs, screws and connectors) is not counted: the numbers depend on the connector and the framing and the maker’s instructions, so they come from the product you buy. Local code governs; some jurisdictions need a permit, a particular post connection or guards at lower heights. The metric toggle shows lengths in m and the openings and baluster widths in cm.
- International Residential Code (IRC), Section R312.1.2 Height: guards on open-sided walking surfaces at least 36 in above the adjacent walking surface; and R312.1.3 Opening limitations: a 4 in sphere must not pass through any opening up to the required guard height, with a larger limit on the open side of stair treads (section numbers and exceptions differ between editions)
- International Residential Code (IRC), Table R301.5 Minimum uniformly distributed live loads: guards and handrails must resist a single concentrated load of 200 lb at the top (the 2021 edition applies it to guards in the outward and downward directions)
- Guards, Handrails, and the 2021 IRC (JLC Deck Builder)
- Deck Guardrail Update (Simpson Strong-Tie Structural Engineering Blog)
- American Wood Council, DCA 6 Prescriptive Residential Wood Deck Construction Guide: guard post details (post connection and spacing for 4 × 4 posts; 6 ft is a typical maximum in connector makers’ guard post instructions)
- Building handout: Guardrail requirements (City of Bonney Lake, WA): 36 in guard height and the 4 in sphere
- ViewRail, 4 in sphere rule
- Nominal and actual lumber sizes (American Softwood Lumber Standard, PS 20): a 4 × 4 is 3.5 in, a 2 × 4 is 1.5 × 3.5 in and a 2 × 2 is 1.5 in square
How to calculate deck railing
- Measure each run. Measure every side that needs a guard from post centre to post centre, up to four, and note any stair or gate openings.
- Split into bays. Take the openings out, then divide each stretch into the fewest equal bays no longer than the post spacing, 6 ft at most for typical wood 4 × 4 posts. Posts are bays + 1 per stretch, less one for each corner shared.
- Cut the rails. Each bay takes a top and a bottom rail the length of the bay. Pack the pieces onto stock boards, longest first.
- Space the balusters. For each bay, take the clear span between the posts and find the fewest balusters that leave every gap under 4 in, then divide the space equally.
- Check the code. The guard needs to be at least 36 in high, stop a 4 in sphere, including under the bottom rail, and resist a 200 lb load at the top. Check your local code and the post connection.
Worked examples
| Project | Result |
|---|---|
| 20 ft side with a 3 ft stair opening plus a 12 ft side, joined, 36 in guard, 6 ft posts, 2 × 2 balusters, 12 ft rail boards | 29 ft of railing → 7 rail boards (12 ft), 8 posts, 12 rail pieces, 59 balusters |
| The same railing with the corner posts counted for each run (separate runs) | 29 ft of railing → 7 rail boards (12 ft), 9 posts, 59 balusters |
| The same railing with 3/4 in square metal balusters | 29 ft of railing → 7 rail boards (12 ft), 8 posts, 72 balusters |
| The same railing with posts at 5 ft at most | 29 ft of railing → 7 rail boards (12 ft), 9 posts, 59 balusters |
| A straight 24 ft run with no opening | 24 ft of railing → 5 rail boards (12 ft), 5 posts, 51 balusters |
| Three sides of 16, 12 and 16 ft, joined, no openings, 10% extra | 44 ft of railing → 9 rail boards (12 ft), 9 posts, 99 balusters |
Frequently asked questions
- How far apart should deck railing posts be?
- For wood 4 × 4 posts, 6 ft on center is the typical maximum: it is the figure in connector makers’ guard post instructions and in many deck handouts. It is not written into the IRC, which asks the guard as a whole to resist a 200 lb concentrated load at the top (Table R301.5) and leaves the post size, spacing and connection to the design. Closer posts (4 to 5 ft) make a stiffer guard. The calculator treats the spacing as a maximum and splits each stretch into equal bays.
- What load must a deck railing resist?
- A single concentrated load of 200 lb at the top of the guard, in addition to the loads on the infill (IRC Table R301.5). The 2021 IRC applies the 200 lb to guards in the outward and downward directions; earlier editions say any direction. The post connection to the deck framing is usually the weak point, so follow a tested detail, such as those in the AWC DCA 6 deck guide or the connector maker’s instructions, and ask your building department which one it accepts.
- How high must a deck railing be?
- At least 36 in above the deck surface for a residential deck under the IRC (R312.1.2). Some jurisdictions require 42 in, and guards on stairs are measured from the line of the tread nosings and can differ. The calculator flags a guard under 36 in, but local code governs.
- What is the 4 inch sphere rule?
- No opening in the guard may let a 4 in sphere pass (IRC R312.1.3). That covers the space between balusters, between a baluster and a post, and the gap under the bottom rail, so keep that gap under 4 in. On the open side of stair treads the limit is 4 3/8 in. This calculator keeps the gap strictly under the largest gap allowed: in a 51 in bay between 4 × 4 posts it puts 8 2 × 2 balusters with gaps of 3.94 in.
- How many balusters do I need?
- Work each bay: the clear span between posts is the bay length less the 3.5 in post, and the balusters are the fewest that leave every gap under 4 in. The example above has 6 bays and needs 56 2 × 2 balusters, 59 with 5% spares. With 3/4 in square metal bars the same railing needs 68.
- How are the rails cut and counted?
- Every bay has a top rail and a bottom rail, each the length of the bay, so the example has 12 pieces. They are packed onto stock boards longest first: with 12 ft boards the cut list is 2 × 72 in + 72 in; 4 × 51 in + 51 in, 6 boards, 7 with 5% extra. The same railing needs 12 boards of 8 ft, so the board length you buy matters. This does not model a rail that runs over a post in one piece or a cap rail.
- How do I enter a stair or gate opening?
- Put the side with the opening first, enter how many openings and how wide each is, and the calculator takes them out of run 1 and puts a post each side. In the example a 3 ft opening in the 20 ft side leaves 17 ft in two stretches, 8 posts in all. With no opening the same railing is 32 ft and 7 posts. An opening at the end of a run needs one post fewer than the calculator counts.
- Do posts at corners count once or twice?
- Once. Runs joined end to end share the corner post, so the 20 ft and 12 ft sides of the example have 8 posts rather than 9. Choose Separate runs for guards that do not meet.
- Does it count brackets, screws and post caps?
- No. Hardware depends on the post connection you use (a hold-down, a bracket or a bolted detail), the framing and the maker’s instructions, and no single count holds for all of them, so the calculator leaves it to the product. Count the connectors from the instructions of the one you buy.
Handy tools
- Stair Calculator: The guard along the stairs follows the stair’s rise and run: work out the steps first, then the opening you enter above.
- Feet and Inches Calculator: Add up a side measured in feet, inches and fractions, and get the decimal feet for the length fields above.