Cantor Set

Draw the Cantor set: start with a bar, take out its open middle third, and do the same to every piece that is left. The tool draws levels 0 to 12 stacked one under the other, the classic picture, or a single level at real size as a template, and works out the number of pieces, the size of each one and the length left as exact fractions. It also draws Cantor dust (the square version), the Smith–Volterra–Cantor set, which keeps half of its length, and the same construction with other middle fractions taken out. Type a number such as 1/4 to see its base-3 digits and whether it is in the set. Download a PDF, a 300 DPI PNG or an SVG. 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 across as many sheets as it needs: cut each sheet on its dashed line and butt the edges together, matching the corner marks. The SVG holds the drawing at real size.

Drawing

Is a number in the Cantor set?

Page

Runs in your browser with our own code: nothing you type is uploaded or saved. Every interval, square and fraction is generated and counted by our own code with whole-number arithmetic. You may use what you make here, including commercially, with no credit needed.

How to draw and print the Cantor set

  1. Pick a preset, or choose what to draw: stacked levels, one level, Cantor dust, the Smith–Volterra–Cantor set or another middle fraction.
  2. Set the level, the width and the bar height.
  3. Choose Fitted to one page or Real size (tiled over sheets if it is wider than the paper).
  4. Check the counts and fractions under the preview, and type a number into the checker if you like.
  5. Download the PDF and print at 100% (Actual size), or the PNG or SVG.

What you can use it for

  • Maths lessons: powers of 2 and 3, fractions and limits
  • Base-3 (ternary) numbers
  • Measure and length: a set that keeps no length, and one that keeps half
  • Posters, banners and handouts
  • Cut-paper and stencil projects at real size
  • Plotter and laser art from the SVG

The 14 presets

PresetWhat is drawnWidthPrint
Classic stacked bars, levels 0–5levels 0–5, 32 intervals at the bottom180 mmfitted
Levels 0–8 (256 intervals at the bottom)levels 0–8, 256 intervals at the bottom180 mmfitted
Levels 0–12 (4,096 intervals at the bottom)levels 0–12, 4,096 intervals at the bottom180 mmfitted
Levels 0–6 with counts and lengthslevels 0–6, 64 intervals at the bottom160 mmfitted
Black bars, levels 0–7, no labelslevels 0–7, 128 intervals at the bottom180 mmfitted
Template: level 4 at real size, 162 mm (each bar 2 mm)16 bars, each 1/81162 mmreal size, 1 sheet (Letter)
Template: level 3 at real size, 27 cm (1 cm bars)8 bars, each 1/2727 cmreal size, 2 sheets (Letter)
Template: level 2 at real size, 9 in (1 in bars)4 bars, each 1/99 inreal size, 2 sheets (Letter)
Banner: levels 0–6 at real size, 729 mm on tiled sheetslevels 0–6, 64 intervals at the bottom729 mmreal size, 4 sheets (Letter)
Cantor dust, level 3 (64 squares)64 squares162 mmfitted
Cantor dust, level 5 (1,024 squares)1,024 squares180 mmfitted
Smith–Volterra–Cantor set, levels 0–6 (length left 1/2 + 1/2^(n+1))levels 0–6, length left 65/128180 mmfitted
Remove the middle half, levels 0–6levels 0–6, 64 intervals at the bottom180 mmfitted
Remove the middle fifth, levels 0–6levels 0–6, 64 intervals at the bottom180 mmfitted

Every count and fraction is worked out by the tool from the pieces it draws.

Pieces and length at each level

LevelPiecesEach pieceLength leftAs a percentageChecked (all end points 0s and 2s in base 3)
011/11/1100%yes
121/32/366.6667%yes
241/94/944.4444%yes
381/278/2729.6296%yes
4161/8116/8119.7531%yes
5321/24332/24313.1687%yes
6641/72964/7298.7791%yes
71281/2,187128/2,1875.8528%yes
82561/6,561256/6,5613.9018%yes
95121/19,683512/19,6832.6012%yes
101,0241/59,0491,024/59,0491.7342%yes
112,0481/177,1472,048/177,1471.1561%yes
124,0961/531,4414,096/531,4410.7707%yes

Each level keeps 2 of the 3 thirds of every piece, so the count doubles and the length left is multiplied by 2/3.

Is it in the Cantor set? Examples

NumberBase 3In the level-6 setIn the Cantor set
1/40.020202020202…yesyes
3/40.202020202020…yesyes
1/30.022222222222…yesyes
2/30.200000000000…yesyes
1/100.002200220022…yesyes
1/20.111111111111…nono
0.50.111111111111…nono
1/90.002222222222…yesyes
0.20.012101210121…nono
10.222222222222…yesyes

