EditSafely

Generate a Cantor Set

Draw a Cantor set fractal. Runs entirely in your browser, so your data never leaves your device.

Output

The result appears here as you type.

Options

How to use Generate a Cantor Set

  1. 1. Set the number of levels. Use the Levels slider to choose how many times the middle third of each bar gets removed. Higher levels split the set into more, thinner segments, revealing the fractal's self-similar structure.
  2. 2. Size the bars and canvas. Set Bar height for each row's thickness and Width (px) / Height (px) for the overall drawing. Taller bars make the gaps easier to see at low levels; a wider canvas gives more segments room to separate.
  3. 3. Choose colors and line width. Pick a Line color, Background color and Line width to match where you plan to use the image, whether that is a slide deck, a math handout or a dark-mode blog post.
  4. 4. Review the rendered fractal. The SVG renders instantly with one row of bars per level. Right-click to save it or drag it directly into a document; it stays sharp at any zoom because it is vector, not pixels.

When to use Generate a Cantor Set

Generate a Cantor Set draws the middle-thirds construction that introduced mathematicians to sets with zero length but uncountably many points. It is the standard first example when teaching fractal dimension, measure theory or the idea of a perfect set with no interior.

  • Illustrating a real analysis lecture. You are covering measure zero sets or the definition of a perfect set and need a picture that shows the removal happening step by step, not just the final row of dust.
  • Building a fractal dimension worksheet. Students compute the Hausdorff dimension log(2)/log(3) from the self-similarity ratio. Rendering six or seven levels gives them a visual to count segments against at each step.
  • Comparing to other Cantor-like constructions. You want a baseline picture to place next to the generalized or Smith-Volterra-Cantor variants, showing how changing the removal fraction changes the resulting dust pattern.
  • Decorating math content with an accurate fractal. A blog post or video thumbnail about self-similarity needs a correct middle-thirds Cantor set rather than a stock image, with colors matched to your site's theme.

Examples

A 6-level Cantor set

Output

An SVG drawing of the middle-thirds Cantor set, one row of bars per level.

About the Generate a Cantor Set tool

Generate a Cantor Set does its work locally, right in the browser. Draw a Cantor set fractal. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the Math Tools collection on EditSafely, a set of 234 small, focused Math utilities that share the same instant, private workspace.

You can shape the output with 7 settings, including Levels, Bar height, Width (px) and Height (px), and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Is Generate a Cantor Set free to use?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Does the generator send anything to a server?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How do I get a different result?

Run the generator again. Each run is computed fresh on your device, and any options you change are applied to the next result immediately.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

Can I save what the tool produces?

Yes. Use the download or copy controls in the output panel to keep the rendered result once it looks the way you want.

Related tools

All Math Tools