Sierpinski Triangle Generator
Generate the Sierpinski triangle fractal at any depth using deterministic recursive subdivision or the chaos-game random-walk method. Compare both algorithms side by side, color triangles by recursion depth, see live area and self-similarity stats, and export a crisp SVG or PNG.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
About Sierpinski Triangle Generator
The Sierpinski Triangle Generator draws the most famous fractal in computer science and recreational mathematics — at any depth, from any outer triangle, using either the deterministic recursive subdivision algorithm or the surprising chaos game random walk. Side-by-side mode draws both at once so you can see that randomness and recursion converge to exactly the same shape. The tool reports the leaf count, the precise remaining area, and the Hausdorff dimension (log 3 / log 2 ≈ 1.5849625), and exports a clean SVG suitable for slides, worksheets, or laser-cutting.
How the Sierpinski Triangle Is Built — Step by Step
Depth 0: Start with a single triangle. The fractal at this depth is just the whole triangle — your starting canvas.
Depth 1: Find the midpoint of each side. Connect them — this defines a central (inverted) sub-triangle. Remove that center; keep the three corner sub-triangles. You now have 3 triangles, each ½ the side length and ¼ the area of the original.
Depth 2: Apply the same rule to each of the 3 surviving triangles. You now have 9 triangles, each ¼ the side and 1/16 the area of the original.
Depth N: Keep applying the rule. After N steps you have 3N tiny triangles, each (1/2)N the side length and (1/4)N the area of the original. The pattern repeats at every scale — that's the self-similarity that gives the Sierpinski triangle its fractal character.
What Makes This Sierpinski Generator Different
What Is the Sierpinski Triangle?
The Sierpinski triangle (also called the Sierpinski gasket or sieve) is a self-similar fractal first formally described by Polish mathematician Wacław Sierpiński in 1915. It is constructed by recursively removing the central inverted sub-triangle from every triangle that remains, leaving three smaller copies of the original at the corners. The process is repeated indefinitely; the limiting set has measure zero (no area at all) but contains uncountably many points and has a non-integer fractal dimension of log 3 / log 2 ≈ 1.5849625 — meaning it is "fatter" than a 1-dimensional curve but "thinner" than a 2-dimensional region.
The Chaos Game: Order from Randomness
The chaos game, popularized by Michael Barnsley in his 1988 book Fractals Everywhere, is one of the most striking results in dynamical systems. Pick any starting point inside the triangle and follow this rule: choose one of the three vertices uniformly at random, jump exactly halfway from your current point toward that vertex, and drop a dot. Repeat thousands of times. After a short burn-in period, every subsequent point lies on the Sierpinski triangle with probability 1 — the fractal is the unique attractor of this random walk. The deterministic recursive subdivision and the random chaos game are both instances of an Iterated Function System (IFS) with the same three midpoint maps; by the contraction mapping theorem, every IFS with strict contractions has a unique non-empty compact attractor that any randomized trajectory converges to.
Recursion Depth Reference
| Depth N | Triangles (3N) | Side length | Area remaining | Removed |
|---|---|---|---|---|
| 0 | 1 | 100% | 100% | 0% |
| 1 | 3 | 50% | 75% | 25% |
| 2 | 9 | 25% | 56.25% | 43.75% |
| 3 | 27 | 12.5% | 42.19% | 57.81% |
| 4 | 81 | 6.25% | 31.64% | 68.36% |
| 5 | 243 | 3.125% | 23.73% | 76.27% |
| 6 | 729 | 1.5625% | 17.80% | 82.20% |
| 7 | 2,187 | 0.78% | 13.35% | 86.65% |
| 8 | 6,561 | 0.39% | 10.01% | 89.99% |
| 9 | 19,683 | 0.20% | 7.51% | 92.49% |
Where the Sierpinski Triangle Shows Up
- Pascal's triangle modulo 2: color each cell of Pascal's triangle black if it's odd and white if it's even. The black cells form the Sierpinski triangle exactly — a stunning bridge between combinatorics and fractal geometry.
- Cellular automaton Rule 90: the one-dimensional cellular automaton "Rule 90" of Stephen Wolfram, started from a single black cell, generates the Sierpinski triangle row by row.
- Fractal antennas: Sierpinski monopole and dipole antennas exploit self-similarity to achieve multiband resonance — a single antenna can cover many frequency ranges. They are used in modern mobile phones and Wi-Fi devices.
- Computer-science teaching: a canonical example for recursion, divide-and-conquer, IFS, and dimension theory. It also makes a great unit-test target for graphics libraries.
- Generative art and design: textiles, logos, laser-engraved coasters, music-festival posters — the fractal's combination of mathematical depth and visual simplicity makes it endlessly remixable.
- Tower of Hanoi state graph: the state graph of the Tower of Hanoi puzzle with N disks is exactly the depth-N Sierpinski graph — the same structure under a different cover.
Sierpinski Triangle vs Pascal's Triangle: A Surprising Identity
Write out Pascal's triangle for many rows, then color cells with odd binomial coefficients dark and cells with even coefficients light. The picture is a perfect Sierpinski triangle. The reason is Kummer's theorem on binomial coefficients modulo a prime: C(n, k) mod 2 equals 1 if and only if the binary representation of k is bit-wise less than or equal to that of n. Recursively this exactly produces the Sierpinski rule — three copies above, central one missing — and the limiting picture is the fractal. Switch this generator to "Pascal triangle layout" to see the connection in matching orientation.
Common Misconceptions
- "The Sierpinski triangle has zero area." True — but only in the infinite limit. At any finite depth N, the leaves still fill
(3/4)Nof the outer area. At depth 9 that's still about 7.5%, plenty visible. - "You need an equilateral triangle to start." False. The recursion works on any triangle (right, obtuse, degenerate-as-long-as-not-collinear). The fractal shape is preserved by every affine transformation. Switch outer shapes in this tool to see for yourself.
- "The chaos game requires special random numbers." No — uniform integer-3 randomness is enough. Any starting point also works (after a short burn-in to forget the start).
- "Fractal dimension is just a fancy name for an integer." No — the Sierpinski triangle's dimension is genuinely between 1 and 2. There is no integer dimension that captures how it scales.
Frequently Asked Questions
What is the Sierpinski triangle?
A self-similar fractal built by recursively removing the central sub-triangle from every triangle in the figure. Three smaller copies of the whole shape sit at the corners of the original — at every scale, the same pattern repeats. First formally described by Wacław Sierpiński in 1915.
What is its Hausdorff dimension?
log 3 / log 2 ≈ 1.5849625. It is "fatter" than a 1D curve but "thinner" than a 2D region — the dimension captures the fact that doubling the resolution reveals 3 (not 4) self-similar copies of the fractal.
What is the chaos game?
A random algorithm that converges to a fractal attractor. For the Sierpinski triangle: start at any point inside the triangle, then repeatedly pick a vertex at random and jump halfway toward it, dropping a dot at each step. After thousands of iterations the dots accumulate exactly on the Sierpinski triangle.
Why do randomness and recursion produce the same fractal?
Both algorithms are instances of an Iterated Function System (IFS) with the same three contractions (midpoint maps toward each vertex). By the contraction-mapping theorem, the IFS has a unique non-empty compact attractor — the Sierpinski triangle — and almost every randomized trajectory converges to it.
How many triangles at depth N?
3N. Depth 0 has 1, depth 1 has 3, depth 2 has 9, depth 3 has 27, depth 4 has 81, depth 5 has 243, depth 6 has 729, depth 7 has 2,187, depth 8 has 6,561, and depth 9 has 19,683 — the maximum this tool will draw.
How much area is left at depth N?
(3/4)N of the original. Depth 1 keeps 75%, depth 5 keeps about 24%, depth 10 keeps only about 5.6%, and the infinite limit has zero area.
Does the outer triangle have to be equilateral?
No. The Sierpinski recursion works on any triangle. The fractal-shape pattern is preserved by every affine transformation, so right triangles, isoceles triangles, and even very stretched layouts all produce a valid Sierpinski triangle.
What is the connection to Pascal's triangle?
If you color the odd entries of Pascal's triangle and ignore the even ones, the result is exactly the Sierpinski triangle. This is a consequence of Kummer's theorem on binomial coefficients modulo 2.
What practical use does it have?
Fractal antenna design (multiband mobile-phone antennas), cellular-automaton studies (Rule 90 generates the Sierpinski triangle row by row), computer-graphics test patterns, recursion and IFS teaching, and laser-engraved or vinyl-cut generative art. It is also the state graph of the Tower of Hanoi puzzle.
Can I export the fractal?
Yes. SVG download produces a scalable vector file (perfect for print, laser-cutting, or further editing). PNG download rasterizes at 2× resolution for chat and slides. Copy stats puts the depth, leaf count, area, and Hausdorff dimension on your clipboard as CSV.
Reference this content, page, or tool as:
"Sierpinski Triangle Generator" at https://MiniWebtool.com// from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: 2026-05-21