Welcome

Watch a simple rule transform into intricate art. This is fractal generation: a few instructions create infinite complexity.

Fractals use something called L-Systems: you start with a simple pattern and apply the same rule repeatedly. Each iteration adds more detail, creating structures that look organic and complex, yet follow precise mathematical rules.

In just a few minutes, you'll understand how to create patterns like this. No math background needed. Just follow along and experiment with the interactive examples.

Let's start with the basics.

Drawing Lines

f draws a line forward in the current direction. You can use any lowercase letter (a-z) to draw lines; they all work the same way.

+ rotates the drawing direction clockwise by a specified angle. Think of it as turning a compass or rotating the pen you're drawing with.

The rule f+f means: draw a line, rotate 90° clockwise, then draw another line. This creates an L-shape.

Try the angle slider and watch how changing the rotation angle transforms the pattern. At 90° you get a right angle, at 60° you get a sharper bend, and at 180° the lines go opposite directions.

Turning Directions

+ turns the drawing direction right (clockwise)

- turns the drawing direction left (counterclockwise)

Both symbols rotate by the same angle amount, just in opposite directions. This lets you create symmetric patterns and closed shapes.

Our rule f+f-f-f+f reads as: draw forward, turn right, draw forward, turn left, draw forward, turn left, draw forward, turn right, draw forward. The pattern has 5 lines with turns between them.

Try the angle slider. At 90° it creates a square-like zigzag shape. At 60° you get sharper angles creating a different pattern. At 120° the shape spreads wider. Experiment to see how angle changes dramatically affect the final form!

Iterations: The Magic

Here's where simple becomes complex. In each iteration, every f gets replaced by the entire rule. This is the core concept of fractals: self-similarity at different scales.

Iteration 1: f+f-f-f+f (5 line segments in a simple shape)
Iteration 2: Each f becomes f+f-f-f+f, so we have 5×5 = 25 segments. The shape from iteration 1 appears 5 times, once for each original line.
Iteration 3: Replace again, giving 5×5×5 = 125 segments. The pattern repeats at an even smaller scale.
Move the iteration slider and watch how each iteration adds intricate detail to the previous pattern. The overall shape stays similar, but becomes more complex with each step. This self-repeating property is what makes it a fractal.

Invisible Movement

f or any lowercase letter (a-z) moves forward and draws a visible line

F or any uppercase letter (A-Z) moves forward without drawing anything

Think of uppercase letters like lifting your pen off paper. They're perfect for creating gaps or jumping to new positions without leaving a trail.

Our rule f+f-G-f+f has an invisible middle segment where G moves but doesn't draw. The pattern has a gap in it.

Increase iterations with the slider and watch how the gap propagates and repeats through the pattern at every scale, creating interesting disconnected structures.

Adding Color

< switches to the previous color in your palette

> switches to the next color in your palette

Colors wrap around: after the last color comes the first, and vice versa. This creates smooth color cycling effects.

The rule f+>f->f->f+>f cycles through colors as it draws each segment. Each line is drawn in a different color, creating a rainbow effect.

This example uses 5 colors (white, red, green, blue, yellow) to create a vibrant palette. In the full editor, you can define your own color palettes with as many colors as you want. Create gradients, complementary schemes, or whatever matches your artistic vision.

Increase iterations to see the colors propagate through the fractal.

Branching

[ saves your current position and angle to a memory stack

] restores the last saved position and angle from the stack

Think of it as bookmarking a location to return to later. You can nest brackets: each [ adds a new bookmark, and each ] returns to the most recent one.
The rule f[+f][-f] breaks down as:
f - Draw forward
[ - Save position
+f - Turn right and draw (branch right)
] - Return to saved position
-f - Turn left and draw (branch left)
Increase iterations with the slider and watch how each branch splits into two more branches, creating organic-looking growth patterns. This is how we create plants, trees, and other branching fractals.

The Full System

Now the complete picture. Every L-System fractal has two essential components:

Axiom: The starting sequence at iteration 0. This is what you begin with. Example: x

Rules: Transformation rules that define how each letter changes in each iteration. Example: x=f[+x][-x] means "replace every x with f[+x][-x]"

You can define multiple rules, one for each letter. If a letter has no defined rule, it stays unchanged. Symbols like +, -, [, ], <, > always remain as-is.

The tree shown uses axiom x with two rules: x=f[+x][-x] (x becomes a branch structure) and f=ff (f doubles in length). Watch what happens: iteration 1 replaces x, iteration 2 replaces both the new x's and the f, and so on.

Try different iteration counts with the slider and see how the tree grows more complex while maintaining its branching structure.

Your Turn

Congratulations! You now understand how simple rules create infinite complexity. The fractal shown is the famous Dragon Curve, an elegant pattern created with just two simple rules and 12 iterations.

You've learned about drawing and moving, rotations, iterations, branching, colors, and the complete L-System structure. These concepts combine in endless ways to create everything from geometric patterns to organic plant-like structures.

Ready to create your own mathematical art? The full editor gives you complete control over axioms, rules, colors, angles, line thickness, and more. You can save your creations, share them with others, and explore fractals made by the community.

Start creating now and see what beautiful patterns you discover. Don't be afraid to experiment. Some of the most stunning fractals come from unexpected combinations!