# Cantor comb

## World's simplest fractal tool

This utility lets you draw colorful and custom Cantor comb fractals. You can control the number of comb's teeth and size by adjusting the iteration level and dimensions. The dimensions can be customized by setting the height and width of the canvas and its padding. There are three colors you can choose for the comb – comb color, comb border color, and background color. You can also use additional customization functions to get even more unusual results, such as Cantor stripes and ternary fractal sets. Fun fact – the n-th iteration level the Cantor fractal generates 2⁽ⁿ⁻¹⁾ new segments. Fractabulous!

We put a browser in your browser!
Browserling

Check out our project Browserling – get a browser in your browser.

*fullscreen*

*fullscreen_exit*

A link to this tool, including input, options and all chained tools.

Can't convert.

Cantor comb tool
What is a cantor comb?

This online browser-based tool allows you to visualize Cantor fractals. The Cantor fractal, also known as the Cantor comb, was first discovered by Henry John Stephen Smith in 1874 and introduced to a wider public by German mathematician Georg Cantor in 1883. It's a self-similar fractal because at each iteration step it is equal to two copies of itself, only reduced in size by one third. There are three popular variations of this fractal. The first one is regular symmetric Cantor fractal (also known as ternary Cantor fractal), the second is Cantor comb and the third is Cantor stripe code. All these fractals are constructed by cutting and deleting segments from the line interval [0, 1]. At the first iteration level, we remove interval [1/3, 2/3] from the middle. The length of this interval is 1/3. At the second step, we remove two 1/9 intervals. At the third step, we remove 4 intervals with total length 1/27, etc. At the n-th step, the segment length is 3⁽¹⁻ⁿ⁾ of the original segment. If this operation is performed infinitely long, it creates the true Cantor fractal, which is a perfect set that is nowhere dense. Mind blowing and ingenious at the same time, or as we love to say – fractabulous!

Cantor comb examples
Click to use

A Growing Cantor Fractal

In this example, we generate 5 increasing levels of the symmetric Cantor set. At the first recursion level, the length of an interval length is 3⁽¹⁻⁵⁾ = 3⁻⁴ = 1/3⁴ = 1/81, at the second level, it's 3⁻³ = 1/27, at the third, it's 3⁻² = 1/9, at the fourth, it's 3⁻¹ = 1/3, and at the fifth, it's the entire line of length 1. We use a canary color canvas, 600x500 pixels in size with 15-pixel padding. We draw intervals as blocks with a black 5-pixel thick contour and fill them with a deep-sea-green color.

**Required options**

Cantor fractal's iterative level.

Canvas width

Canvas height

Contour width.

Extra space around the canvas.

Background color.

Cantor line color.

Segment fill color.

Draw a Cantor comb by
merging segments of
every iteration level.

Display only the last
iteration level and fit
it in the entire canvas.

Symmetric Cantor Comb

This example draws the comb type of Cantor fractal. This is done by activating the "Comb Mode" option. As a result, all intervals at all recursions are merged together. We remove the padding and generate 6 levels of the comb and it has a total of 32 teeth.

**Required options**

Cantor fractal's iterative level.

Canvas width

Canvas height

Contour width.

Extra space around the canvas.

Background color.

Cantor line color.

Segment fill color.

Draw a Cantor comb by
merging segments of
every iteration level.

Display only the last
iteration level and fit
it in the entire canvas.

Cantor Stripes

In this example, we enable the "Stripe Code Mode" option to draw the Cantor fractal. This mode deletes all intervals at all iteration levels, except the last level. Then this interval is stretched to fit the entire canvas. There are 2⁽⁶⁻¹⁾ = 2⁵ = 32 stripes in the final drawing as it was iterated 6 times. If the stripe length was 890 pixels (canvas width minus left and right padding) at the first iteration, then at the 6th iteration, each stripe is 1/3⁽⁶⁻¹⁾ = 1/3⁵ = 1/243 of the original length, or 3.66px.

**Required options**

Cantor fractal's iterative level.

