Lights Out
Press a cell and its neighbours flip. It is linear algebra in disguise — only about a quarter of 5x5 patterns can be cleared at all.
It is linear algebra wearing a puzzle costume
Pressing a cell twice is the same as never pressing it, and the order you press in makes no difference at all. That means a solution is not a sequence of moves but a set of cells — and it makes solvability something you can decide rather than something you discover by trying. The solver here does Gaussian elimination over the two-element field, which is the same arithmetic with "add" meaning "flip".
That structure has a consequence worth knowing: on the 5 × 5 board only about a quarter of all possible light patterns can be turned off at all. Randomly lighting cells to make a puzzle therefore produces an impossible one three times in four. This generates puzzles by pressing random cells instead, which guarantees a solution exists by construction — and on the 3 × 3 board the question does not arise, because every single pattern is solvable there.
How to use
- Press any cell to flip it and its four neighbours.
- Turn every light off to win.
- Order never matters — a solution is a set of cells, not a sequence.
- Use Hint for the next press of a shortest solution.
Frequently asked questions
How do you solve Lights Out?
By treating it as linear algebra rather than trial and error. Pressing a cell twice is the same as not pressing it and the order makes no difference, so a solution is a set of cells rather than a sequence. That turns the puzzle into a system of equations over the two-element field, which Gaussian elimination solves directly.
Is every Lights Out board solvable?
No, and this surprises people. On the standard five by five board only about a quarter of all possible light patterns can be cleared at all, because the press matrix has a two-dimensional null space. On a three by three board every pattern is solvable, because there the null space is trivial.
Why does pressing order not matter?
Because each press flips a fixed set of cells, and flipping is its own inverse. Two flips of the same cell cancel regardless of what happened in between, so only the number of times each cell is pressed matters — and only that number modulo two. The whole game lives in arithmetic where one plus one is zero.
How is a solvable puzzle generated?
By starting from a cleared board and pressing random cells, which guarantees a solution exists because the presses themselves are one. Generating a puzzle by lighting random cells instead produces an impossible board three times in four on the five by five, which is a genuine bug in a lot of implementations.
How many solutions does a solvable board have?
Exactly four on the standard five by five, because the null space has dimension two and two to the power two is four. Any solution can be combined with either of the two patterns that leave the board unchanged, in any combination, to give another valid solution of possibly different length.
What is the fewest presses needed?
It varies by board, and the solver here reports the length of the solution it finds rather than claiming it is shortest. Since a solvable five by five board has four solutions, the genuinely shortest one is whichever of those has the fewest cells — worth knowing if you are chasing an efficient clear rather than just a clear.
Do corner and edge cells behave differently?
Yes, and it is why the puzzle is not trivially symmetric. A corner press flips three cells, an edge press four and an interior press five, because neighbours off the board simply do not exist. That asymmetry is what makes the equations interesting rather than uniform.
Does the puzzle get harder on a bigger board?
Harder to do by hand, certainly, but not in a simple way — the structure of the null space changes irregularly with size rather than growing steadily. Some sizes have no null space at all, so every pattern is solvable; others have a large one, so most patterns are not.
What is the null space, in plain terms?
The set of press patterns that change nothing at all — press every cell in one and the board comes back exactly as it started. On the five by five there are four such patterns including the empty one, and they are why a solvable board always has exactly four solutions rather than one.
Can I solve it without the maths?
Yes, and the usual hand method is chase the lights: work down the board pressing the cell directly below any lit one until only the bottom row remains, then look up which of a small number of top-row presses fixes it. That method is really Gaussian elimination performed by hand without saying so.
Where did Lights Out come from?
It was released as a handheld electronic toy by Tiger Electronics in 1995, with a five by five grid of lit buttons. The underlying mathematics had been studied before that under other names, and the puzzle has since become a standard example in introductions to linear algebra over finite fields.
Does the game save my progress?
No. Everything runs in your browser and nothing is stored or uploaded, so closing the tab loses the current board. Puzzles are generated fresh each time from random presses, which is also why every one you are given can definitely be solved.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.