🌿 Presets
⚙️ Parameters
Iterations (n)5
Angle (°)25°
Length12
Length ratio0.80
Line width1.5
Width taper0.82
🎨 Color Style
📊 Tree Stats
ℹ️ About L-Systems
An L-System (Lindenmayer System) is a formal grammar that models plant growth through string rewriting. Each symbol maps to a drawing instruction. Applying production rules repeatedly produces fractal-like branching structures that mimic real trees, ferns, and corals.
✏️ Custom L-System Axiom (starting string) Production Rules
⚙️ Parameters
Iterations4
Angle (°)25°
Length10
Length ratio0.75
Start angle-90°
📋 Generated String
—
Length: —
💡 Quick Symbols
F — draw forward   f — move forward
+ — turn right   – — turn left
[ — push state   ] — pop state
| — turn 180°   ! — shrink width
🌿 How L-System Trees Work

An L-System (Lindenmayer System) was invented by biologist Aristid Lindenmayer in 1968 to model plant cell growth. It is a type of formal grammar that rewrites strings of symbols according to rules, then interprets the result as drawing commands — producing fractal-like plant structures.

1. The Three Components

Every L-System has three parts:

Alphabet — the set of symbols used (e.g. F, +, –, [, ])
Axiom — the starting string (e.g. "F")
Production Rules — how each symbol expands in each generation

// Classic binary tree Axiom: F Rules: F → F[+F]F[-F]F Angle: 25.7° n=1: F[+F]F[-F]F n=2: F[+F]F[-F]F[+F[+F]F[-F]F]F[+F]F[-F]F[-F[+F]F[-F]F]F[+F]F[-F]F
2. Symbol Reference
SymbolActionExample use
FDraw a line segment forwardBranch / trunk
fMove forward without drawingJump gap
+Turn right by angle δBranch right
–Turn left by angle δBranch left
[Push current position & angle onto stackStart branch
]Pop position & angle from stackEnd branch, return to node
|Turn 180°Reversed segment
!Decrease line widthTaper towards tips
X, A, B…Variable (doesn't draw; expands by rules)Complex grammars
3. String Rewriting (n Iterations)

Starting from the axiom, each symbol is replaced by its production rule simultaneously. After n iterations you get an exponentially longer string.

// Dragon Curve — n=4 Axiom: FX X → X+YF+ Y → -FX-Y n=1: FX+YF+ n=2: FX+YF++−FX−YF+
4. Turtle Graphics Interpretation

The final string is interpreted by a turtle — an imaginary pen that walks forward and turns. The turtle keeps a stack so it can branch and return to the branch point.

Adjusting the angle δ dramatically changes the visual result: small angles → narrow, tall trees; large angles → wide, spreading canopies.

5. Famous L-Systems
Koch Snowflake: F → F+F−−F+F, δ=60° Sierpiński ▲: F → FF+F+F+FF, δ=60° Barnsley Fern: X → F+[[X]−X]−F[−FX]+X, δ=25° Hilbert Curve: X → +YF−XFX−FY+, δ=90° Dragon Curve: X → X+YF+, Y → −FX−Y, δ=90°