Search for a tool
Lights Out Solver

Tool/solver to resolve the Lights Out levels (Tiles Flip), a puzzle game based on a change of state/color of the cells of a grid (and its neighbours).

Results

Lights Out Solver -

Tag(s) : Mobile Games

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Lights Out Solver' tool for free! Thank you!

Lights Out Solver

Lights Out Grid Solver


Loading...
(if this message do not disappear, try to refresh this page)

0 (or empty) = Off or 1st state/color, 1 = On or 2nd state/color, 2 = 3rd state/color etc.







Loading...
(if this message do not disappear, try to refresh this page)

Answers to Questions (FAQ)

What is the Lights Out game? (Definition)

Lights Out (or Flip Tiles game) is an electronic puzzle game composed of a grid of lighted (sometimes with bulbs or switches) or numbered cells (originally 5x5) which consists of turning off all the lights in a grid.

At the start of the game, a pattern of cells is lit (different states). By pressing one of the boxes, it acts like a switch, it changes state (it goes from on to off, or flips from off to on or changes color), as well as the four adjacent boxes (neighboring top, right, bottom and left).

The goal of the game is to switch all the lights to the off (or on) position, preferably by pressing as few boxes as possible.

How to play Lights Out?

The player must think about which squares to press to turn off all the lights.

Example: A game board with 2 states: 0 or 1 is in the initial position:

000
000
000

A click on the middle box gives the following result:

010
111
010

(the box clicked as well as the 4 adjacent cells (top, bottom, right, left) have changed state)

For a game with $ n $ states, pressing a box $ n $ times returns it to its initial state.

How to solve a Lights Outs grid?

By hand

— Work row by row (or column by column): start by solving the first row.

— Click on the boxes in the second row to correct the errors in the first.

— Repeat until the last row.

Mathematically

— Represent the grid (initial state of the puzzle) as a vector $ \vec{b} \in \mathbb{F}_2^n $ (with $ \mathbb{F}_2 $ the finite field, 2 corresponding to the number of states)

— Construct the matrix $ A $ of the effects of clicking on the grid ($ A_{ij} = 1 $ if clicking on $ j $ affects $ i $).

— Solve the system $ A \vec{x} = \vec{b} $ in $ \mathbb{F}_2 $.

With a solver

— Specify the initial state of the grid and the number of possible states (usually 2 for black/white or on/off)

— Click on solve

Is a Lights Out grid always solvable?

No, not all configurations are solvable.

If all lines are solved except the last row and it can be turned off by clicking only the last row, then the configuration is solvable, otherwise it is unsolvable.

Mathematically, solvability depends on the image of the matrix $ A $. A configuration $ \vec{b} $ is solvable if and only if it belongs to the image of $ A $ in $ \mathbb{F}_2^n $

Are there different variants of Lights Out?

There are several variations and options in Lights Out:

— Grid size: Various grid formats are possible, ranging from 3x3, 4x4, 5x5, 6x6 to larger or even rectangular grid sizes (dCode accepts any square or rectangular grid size).

— Random or defined starting state: Lights can start in various configurations (dCode accepts any initial state).

— Empty or defined final state: Lights may need to be in a specific final configuration (dCode only accepts a uniform final state of all off or all on, but it is possible to return to a defined final state by solving the initial state and then the final state: the state changes required to turn off a configuration are the same as those required to turn it on).

— Cross or custom pattern: The cross pattern of neighboring cells can be customized to affect other cells (dCode accepts any 3x3 pattern; the center cell can also remain unchanged).

— Limited actions: The number of allowed state changes can be restricted to increase difficulty (use dCode to obtain the solution with the minimum number of moves)

— Timed game: A countdown can add an extra challenge to completing the game within a given time limit (use dCode to get the solution quickly)

— Obstacles: Some variants introduce black squares that cannot be changed (dCode does not handle inert cells, but if dCode provides a solution, then it is valid whether or not there are black/empty cells, if dCode does not provide a solution, try changing the initial state to 1 for one or more of these cells)

What is the optimal strategy for Lights Out?

An effective strategy is to observe the patterns and symmetries in the grid, if there are any, then carry out symmetrical actions: bulb on the right then bulb on the left etc.

The optimal strategy, however, is to perform linear algebra mathematical calculations that allow all the grids to be mathematically resolved.

Source code

dCode retains ownership of the "Lights Out Solver" source code. Any algorithm for the "Lights Out Solver" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Lights Out Solver" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Lights Out Solver" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Lights Out Solver" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/lights-out-solver

In a scientific article or book, the recommended bibliographic citation is: Lights Out Solver on dCode.fr [online website], retrieved on 2025-06-15, https://www.dcode.fr/lights-out-solver

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Lights Out Solver' tool for free! Thank you!


https://www.dcode.fr/lights-out-solver
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback