Many fractal curves can be generated using L-systems or string-rewrite rules, in which each stage of the curve is generated by replacing each line segment with multiple smaller segments in a particular arrangement. The same technique can be extended to surfaces, where each stage is constructed by replacing each square with multiple smaller squares. This Demonstration shows an analogy of the square Koch curve (Type 1) as a three-dimensional surface.

Snapshot 1: creation of the surface begins with a single square

Snapshot 2: each successive iteration is created by dividing each square into nine smaller squares, "raising" the center square, and then closing the surface by adding squares that connect the raised center to the base

Snapshot 3: the bottom face of the surface is a Sierpinski carpet