Draw Heighway Dragon Fractal
Generate the Heighway Dragon curve fractal. A famous self-similar curve made by paper folding. 100% client-side.
Generate the Heighway Dragon curve — the fractal you get from folding a strip of paper in half over and over, then opening each fold to 90 degrees. Pick iterations from 1 to 16, set your colors and line width, and hit Draw to watch the L-system build thousands of segments on a canvas. And everything runs in your browser. Nothing gets uploaded.
How It Works
The fractal starts from the axiom FX. Each iteration rewrites X as X+YF+ and Y as -FX-Y, doubling the segment count every time. Once the string is fully expanded, the renderer walks through it: F means "draw a line forward," + turns right 90 degrees, and - turns left 90 degrees. The result is a space-filling curve that never crosses itself.
Examples
Quick Logo Accent
You need a fractal background element for a poster or logo. Low iteration keeps it clean.
Iterations: 6
Line color: #2563eb
Background: #ffffff
Line width: 2
64-segment dragon curve
Clean geometric shape
Good for layering in design tools
Math Class Demonstration
Showing students how a simple rule creates complex geometry. Step through iterations 1 to 10 so they can watch the curve grow.
Iterations: 1 through 10
Line color: #000000
Background: #f8fafc
Line width: 1
10 separate PNGs showing progression
Iteration 1: 2 segments (simple L)
Iteration 10: 1,024 segments (full dragon outline)
High-Detail Wall Art
Generating a detailed fractal for printing at large scale. Max iterations, thin lines, dark background for a sci-fi look.
Iterations: 16
Line color: #22d3ee
Background: #0f172a
Line width: 1
Canvas: 2048 x 2048
65,536-segment curve filling the canvas
Cyan on dark navy — great contrast
PNG ready for poster printing
Who Uses This
Generate fractal PNGs for app backgrounds, loading screens, or procedural texture tests.
Show L-system recursion visually — students grasp self-similarity faster when they see the curve build iteration by iteration.
Grab a crisp fractal PNG as a decorative element for posters, album covers, or generative art projects.
Explore fractal geometry for homework or research papers without installing MATLAB or Processing.
Common Mistakes
High iterations render 65,000+ segments. On older machines the browser can stall for a few seconds. Start at 10 or 12 and work up — you will see the full dragon shape well before 16.
Light gray on white looks invisible. The fix is obvious once you notice, but people often wonder why the canvas looks blank after clicking Draw. Check your color pickers first.
At 14+ iterations the segments are tiny. A line width of 5 or more turns the fractal into a blob. Keep it at 1 or 2 for detailed renders — save thicker strokes for low-iteration curves.
Technical Details
- Processing: 100% client-side (Canvas API)
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Iterations: 16 (65,536 segments)
- Canvas Sizes: 256 to 2048 pixels
- Export Format: PNG
Frequently Asked Questions
What is the Heighway Dragon curve?
It is a fractal curve named after NASA physicist John Heighway. You can make one by folding a strip of paper in half repeatedly and then opening every fold to 90 degrees. The math version uses an L-system that doubles the number of segments each iteration, producing a shape that fills space without ever crossing itself.
How many iterations do I need for a detailed fractal?
Most people find that 12 to 14 iterations give plenty of detail at typical screen sizes. Iteration 12 produces 4,096 segments; iteration 14 gives you 16,384. Going all the way to 16 is only worth it if you are rendering at 2048 pixels or printing large.
Can I use the downloaded PNG for commercial projects?
Yes. The image is generated mathematically in your browser — there is no copyright on a math formula. The PNG you download is yours to use however you want, including in commercial work.
Why does my fractal look like a blob at high iterations?
Thick line widths are the usual cause. At 14+ iterations, each segment is very short. A stroke width of 4 or 5 makes neighboring lines overlap into a solid mass. Drop the line width to 1 and the detail comes back immediately.
Does this tool upload anything to a server?
No. The L-system expansion, rendering, and PNG export all happen in your browser. There are no server calls, no cookies, and no analytics beyond standard page-view tracking. Your data stays on your device.