๐ŸŒ EN

๐Ÿ”บ Sierpinski Triangle Generator

Draw the Sierpinski triangle by recursive subdivision, or watch it emerge from random chaos-game points. Adjust the depth and color, then export a PNG.

5

Tip: the chaos game plots random points and still converges to the same triangle.

GUIDE

Learn more

01

What is the Sierpinski triangle?

The Sierpinski triangle is a self-similar fractal: take a solid triangle, remove the middle sub-triangle formed by joining the midpoints of its sides, and repeat the same step on each of the three remaining triangles forever. The result has a fractal dimension of log 3 / log 2 โ‰ˆ 1.585 โ€” more than a line but less than a filled area. It was introduced by the Polish mathematician Wacล‚aw Sierpiล„ski in 1915.
02

Two ways to build it

This tool offers two constructions. Recursive subdivision is deterministic: it repeatedly cuts each triangle into three smaller copies, so the shape is drawn exactly. The chaos game is random: fix the three corners of a triangle, start from any point, then repeatedly pick a corner at random and jump halfway toward it, plotting each landing spot. Both approaches produce the very same figure.
03

Why the chaos game works

The three halfway-to-a-corner rules together form an iterated function system (IFS), and the unique attractor of that system is exactly the Sierpinski triangle. Because each rule shrinks distances toward a corner, repeated random iteration is pulled onto the attractor and can never land in the removed central holes. That is why scattering thousands of random points still traces out a perfectly ordered fractal.

Frequently asked questions

What is the depth slider?
It sets the number of subdivision levels in the recursive mode. The number of filled triangles at depth n is 3^n, so depth 6 already draws 729 triangles. Higher depths reveal finer detail but take longer to render.
How can random points make an ordered shape?
Each "jump halfway to a random corner" step is a contraction mapping. Together the three mappings form an iterated function system whose attractor is exactly the Sierpinski triangle, so the random points are always pulled onto that shape.
What is its fractal dimension?
About 1.585, equal to log 3 / log 2. The triangle contains 3 copies of itself, each scaled down by a factor of 2, and log 3 / log 2 is the exponent that relates those numbers.