The checker uses exact whole-number arithmetic, so end points such as 1/3 and 2/3 are handled correctly.

Cantor dust

LevelSquaresSide of each squareArea left
011/1100%
141/344.4444%
2161/919.7531%
3641/278.7791%
42561/813.9018%
51,0241/2431.7342%
64,0961/7290.7707%

The Smith–Volterra–Cantor set

LevelPiecesTaken out of each piece at this stepLength left (exact)As a percentage
01–1/1100%
121/43/475%
241/165/862.5%
381/649/1656.25%
4161/25617/3253.125%
5321/1,02433/6451.5625%
6641/4,09665/12850.7813%
71281/16,384129/25650.3906%
82561/65,536257/51250.1953%

The length left gets closer and closer to 1/2.

Other middle fractions, level 4

Middle part removedPiecesEach pieceLength leftAs a percentage
1/2161/2561/166.25%
1/51616/625256/62540.96%
3/5161/62516/6252.56%
1/41681/409681/25631.6406%
2/3161/12961/811.2346%

What prints

DownloadWhat is in it
PDFThe drawing fitted to one page or at real size on tiled sheets, vector, with the counts and a check bar on every sheet
PNG 300 DPIThe same sheets as pictures (a ZIP when there is more than one)
SVGThe drawing at real size, one path per colour

For a cutter that needs DXF, use SVG to DXF.

Which tool to use

You wantUse
The Cantor set, Cantor dust or the fat Cantor set, with exact counts and a printCantor Set (this page)
Mandelbrot and Julia sets, or line fractals such as the Koch snowflakeFractal Generator
Tangent circles that fill a circleApollonian Gasket
Repeating tile patternsTruchet Tiles
Plain grid paper for your own drawingsGraph Paper

Other tools: the Fractal Generator renders Mandelbrot, Julia and line fractals, Truchet Tiles makes tile patterns and Graph Paper prints grids.

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 the Cantor set?

Start with a line segment, remove the open middle third, and keep doing the same to every piece that is left. What remains after every step is the Cantor set. It was discovered in 1874 by Henry John Stephen Smith and mentioned by Georg Cantor in 1883.

How many pieces are there at each level, and how long are they?

At level n there are 2 to the power n pieces, each 1/3 to the power n of the starting length, so the length left is (2/3) to the power n. The table below gives levels 0 to 12; our tests build the pieces with whole numbers and check every one.

Which numbers are in the Cantor set?

Exactly the numbers from 0 to 1 that can be written in base 3 using only the digits 0 and 2. So 1/4 (0.0202… in base 3) and 3/4 are in it, 1/3 is in it (it can be written 0.0222…), and 1/2 (0.111…) is not. Type any fraction or decimal into the checker to test it; the answer is exact, not rounded.

What is Cantor dust?

The same idea in two dimensions: keep the squares whose row and column are both in the level-n Cantor set. Level n has 4 to the power n squares, covering (4/9) to the power n of the square.

What is the Smith–Volterra–Cantor set (the fat Cantor set)?

Instead of taking out a third each time, step k takes out the open middle 1/4 to the power k of every piece. The pieces still get shorter and shorter, but the length left never drops below 1/2: after level n it is exactly 1/2 + 1/2 to the power n + 1. The tool works this out as an exact fraction.

Can I take out a different middle fraction?

Yes. Choose Another middle fraction and pick 1/2, 1/4, 1/5, 2/3 or 3/5. Each level then keeps 2 pieces of every piece, each (1 − f)/2 of its length, so the length left is (1 − f) to the power n.

What is its fractal dimension?

The Cantor set is made of 2 copies of itself at a third of the size, so its dimension is log 2 / log 3, about 0.6309.

Why does it stop at level 12?

At level 12 there are 4,096 pieces, each 1/531,441 of the width: on a 180 mm bar that is about 0.0003 mm, far finer than any printer. Level 12 is already past what you can see.

How does the real-size print work when the drawing is wider than the paper?

Choose Real size. The tool splits the drawing over as many sheets as it needs, each with a dashed edge, corner marks and a label such as A1 (row A, column 1). Cut each sheet on its dashed line, butt the edges together in order and tape them. Every printed bar edge is at its true position to within 0.2 mm in our tests, on US Letter and A4, as long as you print at 100% (Actual size); the check bar on each sheet lets you confirm the scale.

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.