HomeMathematicsKoch Snowflake

❄️ Koch Snowflake

Interactive Koch Snowflake fractal simulator. Watch the classic middle-third construction unfold through 0-6 iterations, compare snowflake, single-curve and anti-snowflake variants, and see the infinite-perimeter/finite-area paradox in real numbers.

Mathematics2DEasy60 FPS❄️ Ice & Cold
koch-snowflake ↗ Open standalone

❄️ What It Demonstrates

The Koch snowflake, introduced by Swedish mathematician Helge von Koch in 1904, is one of the earliest fractal curves ever described. It starts from an equilateral triangle. At every step, each straight edge is divided into three equal parts, and the middle part is replaced by two sides of a smaller equilateral triangle pointing outward — a "bump." Repeating this rule on every new segment, forever, produces the snowflake. Because every iteration multiplies the number of segments by 4 while each segment shrinks to 1/3 its previous length, the total perimeter is multiplied by 4/3 at every step. After n iterations the perimeter is P(n) = P₀ · (4/3)ⁿ, which grows without bound as n → ∞ — an infinite perimeter in the limit.

Remarkably, the area enclosed stays finite. Each iteration adds smaller and smaller triangular bumps whose combined area shrinks geometrically (by a factor of 4/9 relative to the area added in the previous step), so the total area converges to A(∞) = (8/5) · A₀, where A₀ is the area of the starting triangle. This "infinite perimeter, finite area" paradox is a signature property of fractal curves. The boundary's Hausdorff (fractal) dimension is log(4)/log(3) ≈ 1.2619 — strictly between the dimension of a line (1) and a filled plane region (2), reflecting how the curve is "rougher" than a smooth line but still doesn't fill any area itself.

How to Use

  • Drag the Iterations slider (0–6) to control the recursion depth. Iteration 0 is the plain triangle.
  • Choose a shape mode: full Snowflake (bumps outward on all 3 sides), a Single Koch Curve (one open edge, not closed into a triangle), or the Anti-Snowflake (bumps point inward, carving the shape instead of adding to it).
  • Enable Animate growth to watch each iteration build progressively rather than jumping straight to the final depth.
  • Watch the Statistics panel: perimeter grows with each iteration while area converges toward a fixed limit.

Did You Know?

The Koch snowflake was one of the first curves recognized as having no well-defined tangent anywhere — it is continuous everywhere but differentiable nowhere, a property mathematicians once considered pathological. Benoit Mandelbrot later used curves like this to help define the modern concept of fractal dimension and coined the word "fractal" itself in 1975. Coastlines behave similarly in a rough, approximate sense: the closer you look, the more detail (and measured length) appears — the origin of the famous "How Long Is the Coast of Britain?" question Mandelbrot posed in 1967.

About this simulation

This simulator builds the Koch snowflake by recursively replacing the middle third of every line segment with two sides of a smaller equilateral triangle. Starting from a triangle, each of the 3 sides turns into 4 segments per iteration, so segment count grows as 3·4ⁿ while each segment is 1/3ⁿ the original length — giving a perimeter that grows as (4/3)ⁿ without bound while the enclosed area converges to 8/5 of the starting triangle's area.

🔬 What it shows

A recursive edge-subdivision fractal drawn on canvas. Snowflake mode closes three Koch curves into a triangle outline; curve mode shows a single open edge; anti-snowflake flips the bump direction inward, carving material away instead of adding it.

🎮 How to use

Set Iterations (0–6) to control recursion depth. Pick a shape mode from the dropdown. Toggle Animate growth to watch the construction build step by step, and Fill interior to shade the enclosed region. The Statistics panel reports live perimeter and area alongside their limiting formulas.

💡 Did you know?

The Koch curve is continuous everywhere but differentiable nowhere — it has no defined tangent line at any point, a property that startled 19th and early 20th century mathematicians and helped motivate the modern theory of fractals.

Frequently asked questions

Why does the perimeter grow forever but the area stays finite?

Each iteration multiplies the segment count by 4 and shrinks each segment to 1/3 of its previous length, so perimeter scales by 4/3 every step — an unbounded geometric sequence. The bumps added at each step, however, get smaller by a factor of 1/9 in area and there are 4× as many, so the total added area shrinks by 4/9 each round, forming a convergent geometric series that sums to a finite total.

What is the fractal (Hausdorff) dimension?

It is log(4)/log(3) ≈ 1.2619. This comes from the self-similarity rule: each segment is replaced by 4 copies scaled by 1/3, and dimension D satisfies 4 = 3^D. A dimension between 1 and 2 reflects a curve that is "rougher" than a smooth 1-dimensional line but still does not fill 2-dimensional area.

What is the anti-snowflake?

The anti-snowflake uses the identical construction rule but flips each bump to point inward rather than outward, carving triangular notches into the shape instead of adding them. Its perimeter formula is the same (4/3)ⁿ growth, but the enclosed area shrinks toward a finite positive limit rather than growing.

How is this different from a single Koch curve?

The snowflake applies the construction to all three sides of a closed equilateral triangle, forming a closed curve enclosing an area. The single Koch curve mode applies the same rule to just one open edge, so it has a well-defined length but no enclosed area, illustrating the boundary construction in isolation.

Is this an exact model or an approximation?

The geometry is mathematically exact at every finite iteration: each new vertex position is computed directly from the standard middle-third construction formulas, not approximated. Only the true fractal limit (n → ∞) is unreachable on a finite screen — the simulator caps iterations at 6, which already exceeds visual resolution.

⚙ Under the hood

Build the Koch snowflake by recursively replacing the middle third of every segment with an outward equilateral bump, starting from a triangle, square, or hexagon. Watch perimeter grow without bound while area converges.

fractalrecursiongeometrycanvas

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)