Skip to main content

Puzzle Solver

Light Out Solver

Build any 2×2 to 5×5 Lights Out board, toggle cells, and get the exact optimal move sequence using Gaussian elimination over GF(2).

Classic grid puzzle

Light Out Solver

Build any 2x2 to 5x5 Light Out puzzle, switch between linked play and manual edit mode, then solve it with the same optimal Gaussian-elimination logic from the original project.

Interactive board

Tap any bulb to toggle it and its neighbors together.

5 x 5

Build a puzzle or randomize one, then solve it.

Solution steps

Solve a board to see the guided move path.

Lights Out solver

My white whale with Lights Out was a 5×5 board inside a game collection I will not name — twenty minutes of pressing, three times reset, zero lights saved. That is the night I looked up whether the puzzle has actual math behind it. It does. Lights Out is a linear system in disguise: every press toggles a tile and its four neighbors, and the solver below computes the exact press set that clears any board, using Gaussian elimination over a two-value number system. This page has the solver, the by-hand method I use instead of it nine times out of ten, and the two facts that make the whole game click.

Two facts about Lights Out that change how you see it

Fact one: pressing a tile twice cancels out. Whatever the first press did, the second undoes it. So no useful solution ever presses the same tile twice, and a solution is not a sequence at all — it is a set of tiles.

Fact two: order does not matter. Toggle operations commute; pressing tile A then tile B lands the board in exactly the same state as B then A. Together the two facts mean every board is really asking one question: which subset of tiles, pressed once each, turns everything off?

That is why the game feels different from every other puzzle on this site. There is no feedback loop, no guessing, no partial credit. The answer exists or it does not, and once you know the set, nothing can go wrong executing it. I find that oddly calming now, though the twenty-minute board predates the calm.

The consequence worth memorizing

A Lights Out solution is a set, not a sequence. Press the tiles in any order, scramble them, reverse them — the board cannot tell the difference.

How the solver finds the exact press set

Under the hood, this is the cleanest math on the site. Each light contributes one equation: "the number of presses among this light and its neighbors, counted modulo two, must equal its current state." On or off, one or zero — the entire puzzle lives in a number system with two elements.

Stack all those equations and you get a linear system, and the solver runs Gaussian elimination on it, adapted for that two-value arithmetic. The output is a provably correct press set: if it says press these tiles, pressing exactly those clears every light, on any board size, computed in milliseconds.

The reason I trust it completely — and the reason it never "fails" the way hint systems do — is that there is no heuristic anywhere in it. It is not pattern-matching against known boards or guessing promising regions. It is the same elimination you would do by hand if you had unlimited patience, done instantly, and provably minimal in structure. Writing it took me an evening; checking it against hundreds of random boards took longer, which tells you where the real work lives.

Chasing the lights: the method I actually use by hand

Geometry matters while you chase: a center press flips five tiles, an edge press four, a corner press three. Corners are the easiest tiles to reason about and the cheapest to fix, which is a nice inversion of most grid puzzles. When I am stuck mid-chase, the corner cases are where I re-verify first, because they are the ones my eye most often clips.

The chase, in four moves

  • Top row: press the tile below every light that is on
  • Move down one row and repeat, pushing lights toward the floor
  • Reach the bottom row and read its remaining light pattern
  • Press the corresponding top-row tiles, chase down once more, done

One solution, several solutions, or none at all

Some boards have a unique press set. Some have several equally valid ones, related by what players call quiet patterns — small sets of presses that cancel out entirely, like the all-on row pattern, which you can add to any solution to get another solution with the same result. If you use the solver and get a different press set than a friend did, you can both be right.

And some boards have no solution at all. On classic 5×5 grids only a fraction of configurations are solvable, which retroactively explains at least one of my childhood afternoons. The solver detects these directly — the elimination has no consistent answer, and it tells you so instead of inventing one.

That no-solution detection is the feature I would keep if I had to delete everything else. Before I understood unsolvable boards existed, I assumed every failure was my failure, and I pressed tiles at random for minutes on end. Knowing that some states are mathematically dead ends is not defeatism. It is the difference between searching and thrashing.

Board sizes: what changes and what does not

The solver handles everything from 3×3 minis to the classic 5×5 and larger custom layouts, because the elimination just scales — bigger board, bigger system, same two-value arithmetic, same exact answer.

What changes by hand is the feel. Small boards have few possible states and can seem random, almost scrambly; the 5×5 has enough structure for the chase to feel like a method rather than a shuffle. The bottom-row mapping differs per size, so my memorized 5×5 table does me no good on a 4×4 — the first few runs on any new size go through the solver until the table builds itself in my head.

If you are learning, start at 3×3 deliberately: the chase is short enough to hold in your head, and every concept — sets, quiet patterns, dead ends — shows up in miniature. My recommendation as someone who came to the math embarrassingly late: small board first, math second, 5×5 white whale third.

Where you will actually meet this puzzle

Lights Out lives everywhere except the front of the shelf: as a minigame inside larger games, in puzzle collections, in speedrun categories, and in math classrooms as the friendliest possible introduction to linear algebra over finite fields. Every one of those settings is a good reason to have a solver bookmarked.

The classroom use is the one I defend to skeptics. Set up a board, solve it by hand with the chase, then run the solver and compare — the press set is a worked solution to a real linear system, and seeing elimination produce a set of tiles you can physically press makes the abstraction land in a way textbook exercises never managed for me.

And the speedrun angle is real: knowing the exact press set ahead of time turns the run into motion practice instead of problem-solving. Whether that is in the spirit of the category is above my pay grade. The math does not judge.

Lights Out solver questions

How does the Lights Out solver work?

It turns every light into an equation over a two-value system — on or off — and solves the whole stack with Gaussian elimination. The output is the exact set of tiles to press, provably correct on any solvable board.

Does the order of presses matter in Lights Out?

No. Pressing a tile twice cancels out, so a solution is a set of tiles rather than a sequence. Any order clears the board equally well.

Can every Lights Out board be solved?

No — some configurations are mathematically dead ends, and on classic boards only a fraction of states are solvable. The solver detects these and says so instead of pressing forever.

What is the chase method?

The standard by-hand solve: work top to bottom, pressing below each lit tile to push the lights down, then read the bottom row's pattern to determine your top-row presses. One more chase and the board is dark.

Does the solver work for any board size?

Yes — the same elimination scales from 3×3 minis to 5×5 classics and larger custom grids. Only the memorized bottom-row mappings differ by size.

More WordSolverX tools

Photo of Preston Hayes

Written by

Preston Hayes

Preston Hayes is the credited editor for WordSolverX answer pages and puzzle strategy content. His work focuses on clear answer presentation, source verification, solver guidance, and fast corrections when a game changes.