Overview
Introduction
The T-square fractal builds a dense, textured silhouette from one of the simplest possible rules: take a square, place a half-size square centered on each of its 4 corners, and repeat on every new square. This tool renders that classic construction as SVG shapes.
Enter a depth and the tool recursively places corner squares that many generations deep, letting you watch the overlapping pattern grow from a single square into a complex nested arrangement.
What Is Generate a T-square Fractal?
A generator for the T-square fractal, a classic plane fractal built by repeatedly placing half-size squares centered on the 4 corners of every square from the previous generation.
Unlike fractals that remove or subdivide area, the T-square fractal only adds new, smaller, deliberately overlapping squares at each generation, so every generation's squares sit visibly on top of the ones before it.
How Generate a T-square Fractal Works
Starting from a single base square, the generator computes the half-size square for each of its 4 corners, each new square is centered on that corner rather than merely touching it, so it overlaps the parent square.
That corner-placement step repeats on every square produced by the previous generation: at generation 2, a half-size square is centered on each of the 4 corners of every generation-1 square, and so on down to the chosen depth.
All squares from every generation, including the original starting square, are kept and drawn together, which is what produces the fractal's layered, overlapping silhouette rather than showing only the newest generation.
When To Use Generate a T-square Fractal
Use it to demonstrate a fractal built from the simplest possible recursive rule (place a smaller square on each corner) for a math class or article on recursive geometric fractals.
It's also a good source of a clean, textured square-based SVG pattern for illustrations or generative-art backgrounds.
Often used alongside Generate a Vicsek Fractal and Generate a Pythagoras Tree Fractal.
Features
Advantages
- Built from one simple, elementary rule (half-size, corner-centered squares), making the recursion easy to follow even without prior fractal background.
- Produces a visually dense, textured silhouette that looks complex despite its simple generating rule.
- Exports as clean vector SVG or a flattened PNG for use in illustrations or teaching material.
Limitations
- Square count quadruples each generation, so depth is capped at 6 to keep the render and download responsive.
- The deliberate overlapping means individual squares from later generations can be hard to distinguish visually at higher depths, since so many are stacked on top of each other.
Examples
Best Practices & Notes
Best Practices
- Start around depth 3 or 4 to see the layered, overlapping texture clearly before pushing toward the depth 6 maximum, where the smallest squares become very small and dense.
- Download as SVG if you want to recolor or trace individual squares afterward in a vector editor.
Developer Notes
Implemented as an iterative loop over an array of rectangles: starting from one 100x100 square, each generation computes 4 half-size child rectangles per square, offset so each is centered on one of the parent's corners, then appends them to the running list of all squares across every generation (capped at depth 6 via a shared bounds check). The full accumulated rectangle list, not just the newest generation, is what gets rendered.
Generate a T-square Fractal Use Cases
- Teaching recursive geometric construction with the simplest possible corner-square placement rule
- Generating a dense, textured square-based fractal illustration for an article or course
- Demonstrating how a single elementary rule applied recursively produces complex emergent structure
Common Mistakes
- Expecting only the newest generation of squares to be visible, this generator draws every generation's squares together, including the original starting square, so the overlap accumulates.
- Setting depth to the maximum expecting a dramatically different silhouette from depth 5, past a certain depth the added squares become too small to noticeably change the overall shape.
Tips
- Compare it against the Vicsek Fractal Generator and Pythagoras Tree Fractal Generator to see three different recursive square- and geometry-based branching structures.
- Look closely near any corner of the original square, the same corner-square placement rule repeats at every scale, the defining property of a self-similar fractal.