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.

100% private — runs in your browser

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

  1. Pick a preset, or choose the starting circles and the depth.
  2. Set the smallest circle to draw, the style and the colours, and turn on the curvature labels if you like.
  3. Type the diameter and choose Fitted to one page or Real size.
  4. Check the circle count under the preview.
  5. 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

PresetStarting curvaturesDepthCircles drawn (smallest radius 0.3 mm)Diameter
Root (−1, 2, 2, 3), depth 6(−1, 2, 2, 3)6514180 mm, fitted
Root (−1, 2, 2, 3), depth 4, curvatures labelled(−1, 2, 2, 3)4158180 mm, fitted
Three equal circles, depth 6three equal circles6548180 mm, fitted
Root (−2, 3, 6, 7), depth 6(−2, 3, 6, 7)6453180 mm, fitted
Root (−3, 4, 12, 13), depth 5, labelled(−3, 4, 12, 13)5268180 mm, fitted
Root (−3, 5, 8, 8), depth 6(−3, 5, 8, 8)6502180 mm, fitted
Root (−4, 8, 9, 9), depth 6(−4, 8, 9, 9)6538180 mm, fitted
Root (−6, 11, 14, 15), depth 5, labelled(−6, 11, 14, 15)5360180 mm, fitted
Colour by depth: (−2, 3, 6, 7), depth 5(−2, 3, 6, 7)5309180 mm, fitted
Colouring sheet: (−1, 2, 2, 3) outlines, depth 5(−1, 2, 2, 3)5344180 mm, fitted
Colouring sheet: three equal circles, outlines, depth 4three equal circles4164180 mm, fitted
Fine detail: (−1, 2, 2, 3), depth 8(−1, 2, 2, 3)8635180 mm, fitted
Real size: 170 mm circle, (−2, 3, 6, 7), depth 7(−2, 3, 6, 7)7511170 mm, real size
Real size: 4 in circle, (−1, 2, 2, 3), depth 5(−1, 2, 2, 3)52244 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 circlesEvery curvature a whole number to depth 6
(−1, 2, 2, 3)36363, 6, 6, 15yes
(−2, 3, 6, 7)1961967, 10, 19, 34yes
(−3, 4, 12, 13)67667613, 16, 40, 61yes
(−3, 5, 8, 8)32432412, 12, 21, 45yes
(−4, 8, 9, 9)48448417, 17, 20, 56yes
(−4, 5, 20, 21)1,7641,76421, 24, 69, 96yes
(−6, 11, 14, 15)1,1561,15623, 26, 35, 86yes
(−6, 10, 15, 19)1,4441,44419, 31, 46, 94yes
(−5, 7, 18, 18)1,4441,44422, 22, 55, 91yes

Each starting set satisfies Descartes’ theorem: the two middle columns are equal.

Circles at each depth, starting from (−1, 2, 2, 3)

DepthNew circlesCircles in all (with the 4 starting circles)Largest curvature at this depth
14815
2122038
33656110
4108164323
5324488927
69721,4602,682
72,9164,3767,754
88,74813,12422,403

Counted without a smallest-radius limit.

What prints

DownloadWhat is in it
PDFThe gasket fitted to one page or at real size, vector, with the count and a check bar
PNG 300 DPIThe same sheet as a picture
SVGEvery 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 wantUse
Tangent circles filling a circle, with curvaturesApollonian Gasket (this page)
Mandelbrot and Julia sets, or line fractalsFractal Generator
Bars with the middle thirds taken outCantor Set
Circular patterns to colourMandala Maker
Curves drawn by rolling circlesSpirograph 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.

See all free tools →

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.