Experimental

L-System Generator

Generate Lindenmayer systems from an axiom and rewriting rules, draw them with turtle graphics, and see how a handful of substitutions produce plants, snowflakes and space-filling curves.

Last reviewed by the Radiatus Cloud team

Statistics appear here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

Rewriting, not drawing

An L-system has a starting string and a set of rules that replace each symbol with a longer string, applied to every symbol simultaneously. Nothing about the process mentions geometry: the drawing happens afterwards, when a turtle interprets the finished string, moving forward on some letters and turning on plus and minus. Lindenmayer devised them to model how plants grow, and the simultaneity is the biological point, since every cell divides at once rather than in sequence.

Branching needs a stack, and that is what makes plants possible

The bracket symbols push and pop the turtle's position and angle, so a branch can be drawn and the turtle returned to where it left the trunk. Without them an L-system can only draw a single connected path, which gives snowflakes and space-filling curves but nothing that looks alive. Adding two symbols to the alphabet is the entire difference between a Koch curve and a fern, which is a striking amount of expressive power for the change.

Length grows exponentially and that is the practical limit

If a rule replaces one symbol with four, the string quadruples each iteration: ten iterations from a single symbol is a million symbols and fifteen is a billion. Every L-system therefore has a depth beyond which it cannot be drawn regardless of the machine, and interesting figures usually appear well before that. The Barnsley fern is more often drawn by iterated function systems precisely because the L-system version grows too fast.

Related tools

Frequently Asked Questions

What is an L-system?

A starting string plus rules that replace symbols with longer strings, applied to every symbol at once. The result is then interpreted as turtle graphics commands.

Why are the rules applied simultaneously?

Because Lindenmayer devised them to model plant growth, where every cell divides at the same time rather than one after another. Sequential application gives different and less biological results.

What do the brackets do?

They push and pop the turtle position and heading, which is what allows branching. Without them an L-system draws only a single connected path.

Why does it slow down so quickly?

The string grows exponentially. A rule that turns one symbol into four gives a million symbols at ten iterations and a billion at fifteen, so every system has a practical depth limit.

Can I write my own rules?

Yes. Use F and G to draw, plus and minus to turn, brackets to branch, and any other letter as a symbol that is rewritten but draws nothing.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Choose a preset or write your own rules to generate a figure.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.