Apollonian Gasket
Draw an Apollonian gasket: start with four circles that all touch each other, one of them around the other three, then fill every curved gap with the one circle that touches all three of its sides, and keep going. The size and place of each new circle come from Descartes’ circle theorem, so every circle touches its three neighbours exactly. Start from three equal circles or from a whole-number set of curvatures such as (−1, 2, 2, 3), and every circle in the gasket has a whole-number curvature you can print inside it. Choose the depth, colour by size or by generation, or print outlines to colour in. Download a PDF, a 300 DPI PNG or an SVG with every circle as an exact circle. Nothing is uploaded.
100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.
Print at 100% (Actual size). Real size prints the gasket at the diameter you type when it fits on one sheet. The SVG holds every circle as an exact circle at the printed size.
Gasket
Page
Runs in your browser with our own code: nothing you type is uploaded or saved. Every circle is worked out from Descartes’ theorem by our own code. You may use what you make here, including commercially, with no credit needed.
How to draw an Apollonian gasket
- Pick a preset, or choose the starting circles and the depth.
- Set the smallest circle to draw, the style and the colours, and turn on the curvature labels if you like.
- Type the diameter and choose Fitted to one page or Real size.
- Check the circle count under the preview.
- Download the PDF and print at 100% (Actual size), or the PNG or SVG.
What you can use it for
- Maths lessons: curvature, tangency and Descartes’ theorem
- Number patterns: whole-number curvatures
- Colouring sheets
- Posters, coasters and wall art
- Plotter, laser and vinyl art from the SVG
- Checking your own Descartes calculations
The 14 presets
| Preset | Starting curvatures | Depth | Circles drawn (smallest radius 0.3 mm) | Diameter |
|---|---|---|---|---|
| Root (−1, 2, 2, 3), depth 6 | (−1, 2, 2, 3) | 6 | 514 | 180 mm, fitted |
| Root (−1, 2, 2, 3), depth 4, curvatures labelled | (−1, 2, 2, 3) | 4 | 158 | 180 mm, fitted |
| Three equal circles, depth 6 | three equal circles | 6 | 548 | 180 mm, fitted |
| Root (−2, 3, 6, 7), depth 6 | (−2, 3, 6, 7) | 6 | 453 | 180 mm, fitted |
| Root (−3, 4, 12, 13), depth 5, labelled | (−3, 4, 12, 13) | 5 | 268 | 180 mm, fitted |
| Root (−3, 5, 8, 8), depth 6 | (−3, 5, 8, 8) | 6 | 502 | 180 mm, fitted |
| Root (−4, 8, 9, 9), depth 6 | (−4, 8, 9, 9) | 6 | 538 | 180 mm, fitted |
| Root (−6, 11, 14, 15), depth 5, labelled | (−6, 11, 14, 15) | 5 | 360 | 180 mm, fitted |
| Colour by depth: (−2, 3, 6, 7), depth 5 | (−2, 3, 6, 7) | 5 | 309 | 180 mm, fitted |
| Colouring sheet: (−1, 2, 2, 3) outlines, depth 5 | (−1, 2, 2, 3) | 5 | 344 | 180 mm, fitted |
| Colouring sheet: three equal circles, outlines, depth 4 | three equal circles | 4 | 164 | 180 mm, fitted |
| Fine detail: (−1, 2, 2, 3), depth 8 | (−1, 2, 2, 3) | 8 | 635 | 180 mm, fitted |
| Real size: 170 mm circle, (−2, 3, 6, 7), depth 7 | (−2, 3, 6, 7) | 7 | 511 | 170 mm, real size |
| Real size: 4 in circle, (−1, 2, 2, 3), depth 5 | (−1, 2, 2, 3) | 5 | 224 | 4 in, real size |
Every circle count is worked out by the tool from the circles it draws.
Whole-number starting sets
| Starting curvatures | (sum)² | 2 × (sum of squares) | Curvatures of the first 4 new circles | Every curvature a whole number to depth 6 |
|---|---|---|---|---|
| (−1, 2, 2, 3) | 36 | 36 | 3, 6, 6, 15 | yes |
| (−2, 3, 6, 7) | 196 | 196 | 7, 10, 19, 34 | yes |
| (−3, 4, 12, 13) | 676 | 676 | 13, 16, 40, 61 | yes |
| (−3, 5, 8, 8) | 324 | 324 | 12, 12, 21, 45 | yes |
| (−4, 8, 9, 9) | 484 | 484 | 17, 17, 20, 56 | yes |
| (−4, 5, 20, 21) | 1,764 | 1,764 | 21, 24, 69, 96 | yes |
| (−6, 11, 14, 15) | 1,156 | 1,156 | 23, 26, 35, 86 | yes |
| (−6, 10, 15, 19) | 1,444 | 1,444 | 19, 31, 46, 94 | yes |
| (−5, 7, 18, 18) | 1,444 | 1,444 | 22, 22, 55, 91 | yes |
Each starting set satisfies Descartes’ theorem: the two middle columns are equal.
Circles at each depth, starting from (−1, 2, 2, 3)
| Depth | New circles | Circles in all (with the 4 starting circles) | Largest curvature at this depth |
|---|---|---|---|
| 1 | 4 | 8 | 15 |
| 2 | 12 | 20 | 38 |
| 3 | 36 | 56 | 110 |
| 4 | 108 | 164 | 323 |
| 5 | 324 | 488 | 927 |
| 6 | 972 | 1,460 | 2,682 |
| 7 | 2,916 | 4,376 | 7,754 |
| 8 | 8,748 | 13,124 | 22,403 |
Counted without a smallest-radius limit.
What prints
| Download | What is in it |
|---|---|
| The gasket fitted to one page or at real size, vector, with the count and a check bar | |
| PNG 300 DPI | The same sheet as a picture |
| SVG | Every circle as an exact circle at the printed size, with the labels |
For a cutter that needs DXF, use SVG to DXF.
Which tool to use
| You want | Use |
|---|---|
| Tangent circles filling a circle, with curvatures | Apollonian Gasket (this page) |
| Mandelbrot and Julia sets, or line fractals | Fractal Generator |
| Bars with the middle thirds taken out | Cantor Set |
| Circular patterns to colour | Mandala Maker |
| Curves drawn by rolling circles | Spirograph Generator |
Other tools: the Fractal Generator renders Mandelbrot, Julia and line fractals, the Mandala Maker draws circular patterns and the Spirograph Generator draws rolling-circle curves.
More free tools
Geometry, patterns and printables?
Drawing and print tools that run privately in your browser, with no sign-up and no watermark.
Frequently asked questions
What is an Apollonian gasket?
A picture made by starting with three circles that touch each other and a fourth circle around them that touches all three, then filling each curved gap with the circle that touches its three sides, again and again. It is named after Apollonius of Perga; the earliest description of the gasket is from 1706, by Leibniz in a letter.
What is Descartes’ circle theorem?
For four circles that all touch each other, with curvatures k1 to k4 (curvature = 1 / radius, negative for a circle that goes around the others), (k1 + k2 + k3 + k4) squared = 2 × (k1² + k2² + k3² + k4²). Descartes discussed it in 1643 in letters to Princess Elisabeth of the Palatinate. The tool uses it to size every new circle, and our tests check it for every set of four.
How are the centres found?
With the complex Descartes theorem, which treats each centre as a complex number and has the same shape as the curvature formula (described by Lagarias, Mallows and Wilks in 2002). In practice the tool uses the linear form: the new circle in the gap of A, B and C, opposite D, has curvature 2(kA + kB + kC) − kD, and its curvature times its centre is 2(kA zA + kB zB + kC zC) − kD zD. No square roots are needed.
Why are all the curvatures whole numbers?
If the four starting curvatures are whole numbers, such as (−1, 2, 2, 3) or (−2, 3, 6, 7), the formula 2(kA + kB + kC) − kD only adds, doubles and subtracts whole numbers, so every circle in the gasket has a whole-number curvature. The tool can write it in each circle that is big enough; our tests check every circle to depth 6.
What does −1 mean?
The negative curvature belongs to the outer circle, which goes around the others: −1 means radius 1 on the outside. The other numbers are relative: in (−1, 2, 2, 3) the two biggest inner circles have half the outer radius and the next one a third.
What do depth and smallest radius do?
Depth 1 fills the 4 first gaps; every later depth puts one circle in each of the 3 new gaps around every circle added before, so without a size limit depth d adds 4 × 3 to the power d − 1 circles. The smallest radius stops a branch when its circles would print smaller than that, so the page does not fill with dots.
Is every circle exact?
Yes. In the SVG every circle is a real circle element with its centre and radius. In our tests every circle touches each of its three parent circles to within one part in a billion, and no two circles overlap, checked pair by pair to depth 5.
Can it print at real size?
Yes, when the circle fits on one sheet (up to about 180 mm across on Letter or A4 portrait, more on landscape). The printed circles are within 0.2 mm of their true size and place in our tests. Larger gaskets print fitted to the page.
Is it free?
Yes. There is no sign-up, no watermark and no limit.
Is anything uploaded?
No. Every shape and number is worked out by JavaScript in your browser. Nothing you type is sent anywhere or saved when you close the page.