Projects โ€บ Kids & classroom โ€บ Maze generator

Free maze generator: print or play online

You can make a maze free right here: pick a shape and a difficulty, then solve it on screen with your finger, mouse or arrow keys, or print it with the answer. Choose a square, circle, hexagon, triangle, heart, star or Christmas tree maze, or turn a name into a maze. Print one maze or a set of ten different ones with answer pages, save it as a PNG or SVG, or share a link to the exact same maze. No sign-up, and nothing is uploaded. Then build your own maze generator with a free AI assistant.

Medium 1 to 2 hours to build your own Free ยท no sign-up Prints on A4 or Letter

Square maze

Medium ยท 0:00

Shape
Difficulty
Who's in the maze
More options
Paths
Ways through
Play in the dark
Mazes to print
Save or share

Everything happens in this browser. Print gives you the maze with a name line, and an answer page. A copied link opens exactly the same maze for someone else.

How to solve one

Tricks for any maze

Every maze made here has a way through, and with "Just one" picked there's exactly one.

  • Keep one hand on the wall. Follow the left (or right) wall and never let go. In a maze with no loops, it always gets you out, even if it's the long way round.
  • Work backwards. Start at the finish and trace back towards the start. Mazes are often easier in reverse.
  • Fill in the dead ends. On paper, shade every dead end back to the nearest junction. What's left is the path.
  • Stuck? Press Solution to see the way, or Start again to have another go.
What you'll build

Your own maze generator

You'll describe it to a free AI assistant, paste what it writes into a file, and open it in your browser. No coding needed.

An AI chat assistantClaude, ChatGPT or Gemini. The free version is fine.
A plain text editorNotepad (Windows) or TextEdit (Mac; choose Format then Make Plain Text first).
A web browserAny one will do, plus a printer for paper copies.
First time? Read How to save and open an HTML file. It takes two minutes.
Step by step

Build it in five steps

Step 1 gives you a simple version that works, and each step after it adds more. Yours will look a bit different from the one above, because the AI writes its own version each time.

  1. Ask for the maze generator

    Copy this prompt into your AI assistant:

    Copy this prompt
    I don't know how to code. Please make me a maze generator that runs in a web browser.
    
    Requirements:
    - ONE single HTML file (HTML, CSS and JavaScript together), no external libraries, no internet needed. I will save it and double-click it.
    - Draw a square maze as an SVG picture, with dark walls on a white background.
    - Make the maze with the "depth-first search" (recursive backtracker) method, so every square can be reached and there is exactly one way through.
    - Buttons for the size: Easy (10 by 10), Medium (16 by 16) and Hard (26 by 26), and a "New maze" button.
    - Leave a gap in the top-left wall for the start and in the bottom-right wall for the finish.
    
    Please give me the complete file in one code block, then tell me in simple steps how to save and open it.

    Copy the code, paste it into your text editor and save it as maze.html. Double-click it and press New maze a few times.

  2. Make it playable

    Copy this prompt
    That works, thank you. Please make it playable:
    - Put a mouse emoji at the start and a cheese emoji at the finish.
    - Let me drag along the paths with my finger or mouse, drawing a pink line behind me. I can only move through gaps, never through walls. Going back over my line rubs it out.
    - The arrow keys move one square at a time too.
    - Stop the page scrolling while I drag on the maze on a phone.
    - Start a timer on the first move, and when I reach the cheese show "You made it in 0:42!".
    Send me the complete updated file.
    Always ask for the complete file. Replace everything in maze.html, save, and refresh the tab (F5 or Cmd+R).
  3. Add the solution and printing

    Copy this prompt
    Please add:
    - A "Solution" button that draws the way through in green, and hides it again.
    - A "Print" button that prints the maze in black and white, as big as fits on one A4 page, with a title and a "Name: ____" line, then the same maze with the solution on a second page.
    Send me the complete updated file.
  4. Add circle and heart shapes

    Copy this prompt
    Please add a Shape choice:
    - Square (what we have now).
    - Circle: rings of rooms around a centre room, with more rooms in the outer rings so they stay about the same size. Start at the outside and finish in the middle.
    - Heart and Star: draw the shape on a hidden canvas, keep only the squares whose middle is inside the shape, and make the maze in those.
    Make the maze code work on a list of rooms and which rooms are next to each other, so every shape uses the same maze-making and playing code. Send me the complete updated file.
    This is the hardest step. If a shape comes out broken, paste the problem back to the AI in plain words, such as "the circle maze has walls missing in the middle ring".
  5. Add a name maze and a dark mode

    Copy this prompt
    Please add:
    - A "Your name" shape: type a name, draw it in big bold capitals on the hidden canvas with a bar along the bottom that joins the letters up, and make the maze inside the letters.
    - A "Play in the dark" switch where you can only see the maze in a small circle of torchlight around you.
    - A choice of "Long and winding" paths or "Lots of dead ends" (grow the maze from a random room instead of the newest one).
    Send me the complete updated file.
ADVERTISEMENT ยท IN-ARTICLE
If it goes wrong

Quick fixes

Some parts of the maze can't be reached

Ask the AI: "Make sure the maze-making keeps going until every room has been visited, and only knocks down walls between a visited room and an unvisited one."

The page scrolls when I drag on a phone

Ask the AI to "add touch-action: none to the maze and stop the default action on pointerdown".

My line jumps through walls

Ask the AI to "only allow a move to a room that's joined to the current one with no wall between, and if I move fast, follow the maze's own paths to catch up".

The printed maze is blurry

Draw the maze as an SVG, not a canvas picture, so it stays sharp at any size. Ask the AI to "draw the walls as one SVG path".

It opens as text

Re-save as plain text with exactly .html at the end, not .txt.

Questions

Questions people ask

Is this maze generator free?

Yes. It's free with no sign-up, and every maze is made in your own browser.

Can I print a maze with the answer?

Yes. Press Print for the maze with a name line, and an answer page with the way through drawn in. Under More options you can print a set of 4 or 10 different mazes, with the answers four to a page at the end.

Can I make a maze for kids?

Yes. Pick Very easy or Easy for big paths young children can follow with a finger or a crayon, and choose a character such as the mouse and cheese or Santa and a present. Hard and Expert make mazes that keep adults busy, and Master and Insane are huge ones (up to 90 by 90 for a square) with hundreds of turns, best printed or played on a big screen.

Can I make a maze in the shape of a name?

Yes. Choose Your name and type up to 12 letters. The maze is made inside the letters, with a bar along the bottom joining them up. There are heart, star, circle, hexagon, triangle and Christmas tree mazes too.

Can I play the maze on a phone or tablet?

Yes. Drag your finger from the start along the paths. Going back over your line rubs it out. On a big maze, press Zoom in for wider paths: lift your finger and the view slides along with you, drag anywhere else on the maze to look around, and press Find me to jump back. On a computer you can use the mouse or the arrow keys.

Can I share a maze?

Yes. Press Copy link to this maze and send it: the link opens exactly the same maze. You can also save it as a PNG image or an SVG file, which is sharp at any size and works with cutting machines.

Make it your own

Twist it into something else

Two-player race

the same maze side by side, arrow keys against WASD

Keys and doors

pick up a key to open a locked door on the way

Collect the stars

grab every star before the exit opens

3D maze

walk through it in first person, like an old computer game

Daily maze

a new maze each day, the same for everyone, with best times

Party bag mazes

a name maze for every guest, printed on one sheet

Keep going

What to build next