Circle Packing Calculator

Compare heuristic packing strategies, measure efficiency, animate layouts, and drag circles inside geometric containers.

Results are calculated automatically as you enter data.

Packing controls

Packing workspace

Choose a strategy to generate a packing.

Select a circle, then use the arrow keys to move it. Hold Shift for a larger movement.

Efficiency metrics

Strategy comparison

▼ See explanations and tips below ▼

What Is Circle Packing?

Circle packing is the problem of arranging circles so that they fit inside a boundary without overlapping. In this calculator, the circles all have the same radius, and the boundary can be a rectangle, a circle, or a regular polygon.

The main question is simple: how many equal circles can the selected strategy place, and how much of the available area do they cover? The answer depends on the circle radius, the container shape, the chosen arrangement pattern, and the way the boundary cuts through the pattern.

Packing efficiency measures the part of the container area covered by the circles. A higher efficiency means less empty space between and around the circles. A lower efficiency means more unused area, even if the circles are all placed correctly.

Circle packing appears in many practical settings: arranging round parts on a sheet, planning holes or cutouts, estimating product layouts, comparing packaging patterns, studying geometry, or checking whether a visual design uses space effectively.


Why Circle Packing and Packing Efficiency Matter

Circle packing matters because circles do not tile a flat surface without gaps. Unlike squares or rectangles, equal circles always leave some empty space between them when placed in a plane. The layout you choose controls how large those gaps are.

For a student, circle packing is a useful way to connect geometry, area formulas, coordinates, and optimization. For a designer or planner, it can give a quick estimate of material use, waste, and arrangement quality. For engineering or manufacturing work, it can help with early layout thinking, although final designs still need real tolerances, clearances, and professional checks.

The important point is that "fits" and "efficient" are different ideas. A layout may fit every circle without overlap but still waste a lot of area. Another layout may cover more area but be harder to use in a real process because of edge spacing, tooling limits, or material constraints.


Key Terms to Know

  • Circle radius: The distance from the center of a circle to its edge. The diameter is twice the radius, so a radius of \(10\) means a diameter of \(20\).
  • Container: The boundary that the circles must fit inside, such as a rectangle, circle, or regular polygon.
  • Packing: An arrangement of circles that avoids overlap and keeps the circles inside the container.
  • Packing efficiency: The percentage of the container area covered by the placed circles.
  • Unused area or waste: The remaining percentage of the container area not covered by circles.
  • Square grid packing: A layout with circle centers aligned in rows and columns.
  • Hexagonal packing: A staggered-row layout where every other row is offset. In large, open plane regions, this is the densest possible equal-circle packing pattern.
  • Spiral search: A heuristic placement method that tests candidate points outward from the center in a spiral-like order.
  • Ring search: A heuristic placement method that tests a center circle and circular rings around it, especially useful for circular containers.
  • Collision: An invalid condition where circles overlap each other or extend outside the container boundary.
  • Heuristic: A practical method that tries to find a good arrangement but does not prove that the result is globally optimal.

How Circle Packing and Packing Efficiency Work

The basic geometry starts with the area of one circle. If every circle has radius \(r\), the area of one circle is:

$$ A_{\text{circle}} = \pi r^2 $$

If \(n\) circles are successfully placed, the total covered area is:

$$ A_{\text{covered}} = n\pi r^2 $$

Packing efficiency compares the covered area with the container area:

$$ \text{efficiency} = \frac{n\pi r^2}{A_{\text{container}}} \times 100\% $$

The unused area percentage is the part that remains:

$$ \text{unused area} = \max\left(0, 1 - \frac{n\pi r^2}{A_{\text{container}}}\right) \times 100\% $$

The container area depends on the selected shape.

For a rectangle with width \(w\) and height \(h\):

$$ A_{\text{rectangle}} = wh $$

For a circular container, enter the container diameter \(D\). The container radius is:

$$ R = \frac{D}{2} $$

So the circular container area is:

$$ A_{\text{circular container}} = \pi R^2 $$

