Pressing a light toggles it and its four neighbors. Turn every light off in as few moves as you can. Every random board is guaranteed solvable, and the built-in solver can give a hint or the full solution.
Moves0
Minimum-
Lights on0
Time0:00
Turn off all the lights.
Pressing a light toggles it and its neighbors above, below, left and right. Keys: arrows to move, Enter or Space to press, H hint, U undo, N new game.
Advertisement
Advertisement
How to use the Lights Out Game
Pick a board. 5x5 is the classic. Choose a difficulty and press New game.
Press a light. Clicking a square toggles it and the squares directly above, below, left and right of it.
Turn them all off. Plan your presses to switch off every light. The counter shows your moves against the minimum possible.
Stuck? Press Show hint to light up one square from the shortest solution, or Show solution to mark every square you still need to press.
Solve your own board. Turn on Edit mode, set the lights to match any puzzle, then use the solver.
How to solve Lights Out by hand: light chasing
You can solve any solvable 5×5 board without a computer using the light chasing method:
Chase down. Starting with the top row, for every light that is on, press the square directly below it. Do this for rows 1 to 4. Now only the bottom row can have lights on.
Look up the bottom row in the table below (1 = on, read left to right).
Press the top-row squares shown in the table, then chase the lights down again exactly as in step 1. All lights are now off.
Bottom row lights left on
Press in the top row
1 0 0 0 1
4th and 5th (0 0 0 1 1)
0 1 0 1 0
2nd and 5th (0 1 0 0 1)
1 1 1 0 0
2nd (0 1 0 0 0)
0 0 1 1 1
4th (0 0 0 1 0)
1 0 1 1 0
5th (0 0 0 0 1)
0 1 1 0 1
1st (1 0 0 0 0)
1 1 0 1 1
3rd (0 0 1 0 0)
If the bottom row shows any other pattern, the board is not solvable. Light chasing is easy to remember, but it rarely uses the fewest moves. The solution overlay in this game always shows a minimum solution.
The math behind Lights Out
Because pressing a square twice does nothing and the order of presses does not matter, Lights Out is a system of linear equations modulo 2. For an n×n board, each of the n² squares is a variable (press it or not) and each light gives one equation: the light ends up off if it was toggled an odd number of times when it started on, or an even number of times when it started off.
Board
Squares
Solvable patterns
Solutions per solvable board
3×3
9
All (29 = 512)
1
4×4
16
1 in 16 (212)
16
5×5
25
1 in 4 (223)
4
6×6
36
All
1
7×7
49
All
1
The solver in this page runs Gaussian elimination over GF(2), then checks every combination of the null space vectors (4 on the 5×5 board, 16 on 4×4) and keeps the solution with the fewest presses.
Frequently asked questions
How do you play Lights Out?
The game is a grid of lights, some on and some off. Pressing any light toggles it and its orthogonal neighbors (up, down, left and right). The goal is to switch every light off. Pressing the same square twice cancels out, and the order of presses does not matter, so a solution is just a set of squares to press once.
Is every Lights Out puzzle solvable?
No. On the 5x5 board only 1 in 4 possible patterns can be solved, because the press matrix has a two-dimensional null space over GF(2). This game creates random boards by pressing random squares from the all-off state, which guarantees every board it gives you is solvable. In Edit mode the solver tells you if your custom board has no solution.
What is the fewest number of moves to solve 5x5 Lights Out?
Every solvable 5x5 board can be solved in at most 15 presses. Each solvable board has exactly four different solutions, and the solver here always shows the one with the fewest presses.
Is there a trick to solving Lights Out by hand?
Yes, the light chasing method. Go row by row from the top: for every light that is on, press the square directly below it. This clears all rows except the bottom one. Then look up the bottom row pattern in a small table, press the matching squares in the top row and chase the lights down again. The table is in the guide below.
How does the solver work?
Each press is a 0 or 1 variable and each light gives a linear equation modulo 2. The solver uses Gaussian elimination over GF(2) to find one solution and the null space, then tries every combination of null space vectors and keeps the solution with the fewest presses.
Who invented Lights Out?
Lights Out was released as a handheld electronic game by Tiger Electronics in 1995. Earlier puzzles with the same toggling idea existed, such as Merlin's Magic Square in the 1970s, and the mathematics behind it has been studied since the 1980s.