HomeArticlesMathematics

Sierpinski Carpet: Removing the Middle, Forever

A 3x3 subdivision with the centre square deleted at every level, converging to zero area but dimension log8/log3 ≈ 1.893.

mysimulator teamUpdated June 2026≈ 6 min read▶ Open the simulation

Remove the middle, forever

The Sierpinski carpet is built by one rule applied recursively. Split a square into a 3×3 grid of nine equal sub-squares, delete the centre one, and then apply the same rule to each of the eight remaining sub-squares. Repeat as many levels as you like. Waclaw Sierpinski described it in 1916, two years before the more famous triangle that shares his name, and it is the two-dimensional analogue of the Cantor set — the same removing-the-middle idea, one dimension up, in a grid instead of a line.

live demo · recursive 3x3 subdivision, centre removed each level● LIVE
function carpet(x, y, size, level) {
  if (level === 0) { fillSquare(x, y, size); return; }
  const s = size / 3;
  for (let row = 0; row < 3; row++)
    for (let col = 0; col < 3; col++) {
      if (row === 1 && col === 1) continue;  // skip the centre cell
      carpet(x + col * s, y + row * s, s, level - 1);
    }
}

How much area survives

Every level keeps 8 of the 9 sub-squares, so after n levels the remaining area is (8/9)ⁿ of the original square. That ratio shrinks slowly at first — 88.9% after one level, 79% after two — but it is a genuine geometric decay: by level 10 barely under 28% of the square remains, and by level 20 less than 8%. In the limit as n → ∞, the area goes to exactly zero, even though the carpet still contains infinitely many points and, remarkably, is still path-connected — you can walk between any two surviving points without leaving the carpet, unlike the fully-disconnected Cantor set.

A dimension between a line and a plane

The carpet's fractal (Hausdorff) dimension follows directly from the construction: each level replaces 1 square with 8 copies at 1/3 scale, so the dimension solves 8 = 3^D, giving D = log 8 / log 3 ≈ 1.8928. That number sits between 1 (a plain line) and 2 (a filled plane) precisely because the carpet is almost a filled square — it retains most of its area at low iteration counts and only asymptotically thins to zero-area, dimension ≈1.89 dust.

This is the same log(count)/log(scale) formula that gives the Sierpinski triangle its dimension of log 3 / log 2 ≈ 1.585 (3 copies at half scale) and the Cantor set its dimension of log 2 / log 3 ≈ 0.631 (2 copies at one-third scale). Comparing the three side by side is the fastest way to build intuition for what "fractional dimension" is actually measuring: how densely a self-similar shape fills the space it's embedded in.

The 3D cousin: the Menger sponge

Extend the same subdivide-and-remove idea to a cube split into a 3×3×3 grid of 27 sub-cubes, removing the centre cube of each face plus the very centre cube (7 removed, 20 kept), and you get the Menger sponge — a solid with zero volume, infinite surface area, and a cross-section through the middle that is exactly a Sierpinski carpet. Its dimension is log 20 / log 3 ≈ 2.727, again strictly between the dimension of a surface (2) and a solid (3).

Where this pattern shows up outside pure math

The carpet's fractal antenna cousins are a real engineering application: antennas built with Sierpinski-carpet or Sierpinski-triangle geometry are naturally multi-band, because each iteration level resonates at a different self-similar scale, letting one physical antenna respond efficiently across several separated frequency bands instead of needing one antenna per band. The same recursive void-cutting idea also appears in truss and lattice engineering, where removing material at every scale trades a small loss of stiffness for a large reduction in weight.

Frequently asked questions

How much area is left after infinitely many iterations?

Zero. Each level keeps 8/9 of the previous area, and (8/9)^n → 0 as n → ∞. The carpet still contains infinitely many points and remains path-connected, but its area (Lebesgue measure) is exactly zero in the limit.

Why is the dimension 1.8928 instead of a whole number?

Each subdivision replaces one square with 8 self-similar copies at 1/3 scale, and the fractal dimension solves 8 = 3^D, giving D = log 8 / log 3 ≈ 1.8928. It sits between 1 and 2 because the shape is neither a simple curve nor a solid filled region — it's a self-similar set that thins out at a specific, measurable rate.

Is the Sierpinski carpet the same as the Sierpinski triangle?

No, they're built with different base shapes and ratios. The triangle removes the middle of a triangle split into 4, keeping 3 copies at half scale (dimension ≈1.585); the carpet removes the centre of a square split into 9, keeping 8 copies at one-third scale (dimension ≈1.893). The Menger sponge is the carpet's 3D generalisation.

Try it live

Everything above runs in your browser — open Sierpinski Carpet and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Sierpinski Carpet simulation

What did you find?

Add reproduction steps (optional)