For a regular polygon container with \(m\) sides and side length \(s\), the calculator first converts side length to circumradius:

$$ R_{\text{polygon}} = \frac{s}{2\sin(\pi / m)} $$

The polygon area is then computed from the generated vertices using the shoelace formula.

A candidate circle is valid only if the full circle stays inside the container and does not overlap any circle that has already been placed. For two equal circles of radius \(r\), their centers must be at least \(2r\) apart:

$$ \text{center distance} \ge 2r $$

Square grid packing

In a square grid, circle centers are spaced by the circle diameter in both directions:

$$ \text{horizontal spacing} = 2r $$
$$ \text{vertical spacing} = 2r $$

In an ideal infinite square grid, the density is:

$$ \eta_{\text{square}} = \frac{\pi}{4} \approx 78.54\% $$

This pattern is simple, predictable, and easy to align, but it usually leaves more empty space than a staggered layout.

Hexagonal packing

In hexagonal packing, adjacent rows are offset. The vertical spacing between rows is:

$$ \sqrt{3}r $$

For equal circles in the infinite plane, the hexagonal arrangement has density:

$$ \eta_{\text{hex}} = \frac{\pi}{2\sqrt{3}} \approx 90.69\% $$

That does not mean every finite rectangle, circle, or polygon will reach \(90.69\%\). Edges matter. A boundary can cut off otherwise useful positions, and a smaller container may favor a different arrangement for a particular radius and target count.

Spiral search

A spiral search places trial points outward from the center and accepts a candidate only when it passes the boundary and overlap tests. In this calculator, the spiral uses the golden angle,

$$ \theta = \pi(3 - \sqrt{5}) $$

This kind of search can find useful placements in containers where a strict row pattern is not ideal. It is still a heuristic, so it may miss a better arrangement.

Ring search

Ring search tries a center circle and then tests circular rings of candidate positions around the center. This is especially useful for circular containers because many known circle-in-circle layouts have a center-and-ring structure.


Examples of Circle Packing in Practice

Example 1: Square grid in a rectangle

Suppose a rectangular container has width \(120\) and height \(100\), and each circle has radius \(10\). The circle diameter is:

$$ 2r = 2 \times 10 = 20 $$

A simple square grid can fit:

$$ \left\lfloor \frac{120}{20} \right\rfloor = 6 \text{ columns} $$

and

$$ \left\lfloor \frac{100}{20} \right\rfloor = 5 \text{ rows} $$

So the grid places:

$$ 6 \times 5 = 30 \text{ circles} $$

The container area is:

$$ 120 \times 100 = 12000 $$

The covered area is:

$$ 30\pi(10)^2 = 3000\pi $$

The efficiency is:

$$ \frac{3000\pi}{12000} \times 100\% = \frac{\pi}{4} \times 100\% \approx 78.54\% $$

This example matches the ideal square-grid density because the rectangle dimensions fit an exact number of diameters in both directions.


Example 2: Why a staggered pattern can be more efficient

A square grid leaves a repeating square-shaped gap pattern between nearby circles. A hexagonal layout shifts alternating rows, so circles in one row nestle into the spaces between circles in the next row.

In a large open region, the difference is substantial:

$$ \eta_{\text{square}} \approx 78.54\% $$
$$ \eta_{\text{hex}} \approx 90.69\% $$

The practical lesson is that staggered rows often use area better. However, finite containers are not infinite planes. Near the boundary, a layout with a lower ideal density may still place more circles for a specific width, height, radius, and target count.


Example 3: Circular container based on diameter

Suppose the selected container is circular, with container diameter \(200\):

$$ D = 200 $$

So the container radius is:

$$ R = \frac{200}{2} = 100 $$

The container area is:

$$ \pi(100)^2 = 10000\pi $$

If a valid placement contains \(65\) circles of radius \(10\), the covered area is:

$$ 65\pi(10)^2 = 6500\pi $$

The efficiency is:

$$ \frac{6500\pi}{10000\pi} \times 100\% = 65\% $$

The unused area is:

$$ 100\% - 65\% = 35\% $$

