Pentomino solver

Draw a region or pick the classic 6 by 10 rectangle, and the pentomino solver finds every way to tile it with the 12 pentominoes and counts them, with and without symmetry.

Shapes

Tap or drag over cells to add them to the region or take them out. The region needs a multiple of 5 cells, up to 60.

Solver

How to use the pentomino solver

This pentomino solver tiles a region of your choice with the 12 pentominoes and counts every solution. Pick a shape (the classic 6 by 10 rectangle, 5 by 12, 4 by 15, 3 by 20, or an 8 by 8 square with a 2 by 2 hole in the middle), or draw your own: tap or drag over the cells to add them to the region or take them out. Then press Find every solution. The pieces are shown in color with their letters, and you can step through the solutions with Previous and Next.

A region of 60 cells uses every piece exactly once. A smaller region (any multiple of 5) uses as many different pieces as it needs, each at most once, so a 5 by 5 square takes 5 of the 12. Untick Pieces may be flipped over for one-sided pieces that can only be turned, not mirrored.

The 12 pentominoes

A pentomino is a shape made of five squares joined edge to edge. There are exactly 12 of them, named after the letters they resemble: F, I, L, N, P, T, U, V, W, X, Y and Z. Counting every rotation and mirror image separately they can lie in 63 different ways on a grid (the X has only one, the I two, and the F, L, N, P and Y eight each), which is what the solver tries.

How many solutions does the 6 by 10 rectangle have?

The solver finds 9,356 ways to fill the 6 by 10 rectangle with the 12 pentominoes. The rectangle can be turned half a turn or mirrored in two directions, and each of those moves turns one solution into another, so the solutions come in groups of four: 2,339 different solutions up to rotation and reflection. The long 3 by 20 rectangle is far harder to fill: it has only 8 tilings, which are 2 different solutions up to symmetry. Our test suite computes these counts with this solver and checks every kept solution against the rules.

Counting up to symmetry

For any region you draw, the solver first works out which rotations and reflections map the region onto itself (a rectangle has 4, a square or the 8 by 8 with a center hole has 8, an irregular shape usually only 1). Two solutions that are such a rotation or reflection of each other count once in the "up to rotation and reflection" figure. The first figure counts every tiling as it lies.

How the solver works

Tiling a region is an exact cover problem: every cell must be covered exactly once, and every piece used once (or at most once, for smaller regions). The solver lists every way to place every piece in the region, one row per placement, and runs Donald Knuth's Algorithm X with dancing links. At each step it picks the cell (or piece) with the fewest placements left, tries each of them, and backs up when some cell can no longer be covered. The full 6 by 10 count takes about 3.8 million steps: around 11 seconds in our test on a laptop and about 21 seconds in a browser, with the running count shown while it searches. You can stop at any time and keep the solutions found so far.

Every solution is checked before it is counted: each region cell is covered once, no piece appears twice, and each piece's five cells really form that pentomino. Our tests also compare the solver with a separate, plain backtracking tiler on many small regions, and the counts match exactly.

Tips for solving by hand

Place the awkward pieces first: the X fits in few places, so decide early where it goes. Keep the remaining empty area in sections whose size is a multiple of 5; a section of 7 cells can never be filled. Corners suit the V, L and P.

Pieces on a grid are also the heart of the block puzzle solver, which picks the best order and spot for three pieces at a time on an 8x8 board.

Solver tested . Found a problem? Tell us.

Questions

How many solutions does the 6x10 pentomino puzzle have?

2,339 different solutions up to rotation and reflection, which is 9,356 tilings when mirror images and turned copies count separately. This solver computes both figures; press 6 by 10 and Find every solution.

Which rectangles can the 12 pentominoes fill?

Four rectangles have exactly 60 cells and are tileable: 6 by 10, 5 by 12, 4 by 15 and 3 by 20. Each is a preset on this page, so you can count their solutions yourself.

Can I use only some of the pieces?

Yes. Draw a region with fewer than 60 cells (a multiple of 5) and the solver uses that many different pieces, each at most once, choosing whichever combination fits.

What does flipping a piece mean?

Turning it over, which gives its mirror image. With flipping allowed each piece can lie in up to 8 ways; one-sided pieces (untick the option) can only be rotated, which gives fewer tilings.

Why does it say the region needs a multiple of 5 cells?

Every pentomino covers exactly 5 cells, so a region that the pieces fill exactly must have 5, 10, 15 and so on cells, up to 60 for all twelve.