Generate a Sierpinski Triangle
Draw a Sierpinski sieve fractal. Runs entirely in your browser, so your data never leaves your device.
Output
The result appears here as you type.
How to use Generate a Sierpinski Triangle
- 1. Set the recursion depth. Choose Depth for how many times the center triangle of each remaining triangle gets removed. A depth-5 sieve already contains 243 filled triangles.
- 2. Size the canvas. Set Width (px) and Height (px) to fit the triangular gasket shape, keeping the canvas roughly matched to a triangle's aspect ratio for the cleanest result.
- 3. Pick colors and line width. Choose Line color, Background color and Line width to make individual filled triangles distinguishable, especially at higher depths where triangles get very small.
- 4. Review the rendered triangle. The tool draws the Sierpinski sieve as an SVG of filled triangles, with the center triangle removed from each remaining triangle at every level. Save it once the depth looks right.
When to use Generate a Sierpinski Triangle
Generate a Sierpinski Triangle draws the Sierpinski gasket, probably the most widely recognized fractal after the Mandelbrot set, built by repeatedly removing the center triangle from an equilateral triangle. It appears constantly in introductions to fractal geometry, recursion and self-similarity.
- Introducing fractals for the first time. The Sierpinski triangle is one of the most common first fractals taught, since the removal rule is simple to state and the visual result is instantly recognizable to most students.
- Teaching recursion in a computer science course. The Sierpinski triangle's recursive definition, where each triangle contains three smaller copies of itself, makes it a natural exercise for teaching recursive functions and base cases.
- Connecting to Pascal's triangle parity patterns. Shading odd numbers in Pascal's triangle produces a pattern that converges to the Sierpinski triangle, a striking connection worth illustrating alongside the direct geometric construction.
- Producing a widely recognizable math-themed design. The gasket's instantly recognizable shape makes a reliable choice for a math club logo, conference badge or teaching material cover, generated at whatever depth suits the print size.
Examples
A depth-5 Sierpinski triangle
Output
An SVG drawing of the Sierpinski sieve made of 243 filled triangles.
About the Generate a Sierpinski Triangle tool
Generate a Sierpinski Triangle is a free online tool that works entirely inside your web browser. Draw a Sierpinski sieve fractal. Because the processing happens on your own device, nothing you enter is uploaded, logged or stored anywhere.
This page is one of 234 Math utilities on EditSafely. Each one does a single job well, and all of them follow the same rule: your input stays on your machine.
You can shape the output with 6 settings, including Depth, Width (px), Height (px) and Line color, 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.
Because nothing leaves your device, the tool is suitable for sensitive content such as internal documents, credentials or customer data. It also responds instantly, since every keystroke is handled on your own machine rather than by a remote API.
Frequently asked questions
Is Generate a Sierpinski Triangle 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.