This example also shows why a circular container only needs one size input. The diameter controls both the drawing width and height for circle mode.


How to Interpret the Result

The placed circle count tells you how many equal-radius circles the selected strategy found inside the chosen container. It is a strategy result, not a proof of the maximum possible packing. If the placed count is lower than the target count, the strategy stopped because it could not find enough valid positions under the current inputs.

The target circle count is not a guarantee. It is the maximum number of circles the calculator attempts to place. A target of \(60\) means “try to place up to \(60\) circles,” not “force \(60\) circles to fit.”

Efficiency is the area coverage percentage:

$$ \text{efficiency} = \frac{\text{area of placed circles}}{\text{container area}} \times 100\% $$

An efficiency of \(70\%\) means the placed circles cover about \(70\%\) of the container area. It does not mean \(70\%\) of the target circles were placed.

Unused area is the approximate remaining area percentage. It represents space not covered by circles, but it does not account for real-world clearance, tool width, material deformation, kerf, safety margins, or manufacturing tolerance.

The container area is reported in square drawing units. Because the calculator does not include a unit selector, the width, height, and radius should all be entered in the same unit system or treated as unitless drawing coordinates.

The strategy comparison table is useful because it applies the same inputs to the available strategies. A different strategy may place more circles or produce a higher efficiency for the same container and radius.

A valid status means the calculator did not detect overlaps or circles outside the container. Collision warnings mean one or more circles need adjustment before the layout should be treated as valid.


Common Mistakes and Misconceptions

One common mistake is assuming that a calculator result is the exact mathematical optimum. Circle packing in bounded shapes can be difficult, and this calculator uses practical placement strategies rather than a proof-based global optimizer.

Another mistake is mixing units. If the width is entered in centimeters but the radius is entered in inches, the result will not represent a real layout. Use one consistent unit system, even though the calculator itself treats values as drawing units.

Many errors come from confusing radius and diameter. If a circle has diameter \(20\), its radius is \(10\). Entering \(20\) as the radius makes the circle twice as wide and four times the area.

Efficiency is also easy to misread. It is an area percentage, not a count percentage. For example, placing \(40\) of \(60\) requested circles is a count result, while efficiency measures how much area those \(40\) circles cover.

For circular containers, use the container diameter input. The circle mode does not stretch into an ellipse.

For polygon containers, enter both the polygon side length and the number of sides. The calculator uses those values to build the regular polygon boundary.

Finally, be careful after manually dragging circles. A layout that started valid can become invalid if a circle is moved into another circle or outside the container.


When to Use Circle Packing

Use circle packing when you need to estimate or compare equal-circle layouts, especially when area use matters.

Common uses include:

  • Comparing square-grid, hexagonal, spiral-style, and ring-style arrangements.
  • Estimating how many round objects, holes, parts, labels, or visual elements may fit in a boundary.
  • Understanding material yield and unused space at an early planning stage.
  • Teaching geometry concepts such as circle area, polygon area, density, and coordinate-based boundary checks.
  • Exploring how container shape affects the number of circles that can fit.
  • Creating a visual layout that can be exported and discussed.

For production, structural, safety, or manufacturing decisions, use the result as an initial estimate only. A final layout should be checked against the actual materials, tolerances, equipment, spacing rules, and professional requirements for the project.


Limitations and Things to Keep in Mind

This calculator handles equal-radius circles only. It does not solve mixed-size circle packing, irregular shapes, holes, obstacles, ellipses, arbitrary polygons, or custom container boundaries.

The result is heuristic. Hexagonal, square-grid, spiral, and ring strategies can produce useful layouts, but they do not prove that no better layout exists. For some bounded packing problems, small changes in radius or container size can change the best arrangement.

Rectangle width and height, circle diameter, polygon side length, and circle radius accept positive finite values and can be decimals. Target count is rounded and limited from \(1\) to \(160\), and polygon sides are rounded and limited from \(3\) to \(10\).

The calculator uses a small tolerance when checking overlaps and boundary contact. This helps avoid false collision results caused by tiny numerical differences, but it does not replace real-world clearance.

