Calculate how many deck pickets or balusters fit between posts with gaps under 4 inches, or the even gap and on-center spacing for a set number of pickets.
Deck Picket Formula
The calculator works in two modes. When you solve for the number of pickets that meet a maximum gap, it uses:
N = max(1, floor((L - G) / (W + G)) + 1)
Count mode selects the smallest whole count with a calculated gap strictly below the limit; an exact boundary requires one additional picket. When you solve for the gap from a fixed number of pickets, it uses:
S = (L - N * W) / (N + 1)
- N = number of pickets
- L = railing length between the posts, in inches
- W = face width of one picket, in inches
- G = maximum gap you allow between pickets, in inches
- S = the even gap that results between pickets, in inches
The two formulas above assume a gap at each end, between the end picket and the post, so the number of gaps is N + 1. The on-center spacing the calculator reports is simply the picket width plus one gap (W + S), which is the mark-to-mark distance you measure when laying out the rail. The advanced option lets you switch to a layout with a picket tight against each post, which changes the number of gaps to N - 1 and requires at least two pickets. In that arrangement the strict-limit count is max(2, floor((L + G)/(W + G)) + 1).
Picket Widths and Spacing Reference
Most deck pickets and balusters come in a few standard face widths. Use the actual measured width, not the nominal name, since a 2x2 measures 1.5 inches.
| Picket type | Actual face width |
|---|---|
| Square 2x2 wood baluster | 1.5 in |
| Round metal baluster | 0.5 to 0.75 in |
| Flat 1x2 picket | 1.5 in |
| Composite baluster | 1.4 to 1.6 in |
| Fence picket (3.5 in) | 3.5 in |
The gap, not the spacing, is what building inspectors check. The table below shows how the gap changes as you add pickets to a 6 foot (72 inch) rail section using 1.5 inch pickets with a gap at each end.
| Pickets | Gap between pickets | Calculated gap below 4 in |
|---|---|---|
| 10 | 5.18 in | No |
| 12 | 4.15 in | No |
| 13 | 3.75 in | Yes |
| 15 | 3.09 in | Yes |
Example Problems
Example 1. You have a railing section that is 72 inches between posts and you are using 1.5 inch square balusters. You want the gap to stay under the 4-inch code limit. Using floor((L - G)/(W + G)) + 1, you get floor(68/5.5) + 1 = 13 pickets. With 13 pickets and 14 gaps, the real gap is (72 - 19.5) / 14 = 3.75 inches, below 4 inches. Spacing alone does not establish a complete compliant guard.
Example 2. The same 72-inch section, but this time you already decided to use 15 pickets and want to know the gap. Using S = (L - N * W) / (N + 1), you get (72 - 22.5) / 16 = 3.09 inches per gap, with an on-center spacing of 4.59 inches.
Frequently Asked Questions
How far apart can deck pickets be? US residential code limits the gap to less than 4 inches so a 4-inch sphere cannot pass between pickets. This keeps small children from slipping through or getting stuck. Always confirm your local code, since some areas are stricter.
Should I measure to the gap or to the picket centers? Lay out the rail using on-center spacing, which is the picket width plus one gap. The calculator gives you both, so you can mark each picket center with a tape measure and still end up with the correct gap.
Do I count a gap at the ends of the rail? By default the calculator places a gap between the end picket and each post, which is the most common look and gives N + 1 gaps. If you want a picket tight against each post instead, switch the advanced option to change the layout to N - 1 gaps.
