Draw Moore Fractal
Generate the Moore curve — a variant of the Hilbert curve that forms a closed loop. 100% client-side.
Generate a Moore curve — the closed-loop cousin of the Hilbert curve — by picking an iteration level, colors, and line width, then downloading the result as a PNG. No L-system math required on your end; the tool expands the grammar and traces the path automatically.
And everything runs in your browser. Nothing gets uploaded.
How It Works
The Moore curve starts from the axiom LFL+F+LFL and applies two rewriting rules at each iteration. L and R expand into longer strings of drawing commands — F means “draw forward,” + means “turn left 90°,” and - means “turn right 90°.” After the string is fully expanded, a turtle graphics engine traces the path on the canvas. Each iteration quadruples the number of line segments, which is why iteration 6 already produces over 16,000 individual strokes.
Examples
Quick Logo Background
You need a subtle geometric background for a tech meetup poster. A low-iteration Moore curve gives you clean, bold lines that won’t compete with the text.
Iterations: 2
Line color: #6366f1
Background: #ffffff
Line width: 3
Canvas: 600×600
A simple closed loop with 4 visible quadrants — bold purple lines on white, easy to overlay text onto.
High-Detail Generative Art Print
For a framed A3 print, you want maximum density so the curve looks almost like a texture at arm’s length.
Iterations: 6
Line color: #000000
Background: #fefce8
Line width: 1
Canvas: 1024×1024
16,384 tiny segments filling the entire canvas in a closed loop. Looks like a woven fabric pattern from a distance.
Math Class Demonstration
A teacher wants to show students how each iteration level adds complexity. Side-by-side screenshots of iterations 1 through 4 make the recursion click faster than any textbook diagram.
Iterations: 1, then 2, 3, 4
Line color: #ef4444
Background: #ffffff
Line width: 2
Canvas: 400×400
Four PNGs showing 4 → 16 → 64 → 256 segments. Students instantly see the 4× growth pattern per iteration.
Who Uses This
Create high-resolution space-filling curve prints and album art without writing code.
Show students how recursive L-systems build complexity one iteration at a time.
Grab a quick PNG for placeholder graphics, loading screens, or documentation illustrations.
Use low-iteration curves as geometric patterns for posters, business cards, and brand textures.
Common Mistakes
The Moore curve fills a square grid. A 1000×500 canvas squishes the curve horizontally and leaves blank space. Stick with equal width and height — 600×600, 800×800, 1024×1024.
At high iterations with a thick line width, the strokes overlap and you get a solid blob instead of a visible curve. Drop the line width to 1 when going above iteration 4, or start at iteration 3 and work up.
A dark gray line on a medium gray background makes the curve vanish. The fine strokes at higher iterations need strong contrast — black on white or bright colors on dark backgrounds work best.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Iterations: 6 (16,384 line segments)
- Output Format: PNG via canvas export
- L-System Axiom: LFL+F+LFL with 90° turns
Frequently Asked Questions
What is a Moore curve?
It’s a space-filling fractal curve that forms a closed loop — basically a Hilbert curve that connects back to its own starting point. Eliakim Hastings Moore described it in 1900. At high enough iterations, the single continuous line visits every cell in a square grid exactly once and returns home.
How is the Moore curve different from the Hilbert curve?
The Hilbert curve is an open path — it starts at one corner and ends at another. The Moore curve tweaks the construction so the path loops back and closes on itself. That closed-loop property makes it useful for things like circular PCB traces or seamless tiling patterns where you don’t want loose endpoints.
Why can’t I go above iteration 6?
Each iteration quadruples the segment count. At 6 you already have 16,384 strokes. Iteration 7 would mean 65,536 segments crammed onto your screen — most of them thinner than a pixel. The browser could handle it, but you wouldn’t actually see any more detail. It’d just be slower for no visual payoff.
Can I use the generated image commercially?
Yes. The PNG is rendered in your own browser and never touches a server. No watermark, no license restrictions. Print it, sell it, put it on a T-shirt — it is yours.
What canvas size should I use for printing?
For a decent A4 print at 150 DPI, 1024×1024 is the minimum. Pair that with iteration 5 or 6 and a thin line width so the strokes stay crisp. If you need higher resolution, bump the canvas up — 2048×2048 works fine, though rendering takes a beat longer.