Cantor Set Generator

Build the classic middle-thirds fractal step by step. Adjust depth, colors, thickness, then save a PNG or share a live link with your exact setup.

Cantor Set Workbench

Parameters

Tune the construction

How many construction steps to draw, from 0 through 10.
Color palette
Maintained by ToolexeLast updated: July 17, 2026
Iteration6
Segments64
Length0.087791
Ratio8.78%
Hausdorff0.6309
Jump to n =

Your Guide to the Cantor Set

The Cantor set is a fractal you build by cutting the middle third out of every remaining segment. Use this generator to watch the process unfold, measure what is left, then share the result.

How to use the generator

  1. Drag the Iterations slider to pick a depth from 0 to 10.
  2. Pick a palette and base color to match your slides or print layout.
  3. Use Bar thickness and Row spacing to keep rows readable on any screen.
  4. Press Animate to watch the fractal grow step by step.
  5. Export a PNG, copy the summary, or share a link with your exact setup.

What the numbers mean

Segments: 2^n
Every cut splits each bar in two. Counts double per step, so step 10 shows 1,024 slivers.
Length: (2/3)^n
Two-thirds of each bar survives each cut. Total length drops toward zero.
Smallest piece: (1/3)^n
Each new sliver is one-third of its parent. By step 10 each is near 0.00002 wide.
Dimension: log 2 / log 3
The fractal sits between a point and a line with a Hausdorff dimension of 0.6309.

Why the Cantor set matters

Georg Cantor used this set in 1883 to show a bounded set on the real line could be uncountable yet carry zero length. Every point in the set matches a base-3 expansion with digits 0 or 2, giving a direct bijection with the real interval [0, 1].

Students use the set to learn limits, compactness, self-similarity, measure zero, and ternary representations. Engineers borrow the pattern for fractal antennas, lossless compression schemes, porous material models, and strange attractors in nonlinear systems. Designers use the rule for generative art because its 2:1 scaling keeps detail balanced at every zoom level.

Cantor set generator FAQ

How does middle-thirds removal work?

Start with the interval [0, 1]. Remove the open middle third from (1/3, 2/3). Two bars remain. Repeat the cut inside every surviving bar. Keep going forever, and the limit is the Cantor set.

Why is the total length zero but the set is not empty?

Each step keeps two-thirds of the previous total. After n steps you have (2/3)^n, which tends to zero. Points still survive though: any number whose base-3 digits are only 0 or 2 stays in the set forever.

What is the Hausdorff dimension of the Cantor set?

A self-similar set of N copies scaled by factor r has dimension log N / log(1/r). The Cantor set has N = 2 copies at scale r = 1/3, so its Hausdorff dimension is log 2 / log 3, about 0.6309.

What does the ternary expansion rule mean?

Write a number from [0, 1] in base 3. The number is in the Cantor set if its expansion uses only the digits 0 and 2. For example 1/3 = 0.0222… belongs to the set, while 1/2 = 0.1111… does not.

Can I share or reload my visualization?

Press Share. The URL copied to your clipboard encodes iterations, colors, and spacing. Opening the link restores the same view on any device.

Is the image ready for print or slides?

Yes. Choose the Mono palette for black-and-white print or the Depth palette for color decks, toggle Dark stage for dark-themed talks, then press PNG to save a high-resolution render.