🌐 EN

🌿 L-System Fractal Generator

Generate fractals from Lindenmayer systems (L-systems). Pick a preset like the Koch snowflake or dragon curve, or write your own rewrite rules and watch the turtle draw them.

One rule per line, e.g. F=F+F--F+F. Symbols: F and G draw forward, + / - turn, [ and ] save/restore position.

4
GUIDE

Learn more

01

What is an L-system?

An L-system (Lindenmayer system) is a formal grammar invented by the biologist Aristid Lindenmayer in 1968 to model the growth of plants and algae. You start from a short axiom string and repeatedly replace each symbol using a set of rewrite rules, so the string grows more detailed with every pass. The final string is then read as a sequence of turtle-graphics commands β€” move, turn, branch β€” that trace out the fractal on screen.
02

The turtle alphabet

Each symbol is a drawing instruction for an imaginary turtle. F and G move forward while drawing a line; + turns left by the set angle and - turns right; [ pushes the current position and heading onto a stack (starting a branch) and ] pops them back (returning to where the branch began). Those two bracket commands are what let a single rule sprout stems and leaves, producing lifelike, tree-like forms from just a few characters.
03

Writing custom rules

To build your own fractal, set an axiom and one rule per line. The classic Koch curve uses axiom F, rule F=F+F--F+F, and an angle of 60Β° β€” each pass replaces every F with four smaller ones. Because each rewrite can multiply the string length, growth is exponential, so the generator caps iterations at 7 and applies a length guard that stops runaway patterns before they freeze your browser.

Frequently asked questions

What symbols can I use in rules?
F and G draw a line forward; + and - turn the turtle left and right by the angle you set; [ and ] start and end a branch. Any other letter is a placeholder that draws nothing β€” it only gets rewritten by the rules, which is how complex structure builds up over each pass.
Why is there an iteration limit?
Each pass can multiply the length of the string, so the number of drawing commands grows exponentially. To keep the browser responsive the generator caps iterations at 7 and adds a length guard that halts a pattern before it gets too large to render smoothly.
What is a famous L-system?
The Koch snowflake, the dragon curve, and the Sierpinski arrowhead are classic examples, along with the branching plant models that Aristid Lindenmayer originally designed L-systems to describe.