# Circles within a Rectangle

## The maximum number of circles possible within a rectangle - ex. numbers of pipes or wires in a conduit

The calculator below estimates the maximum number of circles that may fit within a rectangle. The calculator can be used to calculate

- the number of pipes - or wires - that fits within a conduit or similar applications

Input the rectangle inside dimensions - height and width and the circles outside diameters.

Default values are for *0.5 inch* circles inside a *10 inch x 10 inch* square. The calculator is generic and any kind of units can be used - as long as the same units are used for all values.

*w - rectangle width (in, mm, m)*

*h - rectangle height (in, mm, m)*

*d - circle diameter (in, mm, m)*

*s - space between circles - and between circles and rectangle walls (in, mm, m)*

### Rectangular Pattern

#### Rectangular Pattern - Circle Coordinates

Copy and paste the circle center coordinates to your application. x = 0 and y = 0 is top left corner of rectangle.

x y

Tip! - the values can be adapted and modified in excel or in a text editor for use in a CNC G-code generator or similar.

### Triangular Pattern

#### Triangular Pattern - Circle Coordinates

Copy and paste the circle center coordinates to your application. x = 0 and y = 0 is top left corner of rectangle.

x y

**Be aware! - **The algorithm is quite simple - switching rectangle width and height may influence the number calculated. Switching the input values above changes the layout and gives

**Note!**** - **with some combinations of rectangular shapes and circle sizes - one or two more circles - or even more - may be added with a modified layout of the circles. In the default triangular example above - two more circles can be added in between if the left and right bottom circles are moved to the left and right border. The algorithm used for the calculation is quite simple and may underestimate the number of circles in some cases.