Equal Spacing Calculator: Find Even Gaps Between Items
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.
An equal spacing calculator finds the same gap between a row of items, or between items placed along a line. Enter the total length, the number of items, and either the item width or the end margins; the calculator returns the gap size and, when useful, the distance from one item’s start to the next.
Formula
For n equal-width items distributed across a total length L, with an equal gap before the first item, between every pair, and after the last item, the gap is:
g = (L − n × w) ÷ (n + 1)
- L is the total available length, in any consistent unit.
- n is the number of items, counted as a whole number.
- w is the width of each item, in the same unit as L.
- g is each clear gap, including the two end margins, in the same unit.
The center-to-center distance is c = w + g. If the items must start and end at the boundaries, with no end margins, there are only n − 1 gaps, so the edge gap is e = (L − n × w) ÷ (n − 1). These are different layout conventions; choose the one that matches the actual design.
Worked Example
Using the calculator’s default values, the total length is 100 units, there are 5 items, and each item is 10 units wide.
- Find the length occupied by the items: 5 × 10 = 50 units.
- Subtract that from the total: 100 − 50 = 50 units remain for gaps.
- With equal end margins, there are 5 + 1 = 6 gaps. Divide: 50 ÷ 6 = 8.333… units, which rounds to 8.33 units per gap.
- Center-to-center spacing is 10 + 8.333… = 18.333… units, or 18.33 units.
- With no end margins, there are 5 − 1 = 4 gaps: 50 ÷ 4 = 12.50 units between adjacent item edges.
How to Choose the Right Spacing
Start by deciding what “evenly spaced” means for your layout. In a shelf, a row of pictures, or a series of holes, you may want the same clear distance between neighboring edges. In a design that should be balanced within a fixed boundary, you may also want the left and right margins to match the spaces between items. That is the equal-end-margin formula used for the main result above.
- Equal spaces including margins: Use (L − n × w) ÷ (n + 1). This creates one gap on each end plus one between each neighboring pair.
- Items anchored at both ends: Use (L − n × w) ÷ (n − 1). The first and last items touch the boundaries, leaving only interior gaps.
- Known center positions: Use the center-to-center result, w + g, when marking a repeating pitch or locating item centers.
For example, five 10-unit-wide panels in a 100-unit opening leave 50 units after accounting for the panels. If the end margins match the interior spaces, each of six spaces is 8.33 units. If the first and last panels sit at the boundaries, the four internal spaces are 12.5 units instead. Neither answer is universally “more equal”; they answer different boundary conditions.
When to Use It and How to Measure
This calculation applies to items with consistent width arranged in a straight line or along a measured span. It can help plan picture frames, fence posts, tiles, buttons, shelving, or evenly pitched marks. The same arithmetic works in inches, feet, millimeters, centimeters, or meters. The calculator uses generic units so you can choose the measurement system that suits the job.
Measure the usable span between the boundaries that define the layout, rather than the overall size of a surrounding object if some of that space is obstructed. Measure each item’s width along the same direction as the span. If dimensions are mixed, convert them first: for example, 2 feet is 24 inches, so it can be combined with a span measured in inches. Keep unrounded values for calculations and round only the final spacing to a precision you can mark or build accurately.
Common Errors and Limits
- Counting gaps incorrectly: With equal margins at both ends, n items create n + 1 gaps. When the outer items are fixed at the boundaries, there are n − 1 interior gaps.
- Forgetting item width: Dividing the full span by the number of gaps is wrong when the items occupy space. Subtract the combined item widths first.
- Mixing units: Do not subtract a width in centimeters from a total in inches without conversion.
- Rounding too early: Small rounding errors can accumulate over a long row. Keep the calculated value until you transfer the marks.
- Using the wrong item count: The input is the number of objects, not the number of spaces or center marks.
The formula assumes the items have equal widths, the span is straight, and the available length is measured accurately. It does not account for irregular shapes, curved paths, installation tolerances, obstructions, or a requirement to use only whole-number measurements. If the result is negative, the items are too wide to fit in the stated span. If there is one item, the equal-end-margin formula still works, but the no-end-margin formula has no meaningful interior gap because it divides by zero; for one centered item, place it by its center rather than using an adjacent-item spacing.
Frequently Asked Questions
How do I space items evenly with equal gaps at both ends?
Subtract the combined item width from the total length, then divide the remainder by the number of items plus one: g = (L − n × w) ÷ (n + 1).
How do I space objects evenly between two endpoints?
If the first and last objects are at the endpoints, subtract their total width from the span and divide by n − 1. This gives the clear distance between neighboring object edges.
Is equal gap the same as equal center-to-center distance?
Not exactly. For equal-width items, center-to-center distance equals the clear edge gap plus one item width. If widths differ, equal clear gaps do not produce equal center-to-center distances.
What if the calculator gives a negative gap?
The total length is smaller than the combined width of the items. Increase the span, reduce the item count, or use narrower items; a negative result cannot be used as a physical gap.
Can I use this for objects of different widths?
Not with the equal-width formula as written. Add the individual widths to find their total occupied length, then divide the leftover length by the chosen number of gaps. For equal end margins and gaps, divide by n + 1; for fixed endpoints, divide by n − 1 when there are at least two objects.
Related
Formula used
in L | Total length | units | 100 | 0 in n | Number of items | - | 5 | 1 in w | Width of each item | units | 10 | 0 out g | Equal gap, including end margins | units | (L - n * w) / (n + 1) | 2 out c | Center-to-center spacing | units | w + g | 2 out e | Edge gap with no end margins | units | (L - n * w) / (n - 1) | 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.