Even Spacing Calculator | Equal Gap Layout Tool
Calculate even spacing with this free, precise online even spacing calculator. Perfect for determining uniform gaps, equal intervals, and symmetrical layouts across a line — whether you need evenly spaced holes, deck balusters, fence pickets, shelf pegs, wall studs, screws, or mounting anchors.
This automatic spacing generator supports metric and inch measurements with exact edge-to-edge, center-to-center, and on-center results. Ideal for construction, woodworking, metal fabrication, CAD, CNC manufacturing, and engineering projects.
From balanced picture hanging and square hole patterns to proportional divider panels, partition boards, slats, and linear fastener distribution — get accurate positions, dimensions, offsets, and a visual layout planner with position markout table—no math headaches. Just enter your total length, item count/width, and desired gap for consistent, professional results every time.
Even Spacing Calculator
Calculate equal gaps between fence posts, balusters, shelves, holes, and more. Metric and imperial support with visual layout preview and position markout list.
| # | Near Edge (from start) | Center (from start) | Far Edge (from start) | Gap Before | O/C Spacing |
|---|
ⓘ Results assume perfectly straight runs and uniform item widths. For construction, verify all measurements on-site before cutting. Fractional values are rounded to the selected precision — check for accumulated error on long runs.
Formulas Used in Calculations
Case 1: Equal End Gaps (Standard)
\[ S = \frac{L - (N \times W)}{N + 1} \]Where \(S\) = gap spacing, \(L\) = total length, \(N\) = number of items, \(W\) = item width. Produces \(N+1\) equal gaps (including both ends).
Case 2: Flush at Both Ends (Interior Gaps Only)
\[ S = \frac{L - (N \times W)}{N - 1} \]First and last items are placed at the very start and end. Only \(N-1\) interior gaps are created.
Case 3: Half-Gap at Ends
\[ S = \frac{L - (N \times W)}{N} \quad \Rightarrow \quad \text{End gap} = \frac{S}{2} \]Each end has half the gap of the interior spaces — common for tiling and panel layouts.
On-Center (O/C) Spacing
\[ O/C = S + W \]Distance from the center of one item to the center of the next. Essential for drilling pilot holes and stud layouts.
Position of k-th Item Center (Equal End Gaps, 0-indexed)
\[ P_k = S + \frac{W}{2} + k \cdot (S + W), \quad k = 0, 1, 2, \ldots, N-1 \]Running measurement from the start edge. Use these values to mark directly on your material.
Reverse: Number of Items from Desired Gap
\[ N = \left\lfloor \frac{L + S}{W + S} \right\rfloor \]Given a total length and desired gap, finds the maximum whole number of items that fit.
Related Calculators on SteelSolver.com
🔧 SteelSolver Engineering Tools & Guides — featuring 260+ free calculators and 60+ in-depth guides for engineers, fabricators, and metalworkers.
👉 Find the right tool or guide for your project:
📚 Explore All Engineering Hubs on SteelSolver.com
Even Spacing Calculator
Complete User Guide & Formula Reference
Everything you need to calculate equal gaps, uniform distances, and precise positions for fence posts, balusters, shelf brackets, CNC drill holes, wall panels, and any layout where evenly spaced objects matter.
What Is an Even Spacing Calculator?
The precision layout math tool for construction, woodworking, and engineering
An even spacing calculator is a free online math tool that automatically determines the uniform gap, center-to-center distance, and exact position of every object in a linear layout — eliminating the guesswork and accumulated rounding errors that plague manual measurement.
Whether you are a carpenter spacing deck balusters, a fabricator laying out CNC drill holes in a metal plate, a builder setting fence pickets, or a DIY homeowner hanging picture frames across a wall, this calculator solves the core “layout dilemma”: how do I distribute N objects across a fixed distance so that every gap between them is exactly equal?
The tool handles metric (millimeters, centimetres, metres) and imperial (inches, feet) units, outputs results as decimals or fractional inches (1/8″, 1/16″, 1/32″), and generates a full position markout table you can take directly to the job site — no tape measure re-measuring required.
Key User Pain Points — and How This Calculator Solves Them
Real frustrations from woodworkers, builders, engineers, and DIYers — and the precise solutions
The Accumulated Rounding Error
Manual division produces decimals like 4.583″. Each repeated measurement introduces a small error that compounds — making the final gap visibly larger or smaller than the others.
The calculator stores full floating-point precision internally and only rounds the display to your chosen fraction. The position markout table gives you every single running measurement from one end — so you only set your tape once.
“Post vs. Space” Confusion
Forgetting whether to divide by the number of objects or the number of spaces between them is the single most common spacing mistake in fence and railing work.
Three clearly labelled edge-treatment modes — Equal End Gaps, Flush at Both Ends, and Half-Gap at Ends — each use the correct divisor automatically. You choose the mode; the math is handled.
Building Code Compliance
Deck and stair railings in most jurisdictions (including Australia and North America) require that no gap exceeds 125 mm / 4″ — a safety constraint hard to hit precisely while keeping all spaces equal.
Enter your maximum allowed gap in the Safety Max Gap field. If your calculated gap exceeds it, an instant warning shows the minimum number of balusters needed to comply.
Fractional Inch Readability
A result of 17.34375″ is meaningless on a standard tape measure. Finding 17 11/32″ is slow and error-prone in the field.
Select your precision — nearest 1/8″, 1/16″, or 1/32″ — and every output value is instantly expressed in the fraction format your tape measure actually shows.
Unit Confusion (Metric vs Imperial)
Mixing millimetres with inches — or working in a country like Australia that uses metric while referencing imperial CAD drawings — produces dangerous conversion errors on CNC and fabrication jobs.
A single unit toggle (mm / cm / m / in / ft) applies to all inputs and outputs simultaneously. No manual conversion required; switch units at any time without re-entering values.
No Visual Feedback
Staring at a column of numbers makes it almost impossible to spot a layout mistake before cutting or drilling.
An auto-generated SVG layout diagram updates instantly with every calculation, showing every object, gap, dimension line, and end margin to scale. Export to PDF or print directly from the page.
Visual Spacing Layout Diagram
Anatomy of an evenly spaced layout — all key measurements labelled
The diagram below shows a 5-item linear layout with equal end gaps (the most common configuration). Study it before entering your measurements to make sure you are targeting the correct dimension.
Step-by-Step User Guide
How to use the Even Spacing Calculator from start to finish
Choose Your Calculation Mode
Three solve-for modes let you approach the problem from any direction. Select the one that matches what you already know:
• Find Gap Size — You know the total length and number of items; the calculator finds the gap. Most common for baluster, fence, and shelf layouts.
• Find Item Count — You know the total length and your desired gap; the calculator finds how many items fit. Common for spacing screws, pegs, or anchors at a fixed interval.
• Find Total Length — You know the item count and desired gap; the calculator finds the required span. Useful when planning a wall, panel, or partition from scratch.
Select a Quick Preset (Optional)
Five industry-specific presets pre-fill all inputs for the most common layout scenarios: Deck Balusters (1.5″ wide, 8 ft run), Fence Pickets (3.5″ wide), Shelf Brackets, CNC Bolt Holes (metric, mm), and Wall Studs (flush-end mode). Presets are a starting point — adjust any field to match your specific dimensions.
Choose Your Unit System
Select Inches, Feet, Millimeters (mm), Centimetres (cm), or Metres (m) before entering any values. The unit hint labels on each input field update automatically. All inputs and all outputs use the same unit consistently — no mixed-unit errors are possible.
Tip for Australian and metric users: mm is the most common unit in fabrication, CNC, and engineering drawings. For fence or deck work in Australia, mm or cm is preferred.
Enter Total Length / Span
Measure the full distance between the two fixed boundary points — for example, the inside face of one post to the inside face of the other, or the inner edge of a frame opening. Enter this value in the Total Length field. Include fractions as a decimal (e.g., 96.5 for 96½″).
⚠ Common mistake: Measuring from the outside face of one post to the outside face of the other. This adds two post thicknesses to your span and will produce incorrect gaps. Always measure to the inner boundary your objects will sit within.
Enter Number of Items and Item Width
Number of Items is the count of objects to be distributed — balusters, pickets, boards, slats, pegs, holes, anchors, or any repeated element. Enter a whole number.
Item Width / Thickness is the physical dimension of each object in the same unit as the span. For a 2×4 stud, this is 1.5″ (actual size, not nominal). For a drilled hole used as a centerline reference, enter 0.
Choose Edge / End Treatment
This setting controls what happens at the two ends of your span. Select the mode that matches your design intent:
• Equal End Gaps — The space at each end equals the interior gap. Produces the most balanced, symmetrical appearance.
• Flush at Both Ends — First and last item sit hard against the boundary. Only interior gaps exist. Common for studs, joists, and flush-mounted panels.
• Half-Gap at Ends — Each end carries half the interior gap. Common in tiling, flooring, and decorative slat work for a centered, proportional look.
Set Maximum Allowed Gap (Safety / Code Check)
If your project must comply with a building code maximum gap — such as the 4″ (100 mm) sphere rule for deck railings in North America, or 125 mm in Australian NCC — enter that value in the Max Allowed Gap field. If your result exceeds the limit, a warning banner will appear showing the minimum number of items required to comply while maintaining perfectly equal spacing.
Choose Output Precision
Select how gap and position values are displayed:
• Decimal (2 or 3 places) — Best for metric (mm) and CAD / CNC coordinate output.
• Nearest 1/8″, 1/16″, 1/32″ — Best for imperial carpentry and on-site measurement with a standard tape measure.
Select Material Waste Factor
Choose None for an exact count, +10% (recommended) or +15% to account for material waste, damaged pieces, or offcuts. The “Total Items to Order” output rounds up to the nearest whole number automatically.
Click “Calculate Spacing” and Read Your Results
The results panel shows six key metrics: Clear Gap, On-Center (O/C) spacing, Number of Items, Total Items to Order (with waste), Total Span, and Total Item Width. Below the metrics, an SVG layout diagram shows your layout to scale. The Position Markout Table lists the near-edge, centre, and far-edge position of every single item from the start boundary — the most valuable output for drilling, cutting, and mounting.
Export, Copy, or Print Your Results
Three export options are available after calculation:
• Copy All Results — Copies a formatted plain-text summary (including the full markout table) to your clipboard for pasting into a job sheet, email, or spreadsheet.
• Export CSV — Downloads a comma-separated file with all position coordinates — ready to import into AutoCAD, SolidWorks, Fusion 360, or any CNC / CAD system.
• Print Layout — Generates a clean print view with the diagram and markout table only (UI chrome is hidden).
Input Parameters, Units & Validation Guide
What each field means, which units to use, and how to validate your entries
| Parameter | Accepted Units | Valid Range | Notes & Common Mistakes |
|---|---|---|---|
| Total Length / Span (L) | in ft mm cm m | Any positive number; must exceed N × W | Measure between the two fixed inner boundaries. Decimal entry for fractions (e.g., 96.5 for 96½″). |
| Number of Items (N) | Whole integer only | ≥ 1 (≥ 2 for Flush mode) | Counts objects, not gaps. For 5 balusters there are 6 gaps (equal-end mode) or 4 gaps (flush mode). |
| Item Width / Thickness (W) | Same as Total Length unit | ≥ 0; sum N×W must be < L | Use the actual (not nominal) dimension. A “2×4″ stud is actually 1.5″. Enter 0 for hole centerlines or point fasteners. |
| Desired Gap (S) | Same as Total Length unit | > 0 | Visible only in “Find Count” and “Find Length” modes. This is the clear air gap, not the on-center distance. |
| Max Allowed Gap | Same as Total Length unit | Optional; any positive number | Leave blank to skip the code-compliance check. Common values: 4″ / 100 mm (deck railings), 125 mm (Australian NCC balustrades), 6″ (stair balusters in some jurisdictions). |
| Edge Treatment | — | One of three modes (see below) | Defines how the two end spaces relate to interior gaps. This changes which divisor the formula uses. See the Edge Treatment Mode table. |
| Output Precision | — | Decimal 2dp / 3dp or 1/8″ / 1/16″ / 1/32″ | Fractional modes are only meaningful for imperial (inch) inputs. For metric mm, use decimal 2dp or 3dp. |
Edge Treatment Modes — Quick Reference
| Mode | End Gap | Number of Gap Spaces | Formula Divisor | Best For |
|---|---|---|---|---|
| Equal End Gaps | = Interior Gap (S) | N + 1 | N + 1 | Deck balusters, fence pickets, shelf dividers, picture frames |
| Flush at Both Ends | 0 (items touch boundary) | N − 1 | N − 1 | Wall studs, joists, framing members, flush-mounted panels |
| Half-Gap at Ends | = S / 2 | N | N | Tiles, flooring boards, decorative slats, LED strip dividers |
Formulas Used in the Even Spacing Calculator
All six equations with variable definitions, worked notes, and when to apply each
Every result this calculator produces is derived from one or more of the following formulas. Understanding them helps you spot input errors and trust your output.
Formula 1 — Clear Gap (Equal End Gaps)
This is the standard “baluster formula” used for deck railings, fence pickets, shelf dividers, and any layout where both ends should have the same space as the interior gaps.
Divisor is N + 1 because equal-end mode creates N + 1 gap spaces (including both ends).
S = (96 − 10 × 1.5) ÷ (10 + 1) = (96 − 15) ÷ 11 = 81 ÷ 11 = 7.36″ clear gap
Formula 2 — Clear Gap (Flush at Both Ends)
Used when the first and last item sit hard against the boundary (no end gap). Only the spaces between items are calculated. Common for structural framing, stud walls, and flush-mounted dividers.
Formula 3 — Clear Gap (Half-Gap at Ends)
Each end carries exactly half the interior gap. The divisor is simply N. Commonly used for tiling, decking boards, panel systems, and proportional planner layouts.
Formula 4 — On-Center (O/C) Spacing
On-center distance is what you mark on the material when drilling holes, fixing fasteners, or setting CNC coordinates. It is the center-to-center distance between adjacent items.
Formula 5 — Position of the k-th Item Centre (Markout)
The position markout table uses this formula to calculate where every item’s centre falls, measured from the start boundary. These are the measurements you transfer to your material with a pencil or marking knife.
Near-edge position = Pk − W/2 | Far-edge position = Pk + W/2
Formula 6 — Reverse: Find Maximum Item Count from Desired Gap
Used in Find Count mode. Given a total span and desired gap, this formula determines the highest whole number of items that produce a gap equal to or greater than the target.
The actual gap may differ slightly from S due to rounding — the calculator re-runs Formula 1 using this N to display the exact resulting gap.
Formula 7 — Required Total Length from Count and Gap
Used in Find Total Length mode — for example, when planning how long a panel, partition, or fence run needs to be to accommodate N items at gap S with equal end gaps.
Common Mistakes & Microcopy Guidance
The most frequent input errors and how to avoid them
Use Cases by Industry
How different trades use even spacing calculation across construction, manufacturing, and design
| Industry / Trade | Typical Objects Spaced | Common Units | Edge Mode | Key Concern |
|---|---|---|---|---|
| Deck & Railing | Balusters, spindles, posts | Inches | Equal End Gaps | Max 4″ gap (building code) |
| Fencing | Pickets, slats, boards | Inches / mm | Equal End Gaps | Uniform appearance; privacy vs. airflow ratio |
| Woodworking / Shelving | Shelf brackets, pegs, dowels, holes | Inches / mm | Equal End Gaps | Symmetrical distribution; load balance |
| CNC & Metal Fabrication | Drilled holes, slots, perforations, fastener patterns | mm | Equal or Flush | Coordinate accuracy for CAD / G-code |
| Construction Framing | Studs, joists, rafters | Inches | Flush at Both Ends | Standard 16″ or 24″ O/C code requirements |
| Interior Design / DIY | Picture frames, hooks, wall art, mounting brackets | Inches / cm | Equal End Gaps | Symmetrical gallery wall appearance |
| Tiling & Flooring | Floor tiles, wall panels, grout rows | mm / cm | Half-Gap at Ends | Centred layout; balanced cuts at edges |
| Engineering & Manufacturing | Bolt circles, flange holes, row spacing on plates | mm | Equal or Flush | Structural integrity; tolerance compliance |
| Electrical / Cable | Cable tray hangers, conduit supports, anchors | mm / inches | Equal End Gaps | Code-compliant support spacing |
A Note on Calculation Accuracy
All calculations use 64-bit floating-point arithmetic throughout, rounding only at the final display stage. This means intermediate values retain full precision and position coordinates accumulate no rounding error between steps.
However, the displayed fractional values (e.g., 7 5/16″) are rounded to the nearest selected fraction. On long runs with many items, the difference between the displayed fraction and the true decimal can accumulate to a visible discrepancy at the final gap. The calculator addresses this by always working from the running total position, not by adding repeated rounded intervals.
Always verify critical dimensions on-site before making irreversible cuts or drilling. This tool is a planning and layout aid; it does not replace the judgment of a qualified tradesperson or structural engineer.
Frequently Asked Questions
Answers to the most common even spacing questions from woodworkers, builders, and engineers
What is the difference between clear gap and on-center spacing?
Clear gap (also called edge-to-edge spacing) is the actual empty air space between two adjacent items — what you would physically measure with a ruler placed inside the opening.
On-center (O/C) spacing is the distance from the centre of one item to the centre of the next, and equals Gap + Item Width. For a 1.5″ baluster with a 4″ clear gap, O/C = 5.5″.
When drilling holes or marking stud positions, always use O/C measurements, because you are marking the centre of each item, not the edge of the gap.
How do I space fence pickets evenly across a panel?
Measure the clear inside span of the fence panel (between the two rail posts, not including the posts themselves). Enter this as Total Length. Enter the actual width of one picket as Item Width. Count how many pickets you plan to use — or use Find Count mode to let the calculator suggest the number based on your desired gap. Select Equal End Gaps so the spaces at each end of the panel match the interior gaps.
For privacy fencing, a gap of 0–10 mm is typical. For decorative or semi-privacy fences, 20–50 mm is common. Use the Max Allowed Gap field to enforce any local fencing bylaws.
What maximum gap is required for deck balusters in Australia?
Under the National Construction Code (NCC) of Australia, the maximum gap between balustrade infill elements (balusters, pickets, or panels) for decks, balconies, and stairs is 125 mm (to prevent a 125 mm sphere from passing through). This applies to areas accessible to children under 6 years of age.
Enter 125 in the Max Allowed Gap field when the unit is set to mm, and the calculator will warn you if your calculated gap exceeds this limit and show the minimum baluster count needed to comply.
Can I use this calculator for CNC drill hole spacing in metric?
Yes. Set the unit to mm, enter Item Width as the drill hole diameter (or 0 if you only need centre-to-centre coordinates), and select Decimal 3dp precision. The Position Markout Table will give you the X-axis coordinate of each hole’s centre measured from the start reference edge — exactly the format needed for CNC G-code setup sheets or CAD coordinate entry.
Use the Export CSV button to download a file that can be imported directly into AutoCAD, SolidWorks, or Fusion 360 as a drill pattern.
How do I calculate even spacing between picture frames on a wall?
Measure the total wall length (or the section of wall you want to fill). Enter each frame’s width as Item Width — if all frames are the same size, this is straightforward. Choose the number of frames (or use Find Count mode with a desired gap). Select Equal End Gaps for a symmetrical gallery wall.
The Position Markout Table will tell you exactly where to place each frame’s near edge, centre, and far edge. Mark the centre position on the wall at the correct height, and hang each frame from that mark using your hardware’s specified offset.
Note: For frames of different widths, calculate each grouping separately or treat the group as one wide “item” and space the groups evenly.
Does this calculator work for Minecraft building layouts?
Yes! In Minecraft, all blocks are exactly 1 unit wide, so enter 1 as Item Width and set the unit to any label (the unit label is cosmetic — the math is the same). Enter the total span in blocks and the number of items (posts, pillars, windows, or decorative blocks) to get the gap in whole blocks.
Because Minecraft requires whole-block placement, the precision setting doesn’t matter — just round the resulting gap to the nearest integer and adjust your item count by 1 if needed until you get a whole-number gap. The “Find Count” mode is especially useful for Minecraft because it automatically finds the item count that produces the closest whole-number gap for a given span.
What is the formula for spacing holes evenly across a metal plate?
For a perforation or drilling pattern with equal end margins, the formula is:
Gap = (Total Length − N × Hole Diameter) ÷ (N + 1)
Where N is the number of holes and “Hole Diameter” is the Item Width. If you are spacing centrelines only (no diameter consideration), set Item Width to 0, and the formula simplifies to:
Gap = Total Length ÷ (N + 1)
The On-Center distance between hole centres equals Gap + Hole Diameter.
Can I export the results for use in a spreadsheet or CAD program?
Yes. After calculating, use the Export CSV button to download a comma-separated values file containing all item positions (near edge, centre, far edge, gap, O/C) to four decimal places. This file can be opened in Microsoft Excel, Google Sheets, LibreOffice Calc, or imported as XY coordinates in AutoCAD using the “Multiple Points” command. For Fusion 360 or SolidWorks, use the centre-column coordinates as the XY origin of each hole feature in a sketch-driven pattern.
Why does my first or last gap look slightly different on site?
This almost always happens for one of three reasons:
- You measured the span incorrectly (outside-to-outside instead of inside-to-inside, or off by the thickness of a post).
- Your item widths are not perfectly consistent — slight manufacturing variation in deck boards or balusters adds up across many items.
- You transferred positions by adding repeated rounded fractions rather than measuring each position from the same start point. Always use the cumulative running position from the markout table, and always set your tape from the same fixed reference edge.
Is this calculator free? Does it work on mobile?
Yes — the Even Spacing Calculator on SteelSolver.com is completely free to use with no login, registration, or subscription required. It is fully responsive and optimised for touch screens, with large tap targets, mobile-first input fields, and an SVG diagram that scales to any screen width. It works offline once the page has loaded, making it useful on construction sites or in workshops with limited internet access.
Ready to Calculate Your Spacing?
Use the free Even Spacing Calculator above to instantly determine uniform gaps, on-center measurements, and a full position markout table for any layout — no math required.
Open Even Spacing Calculator →