Lights Out Solver - Free Online Lights Out Puzzle Solver

What Is Lights Out?

Lights Out is a grid puzzle played on an N×N board of cells that are either lit or dark. Clicking any cell flips it and its four neighbours - up, down, left and right - between lit and dark. The goal: turn every light off. It was released as a handheld electronic game by Tiger Electronics in 1995, and it has been a favourite of mathematicians ever since, because hidden underneath it is a beautiful piece of linear algebra.

Two facts make Lights Out special. First, order does not matter: pressing the same cell twice cancels itself out, so a solution is really just a set of cells to press. Second, some boards simply cannot be solved - no press pattern exists that turns every light off - and no amount of clicking will ever change that. This Lights Out solver handles both cases: it gives you the exact cells to press, using the fewest presses when several solutions exist.

Lights Out Rules

  1. Click to flip. Pressing a cell toggles that cell plus its orthogonal neighbours - up to five cells at once, fewer at edges and corners.

  2. Pressing twice = undo. The same cell pressed twice flips its group twice - back to the start. Every cell is pressed 0 or 1 times in an optimal solution.

  3. Order is irrelevant. Any two pressing orders with the same cells pressed produce the same result.

  4. Win condition. The board is solved when every cell is dark.

How to Use the Lights Out Solver

  1. Choose a board size. Tap 3×3 up to 6×6 in the toolbar.

  2. Enter your board. Click cells to toggle them - yellow means lit. Match the board you are stuck on.

  3. Press Solve. The cells you should press light up with blue dots, and the status line shows how many presses are needed.

  4. Read the verdict. The solver also tells you whether the solution is unique or how many solutions exist - and it always shows the one with the fewest presses.

  5. No solution? Some configurations are mathematically impossible - the solver proves it instead of guessing.

  6. Reset or explore. Clear turns every light off, and Example deals a random board that is guaranteed solvable.

What the Solver Tells You

When the board is solvable, the cells to press are marked with blue dots. The most famous position is the 3×3 board with all nine lights on: it has exactly one solution, and it is a thing of beauty - press the four corners and the centre, an X pattern:

Lights Out solver marking the unique X-pattern solution - four corners and the centre - for an all-on 3×3 board

Not every board can be solved. On the 5×5 board only one configuration in four has a solution - the solver proves when yours is one of the hopeless ones:

Lights Out solver proving an unsolvable 5×5 board configuration

The Math Behind the Solver

Lights Out is really a linear algebra problem in disguise. Label each cell with a variable that is 1 if you press it and 0 if you do not. Because pressing is self-cancelling, every flip adds up modulo 2 - the algebra of GF(2), where 1 + 1 = 0. The whole puzzle becomes one system of N² linear equations over GF(2): each light contributes an equation saying "the number of presses among me and my neighbours must be odd if I start lit, even if I start dark".

The solver builds that system and runs Gaussian elimination, which decides everything at once: if a row reduces to 0 = 1, the board is provably unsolvable; the number of free variables tells you there are 2k solutions; and back-substitution produces an actual pressing plan. When several solutions exist the solver enumerates them and returns the one with the fewest presses. The whole elimination takes well under a millisecond even on a 6×6 board - 36 equations, 36 unknowns, solved exactly.

Worked Example: The All-On 3×3 Board

The classic brain-teaser: all nine lights are on. The solver answers instantly - press the four corners and the centre, five presses total, and it is the only solution:

×·×
·×·
×·×

Check it by hand, cell by cell. A corner such as the top-left is flipped only by its own press - one flip, so it goes out. An edge cell like the top-middle is flipped by three presses: both adjacent corners and the centre - odd, so it goes out too. The centre is flipped by all five presses - odd again. Every cell receives an odd number of flips, so all nine lights go out. That symmetry is why the X pattern is the unique answer, and why it is the first thing seasoned players try on an all-on board.

Tips for Solving Lights Out

  • Chase the lights. The workhorse technique: choose the top row's presses, then for every lit cell in row 1 press the cell directly beneath it, and continue downward. The board is solved exactly when the last row ends up dark.

  • Only the first row matters. Because of light-chasing, there are just 2^N possible first rows - 32 on a 5×5 board - and each one determines the whole solution. Brute forcing the top row is a complete strategy.

  • Know when to give up. On the 5×5 board only 1 in 4 configurations is solvable; on the 3×3 and 4×4 boards every configuration works. If light-chasing ends with lights still on in the bottom row, try a different top row - or accept the proof that this one is impossible.

  • Order never matters. Do not waste time re-sequencing: two presses on the same cell cancel, so prune any plan that presses a cell twice.

  • Look for quiet patterns. Some press combinations flip nothing at all. Adding one to a solution produces another solution of the same board - which is exactly why the solver picks the cheapest one for you.

Is Lights Out Good for Your Brain?

Lights Out trains systematic thinking like few other puzzles. Its click-and-cancel structure rewards planning over clicking: strong players spend most of their time choosing a first row, not mashing cells. It quietly teaches parity reasoning (only odd and even matter), working memory for running state, and the deeply useful habit of working backwards from a goal. The jump from "I found a way" to "I found the fewest presses" is a genuine optimization exercise - and the leap to "this board is impossible" is a first taste of mathematical proof.

Frequently Asked Questions

How does this Lights Out solver work?

It models the board as a system of linear equations over GF(2) - one equation per light - and solves it with Gaussian elimination. When several solutions exist it enumerates them and returns the one with the fewest presses.

Can every Lights Out board be solved?

No. On the 3×3 board every configuration can be turned off, but larger boards have "quiet patterns": on the 4×4 grid three quarters of configurations are impossible, and on the 5×5 grid only one quarter have a solution. The solver proves impossibility instantly instead of letting you click forever.

Does the order of presses matter?

No - flips add up mod 2, so only which cells you press matters. Pressing a cell twice is the same as not pressing it at all.

What is light-chasing?

A human technique: pick the top row's presses, then always press under any light still on, row by row. The whole solution is determined by that first row, which reduces a 5×5 puzzle to at most 32 attempts.

Why does my 5×5 board have no solution?

Because the 5×5 grid has "quiet patterns" - press combinations that change nothing - its 2²⁵ configurations collapse into solution classes that cover only a quarter of all boards. Your board is in the other three quarters.

What is the fewest-presses solution?

When a board has several solutions they all differ by quiet patterns; this solver enumerates them and returns the one needing the fewest presses, so you never press more than necessary.

What board sizes does the solver support?

3×3, 4×4, 5×5 and 6×6 - the sizes used by virtually every version of the game, including our free online edition.

Is this Lights Out solver free?

Completely free with no sign-up. Solving runs entirely in your browser after the page loads, so it even works offline.

Play Lights Out Online

Want to flip switches yourself? Play our free lights out game, sharpen your number logic with the 24 Game Solver, or explore more tools like the Sumplete Solver.