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.
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
- Pick a preset, or choose what to show: the 3D view, the line drawing, one face, the build plan or the placement mats.
- Set the level (0 to 3) and the colours.
- Type the side of the sponge to get its volume and surface, or the cube size for the mats.
- Check the counts under the preview.
- 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
| Preset | Level | Cubes | Shows | Sheets (Letter) |
|---|---|---|---|---|
| Level 1 sponge (20 cubes) | 1 | 20 | 3D view | 1 |
| Level 2 sponge (400 cubes) | 2 | 400 | 3D view | 1 |
| Level 3 sponge (8,000 cubes) | 3 | 8,000 | 3D view | 1 |
| Level 2 in green | 2 | 400 | 3D view | 1 |
| Level 3 in purple | 3 | 8,000 | 3D view | 1 |
| Colouring sheet: level 2 line drawing | 2 | 400 | line drawing | 1 |
| Colouring sheet: level 3 line drawing | 3 | 8,000 | line drawing | 1 |
| One face, level 2 (the carpet) | 2 | 400 | one face | 1 |
| One face, level 3 (the carpet) | 3 | 8,000 | one face | 1 |
| Build plan, level 1: 3 layers | 1 | 20 | build plan | 1 |
| Build plan, level 2: 9 layers | 2 | 400 | build plan | 1 |
| Build plan, level 3: 27 layers | 3 | 8,000 | build plan | 5 |
| Placement mats, level 1, 25 mm cubes (real size) | 1 | 20 | real-size mats | 3 |
| Placement mats, level 2, 16 mm sugar-cube size (real size) | 2 | 400 | real-size mats | 9 |
Every count is worked out by the tool from the cubes it makes.
Cubes, volume and surface at each level
| Level | Cubes | Volume left | Outside faces | Surface (sponge of side L) | Cubes along an edge |
|---|---|---|---|---|---|
| 0 | 1 | 100% | 6 | 6 L² | 1 |
| 1 | 20 | 74.0741% | 72 | 8 L² | 3 |
| 2 | 400 | 54.8697% | 1,056 | 13.037 L² | 9 |
| 3 | 8,000 | 40.6442% | 18,048 | 24.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
| Level | Layers | Cubes in each layer, from the bottom | Total |
|---|---|---|---|
| 1 | 3 | 8, 4, 8 | 20 |
| 2 | 9 | 64, 32, 64, 32, 16, 32, 64, 32, 64 | 400 |
| 3 | 27 | 512, 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, 512 | 8,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
| Level | Face halves facing you | Picture cells | Faces drawn (whole or half) |
|---|---|---|---|
| 1 | 72 | 54 | 30 |
| 2 | 1,056 | 486 | 276 |
| 3 | 18,048 | 4,374 | 2,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
| Download | What is in it |
|---|---|
| The 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 DPI | The same sheets as pictures (a ZIP when there is more than one) |
| SVG | The drawing at the printed size (the first sheet for plans and mats) |
Which tool to use
| You want | Use |
|---|---|
| A Menger sponge, its counts and a build plan | Menger Sponge (this page) |
| Paper cubes to build with | Cube Template |
| Your own cube stacks drawn by hand | Isometric Drawing Tool |
| The flat fractals: Sierpinski triangle and carpet | Sierpinski Triangle |
| Nets for other solids | Shape 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.
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.