Draw T Square Fractal

Draw the T-square fractal - recursive squares at corners (size/2 scaling), dim 2 space-filling. Free, offline, client-side, instant, secure.

Renders the T-square fractal: at every iteration, 4 squares of side size/2 are added centered at the parent's corners, extending the figure outward. Similarity dimension log(4)/log(2) = 2.0 - the limit is a connected space-filling region.

How to Use Draw T Square Fractal

  1. Pick iterations (1-8). The real total square count is (4ᴺ⁺¹ − 1) / 3: iter 5 = 1,365; iter 8 = 87,381. (An older version of this FAQ claimed 4ᴺ - that was wrong; the geometric series adds the parent plus all 4 children per level.)
  2. Pick render mode. Solid fills everything in the primary color; outline shows just borders; alternating colors squares by recursion depth (primary on even levels, secondary on odd).
  3. Pick primary and secondary colors + background (white, black, gray, transparent). A toast warns if primary and secondary are too close for alternating mode.
  4. Pick canvas size (400 / 600 / 800 px).
  5. Click Draw Fractal or press Ctrl/Cmd + Enter. Iter 7+ shows a non-blocking time estimate.
  6. Copy or download the PNG.

Frequently Asked Questions

What is the T-square fractal?

The T-square fractal is a 2D self-similar set built by repeatedly adding smaller squares at the corners of previously placed squares. Start with one square. At each iteration, every existing square gets four child squares of half its side, each child centered exactly at one corner of the parent. The new squares extend outside the parent’s outline, so the figure grows like a stylized cross. After infinitely many iterations the limit is a connected, space-filling region (similarity dimension 2).

How many squares are drawn at iteration N?

(4 to the N+1 minus 1) divided by 3 – a geometric series, because the recursion at each non-leaf level pushes the parent itself plus 4 recursive children. Iter 1 = 5; iter 2 = 21; iter 3 = 85; iter 5 = 1,365; iter 8 = 87,381. An older version of this FAQ claimed 4 to the N (1,024 at iter 5; 65,536 at iter 8) – that count would only be the leaves, but this tool draws every level, so the real count is larger. The stats line shows the actual number.

What is the fractal dimension?

The similarity dimension is log(4) divided by log(2), which is exactly 2.0. Each parent square is replaced (over the next iteration) by 4 self-similar children at scale 1/2, and that gives dim = log(N) / log(1/r) = log(4) / log(2) = 2. A dimension of 2 means the fractal is space-filling: in the infinite limit it covers a region of nonzero area with no “thickness deficit”. At any finite iteration the rendered figure is still made of overlapping squares – the value is the asymptote.

Why are the children centered on the corners?

That is the classical T-square definition. Earlier code in this tool centered the children at the parent’s quadrant midpoints (offset = parent_side / 4) – that produces a quadtree-style 2×2 subdivision, not the T-square cross pattern. The current implementation uses offset = parent_side / 2 (child center exactly at parent corner), which matches the canonical figure shown in fractal-geometry references.

What do the alternating colors show?

Each square’s recursion level (0 for the root, 1 for its 4 children, etc.) modulo 2 picks between the primary and secondary color. Even levels take primary; odd levels take secondary. This makes the recursion hierarchy easy to read – you can count generations by counting color swaps.

Why does the figure look like a cross?

Because each parent’s 4 children stick outward from its corners, the silhouette grows in 4 directions. After many iterations the silhouette stabilizes into the famous T-square “cross-shaped” attractor, which when filled in is essentially the closed convex region the fractal approximates. Stop at iter 3 or 4 to see the cross shape clearly; at iter 8 the interior is fully colored.

Why does the area stay finite even though we keep adding squares?

Each child square has area 1/4 of its parent, so the total area added per level is 4 × (parent area / 4) = parent area. The series sums to a finite geometric total (the squares overlap heavily – the union of all squares is bounded). So even though the count of squares grows like 4ᴺ, the union of their pixels has finite area; that is precisely the space-filling cross.

Is anything sent to a server?

No. The tool loads three static files (HTML, CSS, JS) and then runs entirely in your browser – recursion, drawing, PNG export, clipboard copy. You can disconnect from the internet after the page loads. No analytics, no tracking, no cookies.

Is this tool free?

Yes – free, unlimited, no signup, no watermark. Use the PNGs in lectures, papers, blog posts, or art freely. Attribution to is appreciated but not required.