Levy C Curve Fractal
Draw the Levy C curve fractal with custom iterations, colors, and line width
Generate Levy C curve fractals up to 18 iterations deep — pick your colors, set line thickness, and download the result as a PNG in one click. The curve doubles its segment count with each iteration, so you go from a simple zigzag to a 262,144-segment dragon shape without writing a single line of code. And everything runs in your browser. Nothing gets uploaded.
How It Works
The algorithm starts with a single straight line. On each iteration, every segment gets replaced by two shorter segments rotated ±45 degrees — each new segment is the original length divided by √2. After 12 iterations, that’s 4,096 tiny line segments forming the classic Levy dragon shape. The generator auto-centers and scales the result so it fills the canvas without clipping.
Examples
Quick classroom demo
Showing students how the curve builds up step by step.
Iterations: 4
Line Color: #000000
Background: #ffffff
Line Width: 2
16 line segments forming a recognizable zigzag pattern — clear enough to trace on a whiteboard
Desktop wallpaper with custom palette
Creating a high-detail fractal for a dark-themed background.
Iterations: 16
Line Color: #00ff88
Background: #0a0a0a
Line Width: 0.5
65,536 segments — dense, intricate neon-green curve on near-black. Looks great at 800×800 as a wallpaper crop.
Print-ready poster art
A math teacher wants a clean fractal poster for the classroom wall. Thick lines, moderate detail, school colors.
Iterations: 12
Line Color: #1e3a8a
Background: #fefce8
Line Width: 1.5
4,096 segments — navy blue curve on warm cream. Bold enough to read from across the room at poster size.
Who Uses This
Generating step-by-step fractal visuals for lectures on recursion and self-similarity.
Exploring how iteration count changes fractal complexity for math assignments and science fairs.
Grabbing unique geometric patterns for backgrounds, posters, and album art.
Comparing visual output against their own fractal rendering code to verify correctness.
Common Mistakes
At 18 iterations the curve has 262,144 segments. That’s a lot of draw calls. Start around 12 and go up from there — you’ll see when your browser starts to struggle.
A line width of 5 looks fine at iteration 6, but at iteration 14 the segments overlap so much you get a solid blob. Use 0.5 or 1 for anything above 10 iterations.
Light gray on white? You won’t see the fractal detail. High contrast works best — dark line on light background or bright line on dark background. The fine structure disappears without enough contrast.
Technical Details
- Processing: 100% client-side via HTML5 Canvas API
- Canvas Size: 800 × 800 pixels
- Max Iterations: 18 (262,144 segments)
- Export Format: PNG
- Browser Support: Chrome, Firefox, Safari, Edge
Frequently Asked Questions
What is the Levy C curve fractal?
It’s a self-similar fractal described by French mathematician Paul Lévy in 1938. You start with a straight line and keep replacing each segment with two segments at 45-degree angles. After enough repetitions, you get a shape sometimes called the Levy dragon — a spiky, symmetrical curve that fills a roughly triangular region.
How is the Levy C curve different from the dragon curve?
Both use recursive segment replacement, but the angles differ. The Levy C curve rotates each replacement pair by ±45 degrees, while the classic Heighway dragon alternates left and right 90-degree folds. The visual result is noticeably different — the Levy curve is more compact and symmetric, while the dragon curve sprawls and tiles the plane.
What iteration count gives the best-looking result?
Most people find 12 to 14 hits the sweet spot. The curve is detailed enough to look complex but renders in under a second. Below 8 it still looks angular and unfinished; above 16, the segments are so tiny that fine detail gets lost at screen resolution unless you use a very thin line width.
Can I use the downloaded PNG commercially?
Yes. The fractal is generated on your machine from a mathematical algorithm — there is no copyrighted source image. The PNG you download is yours to use however you want, including in commercial projects, prints, or digital products.
Does this tool send my data anywhere?
No. The entire computation happens in your browser using JavaScript and the Canvas API. Nothing gets uploaded — not your settings, not the image. Close the tab and it is gone. You can even use it offline once the page has loaded.