Generate a Sierpinski Triangle

Draw the Sierpinski triangle fractal at a chosen recursion depth

Depth 0 is one triangle. Maximum depth 8 (6561 triangles).

Examples:

  • Depth 0 → one filled triangle
  • Depth 1 → three triangles
  • Depth 4 → 81 triangles (classic gasket look)

Related tools

What is a Sierpinski Triangle?

The Sierpinski triangle (or gasket) is a fractal formed by repeatedly removing the central inverted triangle from an equilateral triangle. Each step replaces one triangle with three smaller ones.

Why Generate It?

  • Education: Show recursion and self-similarity
  • Math demos: Connect combinatorics, geometry, and fractals
  • Art: Produce clean geometric patterns quickly

How This Tool Works

Pick a depth. Depth 0 draws one triangle; each deeper level subdivides every remaining triangle into three. Drawing happens on a canvas in your browser.

Related Tools

  • Visualize an L-System: Turtle-graphics fractals
  • Draw Pascal's Triangle: Binomial coefficient arrays
  • Generate Random Matrix: Random numeric grids