Draw T-Square Fractal
Generate a T-Square fractal. Squares recursively placed at corners of larger squares. 100% client-side.
Pick an iteration depth, choose fill and stroke colors, and generate a T-Square fractal — squares halved and placed at each corner, repeated recursively until the pattern fills the canvas. Download the result as a PNG whenever you're done tweaking. And everything runs in your browser. Nothing gets uploaded.
How It Works
The algorithm starts with a single centered square. At each iteration, it places four new squares — half the size — at the corners of the current one. Opacity decreases with depth so the layering stays visible. After all iterations finish, the canvas holds your complete fractal and you can save it as PNG.
Examples
Quick classroom demo
A math teacher showing self-similarity to a geometry class.
Iterations: 3
Fill: #6366f1
Stroke: #1e1b4b
Background: #ffffff
85 squares rendered
Clear layered structure
Easy to trace each step
Poster-quality generative art
A designer generating a high-detail fractal for a print background. Cranked up to max depth with dark colors on a light canvas for contrast.
Iterations: 7
Fill: #0f172a
Stroke: #334155
Background: #f8fafc
21,845 squares rendered
Dense, intricate pattern
PNG ready for print at canvas resolution
Neon-on-black wallpaper
Someone making a phone wallpaper with a glow effect.
Iterations: 5
Fill: #22d3ee
Stroke: #06b6d4
Background: #0a0a0a
1,365 squares
Bright cyan fractal on dark background
Great contrast for OLED screens
Who Uses This
Show recursion and self-similarity in a way students actually remember.
Generate unique geometric patterns for posters, album covers, and backgrounds.
Grab reference visuals for testing canvas rendering or recursive algorithms.
Include generated fractals in math papers or computer science assignments.
Common Mistakes
At depth 8, the generator draws 87,381 squares. On older hardware this can freeze the tab for a few seconds. Start at 4 or 5 to see the shape, then increase if your machine handles it fine.
If both are near-white or near-black, the fractal blends into the canvas and looks blank. Use high contrast — dark fill on light background, or bright neon on dark.
Hitting Clear wipes the canvas instantly. There is no undo. Always grab the PNG first if you want to keep the image.
Technical Details
- Processing: 100% client-side — HTML5 Canvas API
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Iterations: 8 (87,381 squares at full depth)
- Export Format: PNG at canvas resolution
Frequently Asked Questions
What is a T-Square fractal?
It's a geometric fractal built by placing smaller squares at the corners of larger ones, then repeating the process. Each new square is half the size of its parent. The pattern fills more and more of the plane as iterations increase, and its Hausdorff dimension is 2.
How many iterations should I use for a T-Square fractal?
4 to 6 is the sweet spot for most screens. Below 4, the shape looks sparse. Above 6, you get incredible detail but the render takes longer. Iteration 8 draws over 87,000 squares — that's fine on modern hardware but might lag on a tablet.
Can I use the generated fractal image commercially?
Yes. The output is generated in your browser with your chosen parameters. You own the resulting image and can use it however you want — prints, designs, presentations, wallpapers, whatever.
Why does opacity decrease at deeper levels?
Without the transparency effect, deeper squares would completely cover the ones beneath them and you'd lose the layered look. Decreasing opacity at each level lets you see all the recursive stages at once — that is what makes the fractal structure visible.
Does this tool upload my data anywhere?
No. The entire fractal calculation and rendering happens in your browser using the Canvas API. Nothing leaves your device — not your color choices, not the generated image, nothing. Close the tab and it is all gone.