🌙 NightlitBlog

Lights Out Puzzle Solver: How to Solve Any 5x5 Board

Published · Nightlit

Stuck on a Lights Out board? Use the solver below to get the answer, then read on to learn the method it uses, so next time you won’t need it. Everything here works for the classic 5x5 Lights Out, for Tiger’s original handheld, and for Nightlit, our free daily version where the goal is to turn every tile gold.

Lights Out 5x5 solver

Tap the tiles that still need to change (lit in classic Lights Out, dark in Nightlit). Then press Solve.

Mark your board above.

How to enter your board

Tap every tile that still needs to change. In classic Lights Out those are the tiles that are on. In Nightlit they’re the tiles that are still dark. The rule is the same either way: tapping a tile flips it and the tiles directly above, below, left and right of it. That’s why one tool can solve both.

The solver then shows the fewest taps that finish the board. Tap order doesn’t matter, so you can work through the marked tiles in any order you like.

The method the solver uses

A computer could brute-force every combination, but you don’t need to. Lights Out on a 5x5 grid has a method you can run in your head. It has three steps.

Step 1: Chase the lights

Work from the top row down. For every tile in row 1 that still needs to change, tap the tile directly below it in row 2. That tap fixes the tile above without disturbing anything else in row 1. Then do the same for row 2 (tapping in row 3), row 3 (tapping in row 4) and row 4 (tapping in row 5).

After this pass, rows 1 to 4 are clean. Whatever is left sits in the bottom row, where there is nothing below to fix it from. That’s expected.

Step 2: Read the bottom row

On a 5x5 board, only eight bottom rows can be left after a chase, including the empty one. Each has a fix in the top row. Columns are numbered 1 to 5 from the left, X is a tile that still needs changing and . is a finished tile.

Bottom row left over Tap in the top row
X X X . . 2
. . X X X 4
X . X X . 5
. X X . X 1
X X . X X 3
X . . . X 1 and 2
. X . X . 1 and 4

Step 3: Chase again

Make those top-row taps. The top of the board will look messy again; that’s fine. Chase the lights down one more time exactly as in step 1, and the board finishes on the last row.

If your bottom row isn’t in the table, the board can’t be solved. That happens with three out of every four random 5x5 patterns, which is why good versions of the game only hand out boards made by scrambling a solved grid. Every Nightlit board is built that way, so a solution always exists.

A worked example

Here’s a real board. X marks the tiles that need to change.

. X . . X
. X X X .
X X . X .
. . . . X
. . X X .

First chase. Row 1 has X in columns 2 and 5, so tap row 2 in columns 2 and 5. Row 2 is then left with X in columns 1 and 5, so tap row 3 there. Row 3 is left with column 2, so tap row 4 column 2. Row 4 is left with columns 2 and 3, so tap row 5 there. Seven taps, and the bottom row reads X X X . ..

Read the table. X X X . . means tap the top row in column 2.

Second chase. Chase down again from that new top row and the board clears. If you started fresh with the full set of taps and cancelled any tile you’d tap twice, you’d finish in 13 taps.

That works, but 13 is a lot. This board can be solved in 5.

How to get the shortest solution

The 5x5 board has three “quiet patterns”: sets of taps that change nothing at all, because every tile they touch gets flipped an even number of times. Here they are (X = tap):

Quiet A      Quiet B      Quiet C
X . X . X    X X . X X    . X X X .
X . X . X    . . . . .    X . X . X
. . . . .    X X . X X    X X . X X
X . X . X    . . . . .    X . X . X
X . X . X    X X . X X    . X X X .

Because they change nothing, you can add any of them to a solution and it still works. Taps that appear in both cancel out (tapping a tile twice does nothing). So every solvable board has exactly four solutions: the one from chasing, and that one combined with A, B or C. One of the four is the shortest.

In the example, the chase solution has 13 taps. Combined with quiet pattern C, nearly everything cancels and you’re left with 5 taps: row 1 columns 3 and 4, row 3 column 2, and row 4 columns 3 and 4. That’s what the solver above does: it runs the chase, tries all four versions and shows you the smallest.

In Nightlit, that shortest count is the board’s par. Hit par for three stars.

A quick check: can this board be solved?

You don’t have to chase to find out. Count the X tiles that sit on quiet pattern A. Then count the X tiles that sit on quiet pattern B. If both counts are even, the board is solvable. If either one is odd, no sequence of taps will finish it. Our example has 4 and 6, both even.

This works because every single tap flips an even number of tiles on each of those patterns, so it can never change whether the count is odd or even.

Numbers worth knowing

We ran every possible 5x5 board through a solver to check these:

Tips for solving without the solver

For a gentler walkthrough of the same method, see How to Solve Lights Out Puzzles. For where the game came from, read Lights Out: Rules, History and Strategy.

Try it on today’s board

The method sticks fastest when you use it once on a fresh board. Open today’s Nightlit, chase the lights down, check the table, and see if you can find the par solution before you reach for the solver.

Play today's Nightlit, free