Lights Out Solver
How to use the Lights Out solver
Choose the size of your board, then in Set up my board tap every square that is lit. Press Solve and the squares to press are marked. Press each one once, in any order; tap them here and the board follows along. In Play, tapping a square presses it, so you can try it yourself first and ask for the solution when you are stuck.
Not every Lights Out works the same way. In the classic game a press toggles the light and the four beside it, but some versions skip the light itself, or reach all eight around it, and some want every light on rather than off. Set the rule and the goal to match yours.
Why some Lights Out boards cannot be solved
Pressing a light twice undoes it, and the order of presses makes no difference, so a solution is just a set of squares, each pressed once. Each light then gives one equation: the number of presses that reach it must be odd if it starts lit and even if it starts dark. Solving those equations, with arithmetic that only cares about odd and even, either finds the presses or proves there are none.
On a 5 by 5 board only one pattern in four can be switched off. The other three quarters are impossible however long you try, and the solver says so rather than searching forever. The boards that can be solved have four different solutions each, and the page gives the one with the fewest presses. The original all-lit 5 by 5 takes 15. On 4 by 4 only one pattern in sixteen can be solved, while 3 by 3, 6 by 6, 7 by 7 and 8 by 8 boards can always be solved, in exactly one way.
How to solve Lights Out by hand: chase the lights
Go down the board a row at a time. For every light that is on in a row, press the square directly below it. That switches it off without touching the rows above, and when you reach the bottom every light is off except some in the last row. On a 5 by 5 board, look that bottom row up in this table, press the matching squares in the top row, and chase the lights down again. This time the board clears.
| Bottom row still lit | Press in the top row |
|---|---|
If your bottom row is not in the table, the board was one of the three quarters that cannot be solved. The table was worked out by this page's own code, chasing every possible top row.
More puzzles that are really mathematics
The 15 puzzle solver has the same "half of them are impossible" twist, proved the same way by parity, and the Tower of Hanoi solver is another puzzle a few lines of mathematics take apart. If you would rather hold the puzzle in your hands, our brain teasers are made of wood and metal and have no batteries to run out. There are more solvers on the puzzle tools page.
Frequently Asked Questions
How do you solve Lights Out?
Chase the lights: go down the board a row at a time, pressing the square below every light that is on. Only the bottom row is left lit. On a 5 by 5 board a short table tells you which top-row squares to press; press them and chase again, and the board clears. Or enter your board here and press the marked squares.
Can every Lights Out puzzle be solved?
No. On a 5 by 5 board only one pattern in four can be switched off, and on 4 by 4 only one in sixteen. On 3 by 3, 6 by 6, 7 by 7 and 8 by 8 boards every pattern can be solved, in exactly one way.
Does the order of presses matter in Lights Out?
No. Every press toggles the same lights whenever you make it, and pressing a square twice undoes it, so a solution is just a set of squares, each pressed once, in any order.
What is the fewest number of moves for 5x5 Lights Out?
It depends on the pattern. For the original fully lit 5 by 5 board it is 15 presses. Solvable 5 by 5 boards have four different solutions each, and the solver gives the shortest.
What if my Lights Out game works differently?
Some versions toggle only the four neighbours, or all eight around a light, or want every light on rather than off. Choose the press rule and the goal to match your game and the solver uses them.