One Bay at a time
Let L be the Clear Length, w the actual Member width, n the whole Member count and g the Gap. The engine uses millimeters internally, with floating point precision. It never accumulates rounded display values.
| End Members | Gaps | Equal Gap formula |
|---|---|---|
| None | n+1 | g = (L − nw) / (n+1) |
| One (left edge pinned) | n | g = (L − nw) / n |
| Both edges pinned | n−1 | g = (L − nw) / (n−1) |
Equal selects the feasible integer count whose Gap is nearest the target, then lists adjacent feasible counts. Min/Max Gap constraints restrict the available counts. A single exactly fitting Member has zero gaps. An impossible fit returns a reason.
Fixed gaps and a ripped last board
Fixed mode keeps the interior target and centers the remainder: n = floor((L+g)/(w+g)); End Gap = (L−nw−(n−1)g)/2. This symmetric comparison overrides Equal mode's edge pinning. Every actual Gap, including both ends, is checked against the limits.
The deck rip option instead preserves both outside edges. Count = ceil((L+g)/(w+g)); last width = L−(n−1)(w+g). A last width below the user-specified minimum, a negative remainder or more than 10,000 boards is rejected.
Running measurements and rounding
Member i starts at left End Gap + i × (w+g), with indices starting at zero. Center = left edge + actual Member width / 2. The final boundary mark equals L. Display values round to the nearest 1/16 inch or 1 mm; the last Member center is not the final boundary. Print SVG uses unrounded positions and absolute millimeters.
Posts, Runs and shared boundaries
Overall Length O is outside face to outside face. With Post width p and maximum clear Bay b, choose k = ceil((O−2p)/b) Bays. Actual Bay Clear Length is (O−(k+1)p)/k. Every interior Post is deducted. A Run's first local Post center is p/2 and its last is O−p/2.
Adjacent Runs and Gates share their boundary Post. Gate clear opening = leaf width + hinge Gap + latch Gap; the default two allowances are each 3/8 inch. Gates contain no fence Members or Rails. A Corner turns right 90 degrees around the preceding Post center, adds no Post, and needs a Run or Gate on both sides. Global running Post distances follow the centerline from the initial outside face. Closed-loop joins and intersections are not inferred.
Materials and bag yields
Installed Members are summed per Bay. Purchase Members = ceil(installed × (1+waste/100)). Rails are reported as a cut list, one Clear Length per Rail, with the selected Rails per Bay. Screw quantity = ceil(Members × Rails per Bay × 2 × (1+waste/100)). This connection convention is an estimate, not a fastener specification. Gate leaf and connection hardware are additional.
Post length = above-ground height + buried length. For circular holes and square Posts: concrete volume = Post count × (π × (hole diameter/2)² − Post width²) × buried length. The hole must exceed the Post diagonal. Convert cubic millimeters to cubic feet by dividing by 304.8³, divide by bag yield, then round up. The 50/60/80 lb options use approximate yields of 0.375/0.45/0.60 ft³ from the QUIKRETE No. 1101 data sheet. Check the actual mix label. Hole dimensions are supplied by the user; we do not select footing depth.
A worked check
72 inches minus 13 × 1.5 inches leaves 52.5 inches, divided among 14 equal gaps: 3.75 inches. The first center is 4.5 inches. The fence default has 40-foot and 24-foot Runs plus a four-foot Gate and a Corner: 10 Posts, eight Bays and 120 pickets. With two Rails per Bay and 10% allowance: 16 Rail cuts, 132 purchase pickets and 528 screws.
Assumptions and limits
Uniform rectangular Members; straight, parallel boundaries; level geometry; square Posts; clockwise right-angle Corners. No structural calculations, stair geometry, slopes, foundation-depth selection or code certification. Up to 50 input Segments or railing Bays, 500 Plan Bays, 10,000 Members per Bay, 50,000 Members per Plan, and 250 printed sheets per job. Length inputs are bounded at 10,000 m. Invalid inputs show errors and suppress the construction result.
Authorship and checking
The EvenGap editorial team builds these software tools. We do not claim professional engineering or inspection credentials. Formulas are covered by worked examples and property tests; browser tests check URL restoration and PDF geometry. Physical printer calibration and local construction acceptance must be checked separately. See the guard-opening guide for the scope of the four-inch rule.