
A fractal maze is a maze that contains smaller copies of itself. Each copy is marked with a letter, and its doors are numbered like the exits of the maze. When you go into door 2 of copy A, you arrive at exit 2 of the maze, but now you are one level deeper: inside copy A. Inside it there are copies too, so you can go deeper and deeper, like piling up the levels of a stack. When you reach an exit from inside a copy, you leave that copy through the door with the same number and go back up one level.
To solve the puzzle, you go from the start S to the finish F of the main maze. Usually there is no direct path: you have to dive into the copies, go through the right doors and come back up at the right place, keeping track of both your position and the level you are in. This free online fractal maze generator creates a new puzzle every time, checks that it can be solved, and can show the solution step by step, drawn inside the copies where each part of the path really happens. You can print the maze, or play it in your browser, zooming into the copies as you go through their doors.
Everything runs directly in your browser: nothing is uploaded to a server.
The maze image is 100 x 100 pixels. The checkered squares show the transparent areas of the image: they are not part of the downloaded PNG file.
The rules of a fractal maze are simple, but they make the puzzle feel completely different from an ordinary maze:
A good way to solve a fractal maze is to first find, for each door, which other doors and exits it can reach directly through the corridors. The puzzle then becomes a smaller puzzle about these connections, and the solution can be worked out on paper.
Click "Play this maze" to solve the maze directly on the screen. The image always shows the whole maze, because every level is the same maze: what changes is the level you are in, shown above the image as a list of the copies you entered ("Main maze › C › A") and by the color of the frame around the image.
First, the copies and the exits are placed. Every exit sits in the middle of a cell that, once the maze is shrunk into a copy, becomes exactly one cell of the copy, so the doors of the copies always line up with the corridors. Then every terminal (an exit, a door of a copy, the start and the finish) grows a small random maze around itself, until the territories of all the terminals fill the maze.
The puzzle is decided by the walls between the territories: opening one joins two territories into one, so their terminals can reach each other. The generator opens and closes these walls, one at a time, and solves every maze it tries. Solving a maze with unlimited levels is possible because, from inside a copy, the only thing that matters is which exit you come out of: the generator calculates, for every pair of exits, the shortest way to go from one to the other inside a copy, and repeats this until nothing improves. It keeps the changes that make the shortest solution longer, and remembers every solvable maze it finds, so the easier difficulties can pick a shorter one.
Below are all the options you can configure when generating a fractal maze.
| Field | Description |
|---|---|
| Difficulty | How long the shortest solution is. Hard takes the longest solution the generator found for this seed, medium about 60% of it and easy about 30% of it, counted in copies entered. |
| Number of copies | How many smaller copies of the maze are placed inside it, from 1 to 6. They are named with the letters A, B, C and so on, from the top left to the bottom right. |
| Number of exits | How many exits the maze has on its border, from 2 to 8. Every copy has the same number of doors, in the same places. |
| Cells per side of a copy | The size of a copy, in cells of the maze around it. |
| Copies smaller than the maze by | How many times the maze is shrunk to make a copy, from 3 to 6. A larger number makes the copies relatively smaller, which leaves more room for the corridors and for more copies. |
| Seed | The number that defines the maze. The same seed with the same options always generates exactly the same maze. The button "Generate a new maze" simply picks a new random seed. |
| Cell size | The size of one cell of the main maze in pixels. The size of the image is calculated from it. |
| Wall thickness | The thickness of the walls of the main maze, in pixels. The walls inside the copies are shrunk with the copies. |
| Draw the maze inside the copies | Draws the maze again inside every copy, shrunk, which shows that every copy is the same maze. Turn it off for plain lettered boxes, like in the classic fractal maze puzzles. |
| Levels drawn inside the copies | How many levels of copies inside copies are drawn, from 1 to 4. The levels that would be smaller than one pixel per cell are never drawn. |
| Number the exits / the doors of the copies | Writes the number of every exit in the margin, and the number of every door just inside each copy, so it is easy to see which exit each door leads to. |
| Colors | The colors of the walls, of the inside of the copies, of the letters and numbers, of the start S, of the finish F and of the background. The background can also be transparent. |
| Color of the player | The color of the dot that you move around in the play mode. The player is never part of the downloaded image. |
| Margin | The space around the maze, in pixels, where the exit numbers are written. |
| Show the solution | Draws the shortest solution and writes it step by step under the image. Every part of the path is drawn where it really happens: the parts inside a copy are drawn inside that copy, shrunk. |
| One color for each level | Paints the solution with a different color at each level, so you can follow the dives into the copies. Turn it off to use a single color. |
| Thickness of the solution | The thickness of the line of the solution, as a percentage of the size of the cell at that level. |
A fractal maze is a recursive maze: it contains smaller copies of itself, and every copy contains copies too, forever. Entering a copy takes you one level deeper into the same maze, and leaving it takes you back one level up. The puzzle is solved by moving both through the corridors and through the levels.
Can I play the fractal maze online?Yes. Click "Play this maze" and move with the mouse, a finger or the arrow keys. Going through a door zooms into the copy, and leaving it zooms out, so you can feel the levels as you go deeper. While you play, the arrow keys move the player instead of scrolling the page.
Is this fractal maze generator free?Yes. The tool is completely free, there is no registration, and the maze is generated by your own browser: nothing is uploaded to a server.
Does every maze have a solution?Yes. The generator solves every maze before showing it, and only keeps the mazes that can be solved and that need at least one trip into a copy. If no such maze is found with the chosen options, the tool shows a warning.
How deep can I go?As deep as you want: every copy contains copies, so the levels never end. The solution of a generated maze only needs a few levels, shown in the maze details, but going deeper can be a trap that leads nowhere.
Is the solution unique?Not always. The corridors of each level form trees, with no loops, but the levels can create more than one way to the finish. The solution shown is always one of the shortest, counted in copies entered.
Why can't I leave through an exit of the main maze?The main maze is the outermost level, so there is no level above it to go to. In the main maze the exits are dead ends. Inside a copy, the same exits take you out of the copy.
Can I use the generated mazes commercially?Yes. The mazes you generate are yours, and you can use them in puzzle books, worksheets, games, websites or any other project.
How do I generate the answer key?Download the maze with the solution turned off, then turn on "Show the solution" and download the image again, without changing any other option. Both images are exactly the same maze, because the seed did not change.







