Navigation

HomeImage ToolsCode ToolsMath ToolsDate ToolsGeneratorsUtilities
Color ToolsText ToolsPDF Tools

Generate Sierpinski Curve

Draw the Sierpinski curve — a closed space-filling curve based on recursive triangle subdivision.

About the Sierpinski Curve

Pick an iteration count between 1 and 8, choose a stroke color, set the line width, and hit Draw Curve. The output is a single closed loop built from four mutually recursive procedures (A, B, C, D) with 45° turns — push it to 7 or 8 and the path tightens around the Sierpinski triangle boundary. And everything runs in your browser. Nothing gets uploaded.

FAQ

How is this different from the Sierpinski arrowhead?
The arrowhead curve is an open path that fills the triangle interior, while the Sierpinski curve is a closed loop that traces the triangle boundary.

How many segments does it have?
At iteration n, the curve has approximately 4×3ⁿ line segments.

Is it a space-filling curve?
Yes, in the limit it fills the Sierpinski triangle, which has fractal dimension log(3)/log(2) ≈ 1.585.

What algorithm is used?
Four mutually recursive functions (A,B,C,D) with 45° turns generate the path coordinates.

Related Tools