The polygon option uses a regular polygon centered in the drawing area. The polygon side length and number of sides determine the boundary; the displayed view is scaled to fit that boundary.

The spiral strategy has a limited number of attempts. It may place fewer circles than another possible search would find.

The PNG export is a visual export of the current graph. It is useful for documentation or discussion, but it should not be treated as a manufacturing drawing unless it is checked and scaled in appropriate design software.


How to Use This Calculator

  1. Choose the container shape: rectangle, circle, or polygon.
  2. Choose a packing strategy: hexagonal, square grid, spiral search, or ring search.
  3. Enter the rectangle width and height, the circle diameter, or the polygon side length for the selected container.
  4. Enter the circle radius. Remember that radius is half the diameter.
  5. Enter the target number of circles to attempt to place.
  6. If using a polygon container, enter the number of polygon sides too.
  7. Review the placed circle count, efficiency, unused area, container area, and strategy comparison.
  8. Turn on collision display when manually adjusting circles so overlaps and boundary issues are easier to see.
  9. Use the animation, reset, or download options when you need to visualize, restart, or export the layout.

Frequently Asked Questions

Is hexagonal packing always the best choice?

Hexagonal packing is the densest equal-circle packing pattern in the infinite plane. In a finite rectangle, circle, or polygon, the boundary can change the result. A square grid, spiral search, or ring search may place more circles for certain dimensions, radii, or target counts.


What does packing efficiency mean?

Packing efficiency is the percentage of the container area covered by the placed circles. It is based on circle area, not just the number of circles. A higher efficiency usually means less unused space.


Why did the calculator place fewer circles than my target?

The target is the maximum number of circles to attempt. If the selected strategy cannot find enough valid non-overlapping positions inside the boundary, the placed count will be lower than the target.


Can I use inches, centimeters, pixels, or millimeters?

Yes, as long as all length inputs use the same unit. The calculator treats dimensions as drawing units, so width, height, and radius must be consistent. The reported area is in square units of whatever length unit you used.


Does the calculator support different circle sizes?

No. The calculator is for equal-radius circles. Mixed-size circle packing is a different and more complex problem.


Why does the circular container use diameter?

A circle needs one size value because its width and height are the same. The diameter defines the circular boundary directly, which avoids treating the container like an ellipse.


What is a collision warning?

A collision warning means that at least one circle overlaps another circle or extends outside the container. This can happen after manual dragging or when a candidate layout is invalid. A layout with collision warnings should not be treated as valid.


Sources and References

Books

  1. J. H. Conway and N. J. A. Sloane. Sphere Packings, Lattices and Groups. Springer-Verlag New York, 1988. Chapter 1, “Sphere Packings and Kissing Numbers.” SpringerLink.
  2. Kenneth Stephenson. Introduction to Circle Packing: The Theory of Discrete Analytic Functions. Cambridge University Press, 2005. Part I, “An Overview of Circle Packing.” ISBN 978-0-521-82356-2. Google Books.
  3. Joseph O’Rourke. Computational Geometry in C. Revised and expanded edition, Cambridge University Press, 1998. Sections on polygon algorithms, geometric searching, and computational geometry methods. ISBN 978-0-521-64976-6. Google Books.

Online and Educational Sources

  1. Eric W. Weisstein. “Circle Packing.” MathWorld—A Wolfram Resource. Accessed June 27, 2026. https://mathworld.wolfram.com/CirclePacking.html.
  2. Eric W. Weisstein. “Polygon Area.” MathWorld—A Wolfram Resource. Accessed June 27, 2026. https://mathworld.wolfram.com/PolygonArea.html.
  3. Eric W. Weisstein. “Golden Angle.” MathWorld—A Wolfram Resource. Accessed June 27, 2026. https://mathworld.wolfram.com/GoldenAngle.html.
  4. OpenStax. “10.6 Area.” Contemporary Mathematics. Rice University, published March 22, 2023. Accessed June 27, 2026. https://openstax.org/books/contemporary-mathematics/pages/10-6-area.