Calculate Number of Gaps
Calculator for the number of gaps or intermediate pieces in a regular arrangement of spheres or similar objects in a surface or in a space. Gaps occur when adjacent pieces do not fit together seamlessly. Please specify the number of pieces in length and width, and in the case of a three-dimensional arrangement also in height. The number of gaps is calculated. The formula is (l-1)*(w-1) for one dimension or layer, or (l-1)*(w-1)*(h-1) for h≥2.

With 4 pieces in length and 3 in width, there are 6 gaps (red dots).

For this egg carton the length is 5, the width is 2. There are 4 elevations in between.
Gaps always occur when individual pieces don't fit together like puzzle pieces. This is of course the case for spheres or eggs from the examples. In the case of eggs, it is also desirable that the individual pieces don't touch each other, as this would increase their risk of breakage. Therefore, an egg carton isn't a perfect example of gaps, but the calculation still works, now counting on the number of elevations between the eggs, not gaps.
Rectangles and cuboids are the simplest objects for filling a surface or space without gaps, but they are by no means the only ones. But this isn't possible with many other objects. This calculation assumes that these objects, like the gaps between them, are arranged in a rectangular pattern. Theoretically, it should always be possible to arrange them this way. If necessary, you can use tools, such as the egg carton for the eggs.
When stacking, it can be advantageous for structural reasons to stagger the pieces rather than stacking them directly on top of each other. This calculation does not apply in that case, because this also changes the number of gaps.
Last updated on 01/24/2026. Author: Jürgen Kummer
German: Dimension | Vielfacher Inhalt | Verhältnis | Diagonalen | Flächeninhalt | Rauminhalt | Schneiden | Stapel | Gitter | Anordnung | Rand | Innen-Außen | Lagerung | Ausbreitung | Stufenpyramide
Retrieved on 2026-04-10 from https://rechneronline.de/dimension/gaps.php