Menger Sponge

Draw a Menger sponge from level 0 (a cube) to level 3 (8,000 small cubes): cut a cube into 27, take out the middle one and the middle of every face, and repeat on the 20 cubes that are left. See it as a shaded 3D view with the hidden faces taken out, a line drawing to colour in, or one face, which is the Sierpinski carpet. To build one, print the build plan, a map of every layer with its cube count, or real-size placement mats for sugar cubes or paper cubes. The tool counts the cubes, the outside faces, the volume and the surface. Download a PDF, a 300 DPI PNG or an SVG. Nothing is uploaded.

100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.

100% private — runs in your browser

Print at 100% (Actual size). The placement mats print each layer at real size: stand one cube on each filled cell, then the next layer on top. The SVG holds the drawing at the printed size.

Sponge

Page

Runs in your browser with our own code: nothing you type is uploaded or saved. Every cube, face and layer count is generated and counted by our own code. You may use what you make here, including commercially, with no credit needed.

How to draw a Menger sponge and build one from cubes

  1. Pick a preset, or choose what to show: the 3D view, the line drawing, one face, the build plan or the placement mats.
  2. Set the level (0 to 3) and the colours.
  3. Type the side of the sponge to get its volume and surface, or the cube size for the mats.
  4. Check the counts under the preview.
  5. Download the PDF and print at 100% (Actual size), or the PNG or SVG.

What you can use it for

  • Building a sponge from sugar cubes, paper cubes or blocks, layer by layer
  • Maths lessons: volume that shrinks while the surface grows
  • Colouring sheets of a 3D fractal
  • Classroom and maths club group builds
  • Posters and handouts
  • Plotter and laser art from the SVG

The 14 presets

PresetLevelCubesShowsSheets (Letter)
Level 1 sponge (20 cubes)1203D view1
Level 2 sponge (400 cubes)24003D view1
Level 3 sponge (8,000 cubes)38,0003D view1
Level 2 in green24003D view1
Level 3 in purple38,0003D view1
Colouring sheet: level 2 line drawing2400line drawing1
Colouring sheet: level 3 line drawing38,000line drawing1
One face, level 2 (the carpet)2400one face1
One face, level 3 (the carpet)38,000one face1
Build plan, level 1: 3 layers120build plan1
Build plan, level 2: 9 layers2400build plan1
Build plan, level 3: 27 layers38,000build plan5
Placement mats, level 1, 25 mm cubes (real size)120real-size mats3
Placement mats, level 2, 16 mm sugar-cube size (real size)2400real-size mats9

Every count is worked out by the tool from the cubes it makes.

Cubes, volume and surface at each level

LevelCubesVolume leftOutside facesSurface (sponge of side L)Cubes along an edge
01100%66 L²1
12074.0741%728 L²3
240054.8697%1,05613.037 L²9
38,00040.6442%18,04824.7572 L²27

Outside faces are counted one by one: a face is outside when no cube sits against it. Each face has side L / 3 to the power n.

Layer counts for the build plan

LevelLayersCubes in each layer, from the bottomTotal
138, 4, 820
2964, 32, 64, 32, 16, 32, 64, 32, 64400
327512, 256, 512, 256, 128, 256, 512, 256, 512, 256, 128, 256, 128, 64, 128, 256, 128, 256, 512, 256, 512, 256, 128, 256, 512, 256, 5128,000

Layers with the same pattern have the same count; the plan prints a map of each one.

The 3D view: faces kept and dropped

LevelFace halves facing youPicture cellsFaces drawn (whole or half)
1725430
21,056486276
318,0484,3742,496

Each outside face that faces the viewer is split into two triangles. Where several land on the same spot, only the nearest one is drawn.

What prints

DownloadWhat is in it
PDFThe 3D view, line drawing or face on one page; the build plan (all layers); or one real-size mat per layer; vector, with the counts
PNG 300 DPIThe same sheets as pictures (a ZIP when there is more than one)
SVGThe drawing at the printed size (the first sheet for plans and mats)

Which tool to use

You wantUse
A Menger sponge, its counts and a build planMenger Sponge (this page)
Paper cubes to build withCube Template
Your own cube stacks drawn by handIsometric Drawing Tool
The flat fractals: Sierpinski triangle and carpetSierpinski Triangle
Nets for other solidsShape Nets

Other tools: fold the cubes with the Cube Template, draw your own blocks with the Isometric Drawing Tool and print other solids from Shape Nets.

More free tools

Geometry, patterns and printables?

Drawing and print tools that run privately in your browser, with no sign-up and no watermark.

See all free tools →

Frequently asked questions

What is a Menger sponge?

A cube cut into 27 smaller cubes with 7 taken out (the one in the middle and the one in the middle of each face), leaving 20. Do the same to each of the 20, and again: each round is a level. It was first described by Karl Menger in 1926.

How many cubes are in each level?

Level n has 20 to the power n cubes: 20, 400 and 8,000 for levels 1, 2 and 3. The volume left is (20/27) to the power n of the first cube. Our tests count the cubes the tool makes.

What is its surface area?

The tool counts every outside face of every small cube: 2 × 20 to the power n + 4 × 8 to the power n faces, each with side L / 3 to the power n for a sponge of side L. So the volume shrinks at every level while the surface grows. The table below gives the counts; our tests count the faces directly and compare.

What does each face look like?

Each outer face is a Sierpinski carpet of the same level, and the holes go right through. Our tests check that the outside faces on every side are the carpet, square for square.

How do I build one from cubes?

Choose Build plan or Placement mats. Each layer is a map from the bottom up: put a cube on every filled cell. Level 1 has layers of 8, 4 and 8 cubes. The layer counts always add up to the total, which our tests check. You can fold paper cubes with our Cube Template.

Is the 3D view exact?

Yes. Only faces you can actually see are drawn: for every small piece of the picture the tool keeps the face nearest to you and leaves out every face behind it, so nothing overlaps. Our tests check every drawn face by tracing a line from it towards the viewer and making sure no cube is in the way.

Why does it stop at level 3?

Level 4 has 160,000 cubes, too many to draw quickly in a browser or to see clearly on a printed page. Level 3 already has 8,000.

What is its fractal dimension?

The sponge is made of 20 copies of itself at a third of the size, so its dimension is log 20 / log 3, about 2.727.

Is it free?

Yes. There is no sign-up, no watermark and no limit.

Is anything uploaded?

No. Every shape and number is worked out by JavaScript in your browser. Nothing you type is sent anywhere or saved when you close the page.