Overview
Introduction
The Heighway dragon curve was discovered in the 1960s by NASA physicists folding strips of paper in half, and it has since become one of the most recognizable fractals in mathematics thanks to its dense, self-similar, never-crossing structure.
This tool renders it at any iteration count from 0 to 16 using its standard Lindenmayer-system definition, so you can watch the curve's zigzag pattern grow and download the result as SVG or PNG line art.
What Is Generate a Dragon Curve?
A generator for the classic Heighway dragon curve, built from a Lindenmayer system with axiom FX and production rules X to X+YF+ and Y to -FX-Y, drawn at a 90-degree turn angle.
The only input is an iteration count (labeled "Iterations" in the tool); the axiom, rules, and angle are fixed to the curve's standard, well-documented definition.
How Generate a Dragon Curve Works
The generator expands the axiom FX using the rules X to X+YF+ and Y to -FX-Y, repeated for the chosen iteration count, at a fixed 90-degree turn angle.
The expanded string is walked by a turtle-graphics interpreter: F moves forward and draws a segment, plus and minus turn 90 degrees left or right, and X/Y draw nothing themselves, they only control how F gets placed on subsequent iterations.
The resulting segments are rescaled to fit the SVG viewbox and rendered as a single connected path.
When To Use Generate a Dragon Curve
Use it to generate the real, standard dragon curve for a lecture, an article, or a design element, without implementing the L-system expansion yourself.
It's a quick way to see how the curve's density and folding pattern change as the iteration count rises.
If you want to try a non-standard turn angle on the same rules, the Heighway Triangle Generator shows a 60-degree variant, or use the L-system Generator to pick any angle yourself.
Often used alongside Generate a Twindragon Curve, Generate a Terdragon Curve and Generate a Heighway Triangle.
Features
Advantages
- Uses the dragon curve's real, standard L-system definition and 90-degree angle.
- Iteration count is validated against the curve's sane bounds (0 to 16).
- One-click SVG and PNG export of the rendered curve.
Limitations
- Fixed to the standard 90-degree dragon curve construction, no custom axiom, rules, or angle; use the L-system Generator for that.
- At the highest iteration counts, the curve's segment count grows large enough that fine detail becomes hard to distinguish visually even though the geometry stays exact.
Examples
Best Practices & Notes
Best Practices
- Step through iterations 2 through 6 first to see the folding pattern build up before jumping to the dense default.
- Export as SVG if you plan to scale the curve up, the line art stays crisp at any size.
Developer Notes
The preset uses axiom FX with rules X to X+YF+ and Y to -FX-Y at a fixed 90-degree turn angle, bounded to iterations 0 through 16 (`DRAGON_CURVE_GENERATOR_BOUNDS`), dispatched through the shared `generateFractalFromPreset("dragon-curve", iterations)` helper that every named-curve tool in this category reuses.
Generate a Dragon Curve Use Cases
- Generating reference line art of the Heighway dragon curve for teaching or presentations
- Producing a downloadable SVG of the curve for a design or data-visualization project
- Comparing the classic dragon curve against its twindragon and terdragon relatives
Common Mistakes
- Confusing this tool's fixed 90-degree construction with the Heighway Triangle Generator's 60-degree variant of the same rules, they use identical rewriting rules but render very differently.
- Expecting the curve to visibly self-intersect at high iteration counts, it never does, edges only ever touch at single points.
Tips
- Compare this tool against the Twindragon Curve Generator to see how joining two dragon curves produces a plane-tiling shape.
- Try the same axiom and rules at a different angle in the L-system Generator to see how sensitive the dragon curve's silhouette is to the turn angle.