ThisCalculator

Math

Circle Packing Calculator: How It Works

Updated · Standard formula, shown below

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.

Circle Packing Calculator: How It Works

This circle packing calculator determines how many smaller circles of a given radius can fit inside a larger container circle, and reports the packing density (the fraction of the container area that the smaller circles cover). You enter the container radius and the small circle radius (or diameter), and the calculator returns the maximum number that fits in a hexagonal arrangement, plus the resulting density. It is a practical tool for layout planning, manufacturing, and geometry problems.

Formula

The calculator uses the hexagonal (hexagonal close-packed) arrangement, which is the densest way to pack equal circles in a plane. The theoretical maximum density for infinite packing is π/(2√3) ≈ 0.9069, meaning about 90.69% of the area is covered. For a finite container, the number of circles that fit is approximated by:

n ≈ floor( (π / (2√3)) × ((R − r) / r)² )

where:

  • R = radius of the container circle (same unit as r)
  • r = radius of each small circle (same unit as R)
  • n = number of small circles that fit

The term (R − r)/r accounts for the fact that the centers of the small circles cannot be closer than 2r to each other and cannot be closer than r to the container edge. The density is then n × (area of one small circle) / (area of container) × 100%.

Worked Example

Using the default values: container radius R = 10 m, small circle radius r = 1 m.

  1. Compute (R − r)/r = (10 − 1)/1 = 9.
  2. Square it: 9² = 81.
  3. Multiply by π/(2√3) ≈ 0.9069: 81 × 0.9069 ≈ 73.46.
  4. Take the floor: floor(73.46) = 73.
  5. Density = (73 × π × 1²) / (π × 10²) × 100 = (73/100) × 100 = 73%.

So the calculator returns 73 circles and a density of 73.0%. Note that the actual maximum for R=10, r=1 is 73 circles (achieved with a hexagonal lattice), so the formula works well for these values.

When to Use This Calculator

This calculator is useful whenever you need to estimate how many circular items fit in a circular area. Common real-world applications include:

  • Cutting circles from a circular sheet of material (e.g., metal, wood, acrylic).
  • Placing cylindrical containers (e.g., cans, bottles) inside a circular tray or bin.
  • Designing circular arrays for sensors, LEDs, or holes in a disc.
  • Estimating the number of circular plants or trees that fit in a circular garden bed.

For rectangular containers, a different formula (based on square grid or hexagonal packing) applies, but this calculator is specifically for a circular container.

How to Read the Result

The primary output is the maximum number of circles that fit in a hexagonal arrangement. The density tells you how efficiently the area is used. A density of 90.69% is the theoretical limit for an infinite plane; for finite containers, the density is usually lower, especially when the container is not much larger than the circles. If the density is low (e.g., below 50%), you might consider a different arrangement or a different circle size.

The result is an estimate based on the hexagonal packing formula. It is exact only when the container is large relative to the circles and when the hexagonal pattern fits perfectly. For small numbers (e.g., fewer than 20 circles), the actual maximum may differ by a few circles. Always verify with a physical layout or CAD software for critical applications.

Common Mistakes and Limitations

  • Unit mix-ups: Ensure both radii are in the same unit. If you enter R in meters and r in centimeters, the result will be wildly wrong. Convert first.
  • Using diameter instead of radius: The formula uses radii. If you have diameters, divide by 2.
  • Assuming square packing: Square packing (circles aligned in rows and columns) gives a lower density (78.54%) and fewer circles. The hexagonal packing is optimal, so use it unless you have a specific reason to use square packing.
  • Edge effects: The formula assumes the small circles are arranged in a perfect hexagonal lattice that is truncated by the container. In reality, the boundary may allow a few more or fewer circles depending on the exact dimensions. For large R/r, the estimate is very close.
  • Overlapping not allowed: The formula ensures no overlap by using the center-to-center distance of 2r. It does not account for any required spacing between circles (e.g., for manufacturing tolerances). If you need a gap, increase the effective r by half the gap.

Alternatives and Variations

If your container is not circular, you need a different approach:

  • Square container: Use square packing (n = floor(L/(2r))²) or hexagonal packing with a square boundary (more complex).
  • Rectangular container: Similar to square, but with different dimensions.
  • Circles in a circle with a gap: Increase the small circle radius by the desired gap/2, then use the formula.
  • Exact packing for small n: For n < 20, the optimal arrangement is often not a perfect hexagonal lattice. You may need to use specialized packing algorithms or lookup tables.

This calculator gives a quick estimate that is accurate for most practical purposes, especially when the container is at least 10 times the circle radius.

Frequently Asked Questions

Is the hexagonal packing always optimal?

Yes, for equal circles in an infinite plane, the hexagonal arrangement achieves the maximum density of π/(2√3) ≈ 0.9069, proven by Thue in 1890. For a finite circular container, the optimal arrangement may deviate slightly, but hexagonal packing is still the best starting point and is optimal for many configurations.

Why does the formula use (R−r) instead of R?

The centers of the small circles cannot be placed closer than r to the container edge, because the circles would stick out. So the effective radius for the centers is R−r. The formula uses that effective radius to estimate how many circles fit in the hexagonal lattice.

Can I use this for circles in a square?

No, this calculator is specifically for a circular container. For a square, you would use a different formula, such as n = floor(L/(2r))² for square packing, or a hexagonal arrangement with a square boundary, which is more complex.

How accurate is the result for small numbers of circles?

For n less than about 20, the estimate can be off by a few circles because the boundary effects are significant. For example, with R=2, r=1, the formula gives floor(0.9069 × (1)²) = 0, but actually 1 circle fits. Always check small cases manually.

What if I need a gap between the circles?

If you need a gap g between the circles (edge-to-edge), treat the effective radius as r_eff = r + g/2. Then use r_eff in the formula. This ensures the centers are at least 2r_eff apart, giving the required gap.

Does the calculator account for the thickness of the material?

No, the calculator treats circles as 2D. For 3D cylinders, the height is irrelevant for packing in a plane. If you are stacking layers, you would multiply the number per layer by the number of layers, but that is beyond this calculator.

Related

Formula used
in R | Container radius | m | 10 | 0
in r | Small circle radius | m | 1 | 0
out n | Max circles (hex packing) | - | floor(pi / (2 * sqrt(3)) * ((R - r) / r)^2) | 0
out density | Packing density | % | (n * pi * r^2) / (pi * R^2) * 100 | 1

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.