ThisCalculator

Everyday

Deck Picket Calculator: Spacing & Materials

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

A deck picket calculator works out how many pickets (balusters) you need for a railing and the exact spacing between them, based on the total railing length, picket width, and the maximum gap allowed by local building codes. You enter those three numbers and it returns the number of pickets, the number of gaps, and the precise on-center spacing. This article explains the formula, gives a worked example, and covers the common mistakes that lead to uneven or code-violating railings.

Formula

The core formula for evenly spaced pickets is:

Number of pickets (n) = ⌈(L × 12) / (w + g)⌉ + 1

On-center spacing (s) = (L × 12) / (n − 1)

Actual gap = s − w

Where:

  • L = total railing length in feet (convert to inches by multiplying by 12)
  • w = width of one picket in inches
  • g = maximum allowed gap in inches (typically 4 inches in most U.S. codes)
  • n = number of pickets (always an integer)
  • s = on-center spacing, the distance from the center of one picket to the center of the next

The ceiling function ⌈⌉ rounds up to the next whole number, ensuring the gap never exceeds the limit. The +1 accounts for the fact that the number of gaps is one less than the number of pickets.

Worked Example

Using the default values from the calculator:

  • Railing length (L) = 12 ft → 144 inches
  • Picket width (w) = 1.5 inches
  • Max gap (g) = 4 inches

Step 1: Calculate the minimum number of pickets:

n = ⌈144 / (1.5 + 4)⌉ + 1 = ⌈144 / 5.5⌉ + 1 = ⌈26.18⌉ + 1 = 27 + 1 = 28 pickets

Step 2: Find the on-center spacing:

s = 144 / (28 − 1) = 144 / 27 = 5.33 inches

Step 3: Actual gap between pickets:

gap = 5.33 − 1.5 = 3.83 inches

So with 28 pickets, the gap is 3.83 inches, which is under the 4-inch limit. The calculator shows the same result.

How to Use the Calculator

Measure the total length of the railing from one post to the other, not including the posts themselves. Enter that in feet. Measure the actual width of one picket—common sizes are 1.5 inches for 2×2 lumber, but some are 1.75 or 2 inches. Enter the maximum gap allowed by your local building code; 4 inches is the most common for residential decks, but some areas require 3.5 inches or even 3 inches for commercial projects. Click calculate and you get the number of pickets to buy, the on-center spacing to mark, and the actual gap.

Why the 4-Inch Rule Matters

The 4-inch gap rule is not arbitrary—it is designed to prevent small children from getting their heads stuck between pickets. A child’s head is typically larger than 4 inches in diameter, so a gap of 4 inches or less prevents entrapment. Many local codes adopt the International Residential Code (IRC) which specifies that the space between balusters must not allow a 4-inch sphere to pass through. Always check your local code, as some municipalities have stricter requirements, especially for decks over a certain height.

Common Mistakes and How to Avoid Them

  • Forgetting to convert feet to inches: The formula requires all units in inches. If you enter feet directly, you’ll get absurdly small numbers.
  • Measuring between posts instead of total length: The railing length is the distance between the inside faces of the end posts. If you measure outside-to-outside, you’ll end up with extra pickets.
  • Using on-center spacing as the gap: On-center spacing is measured from the center of one picket to the center of the next. The actual gap is that minus the picket width. Many DIYers mark on-center spacing but then measure the gap and find it’s too small.
  • Rounding down the number of pickets: Always round up. If you round down, the gap will exceed the limit.
  • Not accounting for angled or curved railings: The formula assumes a straight, horizontal railing. For stairs or angled sections, the length along the slope must be used, and the pickets are typically installed vertically, so the horizontal spacing is what matters.

Spacing for Stairs and Angled Railings

For stair railings, the same formula applies but you must measure the length along the slope of the railing, not the horizontal run. The pickets are still installed vertically, so the gap is measured horizontally. In practice, you can measure the horizontal distance between posts and use that as the railing length, because the vertical pickets will be spaced evenly along the horizontal projection. However, if the railing is angled and you measure along the slope, you’ll get a larger number, and the horizontal gaps will be smaller than intended. The safest approach is to measure the horizontal distance for the calculation.

Alternatives to Traditional Pickets

If you’re not set on wood pickets, there are several alternatives:

  • Cable railing: Uses horizontal cables instead of vertical pickets. The spacing between cables is typically 3 inches, and the number of cables is determined by the railing height. This gives a modern, unobstructed view.
  • Glass panels: Tempered glass panels are mounted between posts. No pickets needed, but the glass must be properly supported and meet local wind load requirements.
  • Metal balusters: Often thinner than wood (1/2 inch or 5/8 inch), so you can space them further apart while still meeting the 4-inch gap rule. They come in various styles and are often more durable.
  • Composite pickets: Similar to wood but require less maintenance. They come in standard widths, so the same formula applies.

Each alternative has its own installation requirements, but the spacing calculation remains the same: the gap between any two vertical elements must not exceed the code limit.

Frequently Asked Questions

What is the standard gap between deck pickets?

The most common maximum gap is 4 inches, as specified by the International Residential Code. Some local codes may require 3.5 inches or 3 inches, especially for commercial buildings or decks over a certain height. Always check with your local building department before starting.

How many pickets do I need for a 12-foot railing?

Using the default values in the calculator (1.5-inch pickets, 4-inch max gap), you need 28 pickets. This gives an actual gap of 3.83 inches. If you use wider pickets or a larger max gap, you’ll need fewer.

What is on-center spacing?

On-center spacing is the distance from the center of one picket to the center of the next. It’s a common measurement in construction because it’s easier to mark consistently than edge-to-edge gaps. For a 12-foot railing with 28 pickets, the on-center spacing is 5.33 inches.

Can I space pickets wider than 4 inches if my deck is low to the ground?

No. The 4-inch gap rule applies regardless of deck height in most jurisdictions. The rule is about preventing children from getting stuck, and a child can be injured even on a low deck. Only a local code official can grant a variance, and that’s rare.

Do I need to include the posts in the picket count?

No. The pickets are installed between the posts. The posts themselves are structural and are not counted as pickets. The railing length should be the distance between the inside faces of the end posts.

What if my railing has a corner?

Treat each straight section separately. Measure each section between posts and calculate the pickets for each. At the corner, the pickets from each section meet at the post, so you don’t need an extra picket for the corner itself.

Related

Formula used
in L | Railing length | ft | 12 | 0
in w | Picket width | in | 1.5 | 0
in g | Max gap | in | 4 | 0
out n | Number of pickets | - | ceil(L * 12 / (w + g)) + 1 | 0
out s | On-center spacing | in | (L * 12) / (n - 1) | 2
out gap_actual | Actual gap | in | s - w | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.