Staaarter

Generate a Fibonacci Word Fractal

Builds the Fibonacci word fractal, the documented turtle-graphics construction popularized by Monnerot-Dumaine: a virtual turtle draws one unit segment for every character of the Fibonacci word, turning 90 degrees left or right, alternating direction, at every '1' character, exported as SVG or PNG. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-08-05
By Staaarter Team
fractalgeneratorsvg

Overview

Introduction

The Fibonacci sequence shows up everywhere in mathematics, but the Fibonacci word fractal is one of its more surprising appearances: turn the Fibonacci word's string of 0s and 1s into turtle-graphics turning instructions, and a genuinely fractal-looking curve emerges.

This tool builds that curve directly: choose an order, and a virtual turtle draws one segment per character of the corresponding Fibonacci word, turning at every '1' to trace out the resulting shape.

What Is Generate a Fibonacci Word Fractal?

A generator for the Fibonacci word fractal, the documented turtle-graphics construction popularized by Monnerot-Dumaine, built by interpreting the Fibonacci word's characters as move-and-turn instructions.

There is no text input or output here, just a numeric Order control; the tool builds the underlying Fibonacci word internally and renders the resulting turtle path as an SVG curve.

How Generate a Fibonacci Word Fractal Works

The Fibonacci word itself is generated first, by starting with the strings "0" and "01" and repeatedly setting the next string equal to the current one concatenated after the previous one, for as many steps as the chosen order.

A virtual turtle then walks through the word character by character, drawing one unit-length line segment forward for every character, whether it's a '0' or a '1'.

At every '1' character, and only at '1's, the turtle turns 90 degrees before drawing its next segment, alternating between a left turn and a right turn each time a '1' is encountered. That alternating rule is what produces the curve's distinctive self-similar, comb-like structure rather than a simple zigzag.

When To Use Generate a Fibonacci Word Fractal

Use it to explore how a purely combinatorial sequence (the Fibonacci word) can encode genuine geometric, fractal-like structure once interpreted as turtle-graphics instructions.

It's a good source for a visually distinctive fractal curve illustration, especially for material connecting number theory, substitution sequences, and geometry.

Features

Advantages

  • Demonstrates a direct, well-documented bridge between a combinatorial sequence and a geometric fractal curve.
  • Order range extends to 22, covering a wide span from a short, simple path to a long, richly detailed curve.
  • Exports as clean vector SVG or a flattened PNG for use in illustrations or teaching material.

Limitations

  • Order is capped at 22 for renderability, since the Fibonacci word's length grows exponentially (following the Fibonacci numbers) with each additional order.
  • The curve is deterministic and fully specified by the order alone, there's no way to adjust the turning angle or turn rule independently of the underlying Fibonacci word.

Examples

Order 1

Input

Order = 1

Output

A very short path with only a couple of segments and at most one turn.

At low orders, the Fibonacci word itself is short ("01" at order 1), so the turtle only draws a couple of segments.

Order 14

Input

Order = 14

Output

A long, richly self-similar curve with a comb-like, branching visual texture built from hundreds of segments.

At order 14 the underlying Fibonacci word is hundreds of characters long, and the alternating 90-degree turns at every '1' build up the curve's characteristic fractal texture.

Best Practices & Notes

Best Practices

  • Start around order 8 to 12 to see the curve's characteristic self-similar texture clearly before pushing toward the order-22 maximum, where the path becomes very dense.
  • Download as SVG if you want to trace or recolor sections of the curve afterward in a vector editor.

Developer Notes

The Fibonacci word is built iteratively (`b = b + a; a = previous b`), avoiding recursion so long orders don't risk a stack overflow, then a single pass over the resulting string drives the turtle: each character advances position by one unit at the current heading, and every '1' toggles an alternating left/right 90-degree turn before the next segment is drawn. The path is normalized into the shared 1000x1000 SVG viewBox afterward.

Generate a Fibonacci Word Fractal Use Cases

  • Illustrating how substitution sequences (like the Fibonacci word) can encode geometric, fractal-like structure
  • Generating a visually distinctive turtle-graphics curve for a math or generative-art illustration
  • Teaching the connection between combinatorics on words and fractal geometry

Common Mistakes

  • Expecting every character to trigger a turn, only '1' characters do, '0' characters just move the turtle straight ahead.
  • Expecting the turn direction to be fixed (always left, or always right), it alternates: the first '1' turns one way, the next '1' turns the other way, and so on.

Tips

  • Try the Z-order Curve Generator next to compare a substitution-sequence-driven curve against a coordinate-interleaving-driven one.
  • Increase the order gradually and watch how the curve's self-similar sub-patterns repeat at larger scales as the word grows.

References

Frequently Asked Questions