Canvas width

Canvas height

Contour width.

Extra space around the canvas.

Background color.

Cantor line color.

Segment fill color.

Draw a Cantor comb by
merging segments of
every iteration level.

Display only the last
iteration level and fit
it in the entire canvas.

Pro tips
Master online fractal tools

You can pass options to this tool using their codes as query arguments and it will automatically compute output. To get the code of an option, just hover over its icon. Here's how to type it in your browser's address bar. Click to try!

https://onlinefractaltools.com/draw-cantor-fractal?&width=600&height=500&iterations=5&background-color=%23e8ff53&fill-color=%23028268&line-segment-color=black&line-width=5&padding=15&direction=up&squeeze-mode=false&barcode-mode=false

All fractal tools

Quickly draw a custom McWorter dendrite fractal.

Quickly draw a custom canopy tree fractal.

Quickly draw a custom Gosper fractal.

Quickly draw a custom Z-order fractal.

Quickly draw a custom Hilbert fractal.

Quickly draw a custom binary v-fractal.

Quickly draw a custom Peano fractal.

Quickly draw a custom Heighway dragon fractal.

Quickly draw a custom twin dragon Heighway fractal.

Quickly draw a custom Heighway nonadragon fractal.

Quickly draw a custom Koch fractal.

Quickly draw a custom triflake fractal.

Quickly draw a custom Sierpinski triangle fractal.

Quickly draw a custom Sierpinski pentagon fractal.

Quickly draw a custom Sierpinski hexagon fractal.

Quickly draw a custom Sierpinski polygon fractal.

Quickly draw a custom Moore fractal.

Quickly draw a custom Cantor comb fractal.

Quickly draw a custom Cantor dust fractal.

Quickly draw a custom Levy fractal curve.

Quickly draw a custom ice fractal.

Quickly draw a custom Pythagoras tree fractal.

Quickly draw a custom t-square fractal.

Quickly draw a custom Hausdorff tree fractal.

Coming soon
These fractal tools are on the way

Generate a Hilbert Sequence

Walk the Hilbert fractal and enumerate its coordinates.

Generate a Peano Sequence

Walk the Peano fractal and enumerate its coordinates.

Generate a Moore Sequence

Walk the Moore fractal and enumerate its coordinates.

Generate a Cantor String

Encode the Cantor set as a string.

Generate a Hilbert String

Encode the Hilbert fractal as a string.

Generate a Peano String

Encode the Peano fractal as a string.

Generate a Moore String

Encode the Moore fractal as a string.

Generate a Dragon String

Encode the Heighway Dragon as a string.

Generate a Sierpinski String

Encode the Sierpinski fractal as a string.

Mandelbrot Tree

Generate a Mandelbrot tree fractal.

Barnsey's Tree

Generate a Barnsley's tree fractal.

Barnsey's Fern

Generate a Barnsley's fern fractal.

Binary Fractal Tree

Generate a binary tree fractal.

Ternary Fractal Tree

Generate a ternary tree fractal.

Dragon Fractal Tree

Generate a dragon tree fractal.

De Rham Fractal

Generate a de Rham curve.

Takagi Fractal

Generate a Takagi-Landsberg fractal curve.

Peano Pentagon

Generate a Peano pentagon fractal curve.

Tridendrite Fractal

Generate a tridendrite fractal curve.

McWorter's Pentigree

Generate a Pentigree fractal curve.

McWorter's Lucky Seven

Generate a lucky seven fractal curve.

Eisenstein Fractions

Generate an Eisenstein fractions fractal curve.

Bagula Double V

Generate a Bagula double five fractal curve.

Julia Set

Generate a Julia fractal set.

Mandelbrot Set

Generate a Mandelbrot fractal set.

Toothpick Fractal

Generate a toothpick sequence fractal.

Ulam-Warburton Fractal

Generate an Ulam-Warburton fractal curve.

Subscribe!
Never miss an update

Cool!

Notifications
We'll let you know when we add this tool

Cool!