8 Queens Puzzle

Place eight queens on the chessboard so that no two attack each other. Tap a square to start.

Queens 0/8 Time 0:00

Tap a square to place a queen. Tap it again to remove it.

What is the 8 queens puzzle?

The eight queens puzzle asks you to place 8 queens on an 8×8 chessboard so that no two share a row, a column or a diagonal. It has 92 solutions, and 12 of them are unique: the other 80 are rotations and reflections of those 12.

Logical Thinking

Develop logical reasoning skills by analyzing possible queen positions and anticipating conflicts.

Problem Solving

Enhance problem-solving abilities through strategic thinking and planning.

Algorithmic Thinking

Learn fundamental algorithm concepts like backtracking and optimization.

How to solve the 8 queens puzzle

Each row can hold only one queen, so work row by row: put a queen on the first safe square of the row, move to the next row, and when a row has no safe square left, go back and move the previous queen. That method is called backtracking. Press Watch backtracking on the board above to see it step by step, or read the step-by-step solving guide.

The 8 queens problem in programming

It is a classic exercise in recursion and backtracking in computer science courses and coding interviews; Edsger Dijkstra used it in 1972 to explain structured programming. See complete, explained code for the 8 queens problem in Python, Java, C++ and JavaScript.

History and the N queens version

Chess composer Max Bezzel published the puzzle in 1848, and Franz Nauck gave the first solutions in 1850 along with the general N queens version on an N×N board. Every board size from 4×4 up has solutions: try the 4 queens puzzle (2 solutions), the 5 queens puzzle (10) or the 6 queens puzzle (only 4). More in the history of the eight queens puzzle.

Why Play the Puzzle?

92 Solutions, 12 Unique

The 8x8 board has 92 solutions; 12 are unique and the rest are rotations or reflections of them.

View Solutions

Interactive Practice

Play on an interactive board with instant visual feedback. Learn from mistakes and improve your strategy.

Start Playing

Learning Guides

Learn strategies, algorithms, and advanced techniques to solve the puzzle efficiently.

Learn More

Explore All Variations

Discover different board sizes and difficulty levels of the queens puzzle.

8 Queen Puzzle

The classic 8 queens puzzle with all 92 solutions.

Explore

N Queens Puzzle

Generalized variations of the N queens puzzle.

Explore

Complete Solutions

Complete database of solutions for all board sizes.

Explore

4 Queens - Beginner

Perfect for beginners with only 2 solutions.

Play 4x4

6 Queens - Advanced

Only 4 solutions on a 6x6 board: harder than it looks.

Play 6x6

15 Queens - Master

A big challenge: 2,279,184 solutions on a 15x15 board.

Play 15x15

Code the 8 queens solver yourself

The same search the hint button runs, explained line by line:

More puzzles

Like logic puzzles? Play sudoku, nonograms, futoshiki and 20+ more free two-minute puzzles at mini-puzzles.com.

Play more puzzles →