Solver · Live
Lights Out Solver,
every light off in the fewest presses.
Use this free Lights Out solver to switch off every light in the fewest presses. Tap the cells to copy your board, anywhere from 3×3 up to 9×9, and a press map shows exactly which cells to press, with a step-by-step replay. It also tells you when a position has no solution.
Interactive
Lights Out Solver
Board size5×5
Rows
Columns
Set the lights
Tap a cell to turn its light on or off so the board matches your puzzle. Tapping here only sets the lights; it does not press. Random makes a board that can always be solved.
Shortest solution
15presses
4 different press patterns clear this board. This is the shortest. The order of presses never matters.
On a 5×5 board only 1 pattern in 4 can be cleared, because 2 "quiet" press patterns change nothing.
Solved in 15 presses. Press the ringed cells, in any order.
Your board has 25 lights on. Step through to watch the 15 presses switch them off.
25 lights are on. Lit cells glow yellow; ringed cells are the ones to press.
Field guide
How the Lights Out Solver works.
Lights Out is a puzzle played on a grid of lights that are each on or off. Pressing a cell flips that light and the lights directly above, below, left and right of it. The goal is to switch every light off. The rules are tiny, yet pressing one cell disturbs five lights at once, which is what makes a hand-made solution so hard to find by trial and error.
Using the solver
Choose the number of rows and columns, then tap cells until the lit ones match your puzzle. Tapping here only sets the lights; it does not press anything. As soon as the board is entered, rings appear on the cells to press, and the card on the left shows the shortest number of presses. Use All on, All off or Random for quick setups, and the step controls to replay the presses one at a time and watch the lights go out. Copy press map puts the answer on your clipboard as text.
Why linear algebra solves it
Each cell is either pressed or not. Pressing a cell twice undoes itself, and the order of presses never matters, so a solution is simply a set of cells. A light finishes in a different state from where it started exactly when it was flipped an odd number of times, which gives one equation per light:
Here the sum is taken in arithmetic where 1 + 1 = 0. A 5×5 board gives 25 such equations in 25 unknowns. The solver reduces them with Gaussian elimination over that two-element arithmetic, which takes only a few milliseconds even on a 9×9 board.
The shortest solution
Some press patterns change nothing at all. Add one of these “quiet patterns” to a solution and you get a different solution. A 6×6, 7×7 or 8×8 board has none, so each solvable position has exactly one answer. A 5×5 board has two quiet patterns, so every solvable position has four answers, and the 9×9 board has eight, giving 256. The solver tries every combination and shows the one with the fewest presses.
Worked example
Take a 3×3 board with all nine lights on. Press the centre and the four corners, five presses in all. The centre light is flipped once, by the centre press. Each corner is flipped once, by its own press. Each edge light is flipped three times: once by the centre and once by each of its two neighbouring corners. Three is odd, so those lights go out as well. This board has no quiet patterns, so these five presses are the only solution.
Why some positions cannot be solved
When quiet patterns exist, not every arrangement of lights can be cleared. On a 5×5 board only one pattern in four is solvable. A position is solvable exactly when the number of lit cells it shares with each quiet pattern is even. If yours fails that test, the solver reports it, and it also looks for single cells whose flip would pass the test. Those are outlined in red, because a mis-entered light is the most common cause.
Tips for solving by hand
- Chase the lights downward. Press cells in the row below to turn off the lit cells in the row above, then repeat down the board. Only the last row can still hold lit cells.
- Fix the top row first on a small board. Try each pattern of presses along the top, chase the lights down, and keep the pattern that leaves the bottom row dark.
- Mark your presses. Because two presses on the same cell cancel out, keeping a note of what you have pressed (this tool uses rings) stops you from undoing your own work.
Disclaimer: This tool is an independent fan creation and is not affiliated with, authorized, or endorsed by Tiger Electronics or Hasbro, Inc. “Lights Out” is a trademark of its respective owner and is used here only to describe the type of puzzle. Provided for practice and entertainment only.