Staaarter

Generate a Koch Star

Generates the classic Koch snowflake, one of the earliest described fractal curves, by applying the Koch bump rule to all three sides of an equilateral triangle. Adjust the Iterations input from 0 to 6 and export the result as SVG or PNG. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-08-05
By Staaarter Team
fractalgeneratorsvg

Overview

Introduction

The Koch snowflake is one of the oldest and most recognizable fractal curves, built by repeatedly replacing straight line segments with a small outward bump. Applied to all three sides of an equilateral triangle, it produces the familiar star-shaped, snowflake-like outline this tool generates.

First described by mathematician Helge von Koch in 1904, it remains one of the clearest illustrations of a curve with infinite perimeter enclosing a finite area.

What Is Generate a Koch Star?

A fractal curve formed by starting with an equilateral triangle and repeatedly applying the Koch rule, replace every straight segment with 4 shorter segments arranged so the middle two form an outward-pointing bump, to every side.

Also known as the Koch snowflake, it's the most common and widely taught example of the broader family of Koch curves.

How Generate a Koch Star Works

The tool starts from the outline of an equilateral triangle, three straight segments. At each iteration, every straight segment in the current outline is replaced with 4 new segments, the first third, an outward bump made of two segments meeting at a 60-degree point, and the final third.

This replacement is applied simultaneously to every segment in the shape, so the number of segments quadruples with each iteration while each new segment is a third the length of the one it replaced.

Repeating this down to the chosen Iterations count produces the increasingly detailed, snowflake-like silhouette, with the outline traced as a single connected path.

When To Use Generate a Koch Star

Use it whenever you want the classic, textbook Koch snowflake for math visualizations, generative art, or teaching material about fractal curves and infinite perimeter.

If you want the bumps pointing inward instead of outward, use Koch Anti-snowflake Generator, or if you want the same bump rule applied to a hexagon base, use Koch Polyflake Generator.

Features

Advantages

  • Implements the exact, well-documented Koch snowflake construction rather than an approximation.
  • Clean single-path outline rendering makes the increasing detail at each iteration easy to follow.
  • A well-known, instantly recognizable fractal that's useful for quick visual communication of what a fractal curve is.

Limitations

  • Iterations is capped at 6, past that the individual segments become shorter than can be rendered legibly at typical export sizes.
  • Only the classic outward-bump rule is offered here, for the inward variant, use Koch Anti-snowflake Generator instead.

Examples

Iterations 4 Koch star

Input

Iterations: 4

Output

A dense, spiky snowflake-shaped outline, the equilateral triangle's sides replaced with 4 rounds of outward Koch bumps.

Every one of the segments from iteration 3 is replaced with 4 shorter segments including a new outward bump.

Best Practices & Notes

Best Practices

  • Start at Iterations 2 or 3 to see the emerging snowflake silhouette clearly before increasing further.
  • Use the SVG export if you plan to scale the curve up significantly, the vector path stays crisp at any size.

Developer Notes

Built on the shared L-system turtle engine using the "koch-star" preset: axiom `F++F++F` (an equilateral triangle traced with 120-degree exterior turns) and production rule `F -> F-F++F-F` at a 60-degree turning angle. Each `F` in the current string is a forward-draw instruction, so string length (and therefore segment count) quadruples every iteration exactly as the classical Koch construction predicts. Iterations is bounded to 0-6 by the preset's `maxIterations`.

Generate a Koch Star Use Cases

  • Math and fractal geometry visualizations demonstrating infinite perimeter within a finite area
  • Generative art and decorative snowflake-style graphics
  • Educational material introducing L-systems and turtle-graphics fractal generation

Common Mistakes

  • Expecting the shape's area to keep growing along with the perimeter, the Koch snowflake's enclosed area converges to a finite value even as its perimeter grows without bound.
  • Setting Iterations to the maximum immediately, at 6 the fine detail is dense enough that individual bumps become hard to distinguish at typical viewing sizes.

Tips

  • Compare this tool with Koch Anti-snowflake Generator at the same Iterations value to see how flipping the bump direction changes the silhouette.
  • Download the SVG and zoom in on an edge to see the self-similar bump-within-a-bump structure directly.

References

Frequently Asked Questions