X-Wing in Sudoku

An X-wing is a pattern on one digit across four cells that form a rectangle. If the digit has only two possible cells in each of two rows, and they share the same two columns, the digit must occupy opposite corners. The digit can then be removed from the rest of both columns.

When to use it

  • You have notes on and the easier techniques have stopped finding moves.
  • One digit appears in only two cells in each of two rows, or in two columns.
  • The two cells in one row line up in the same columns as the two cells in another row.
  • You are stuck on a hard puzzle and want an elimination that does not rely on pairs of cells.

How to spot it

  1. Choose a digit and look at its candidates row by row.
  2. Find a row where the digit has exactly two candidate cells. Note their columns.
  3. Find a second row where the digit has exactly two candidates in those same two columns.
  4. The four cells form a rectangle. Remove the digit from every other cell of those two columns.
  5. Repeat with columns as the base lines, which removes the digit from the rest of the two rows.

Worked example on a real board

This is a real position from puzzle expert-0200 of our library. 65 of the 81 cells are filled in and 16 are still empty.

Highlighted cells form the pattern. Crossed-out candidates are the ones the technique removes.

In rows 1 and 4, the digit 9 can only go in R1C2, R1C8, R4C2, and R4C8. Whichever way it falls, it uses up columns 2 and 8, so 9 can be removed from the other cells of columns 2 and 8: R3C2, R6C2, and R6C8.

Candidates in the cells that matter:

  • R1C2: 2 and 9
  • R1C8: 2 and 9
  • R3C2: 2, 5, and 9
  • R4C2: 3 and 9
  • R4C8: 6 and 9
  • R6C2: 3, 5, and 9
  • R6C8: 2, 4, and 9

Result: these candidates are removed: R3C2 (loses 9), R6C2 (loses 9), and R6C8 (loses 9).

Why it works

Each of the two base rows needs one copy of the digit, placed in one of its two cells. There are only two ways to do this without putting two copies in the same column: the digit sits on one diagonal of the rectangle or on the other.

Either way, both columns receive their copy of the digit from the rectangle. No other cell in those columns can hold it, so those candidates are removed.

The X-wing is the first technique that works across the whole grid instead of inside one unit. The two rows may be far apart and the cells need not touch, which is why it is hard to spot by looking at the board and easy to find by listing candidates.

It is also the entry point to the fish family. Once an X-wing makes sense, the swordfish is the same idea with three lines, and the jellyfish with four.

X-wing compared with Swordfish

An X-wing is a swordfish of size two. A swordfish uses three rows and three columns instead of two, and its rows may hold two or three candidates each. It removes more candidates when it applies, but it is much harder to see and appears far less often.

FeatureX-wingSwordfish
Cells involved4 cells in 2 rows and 2 columns6–9 cells in 3 rows and 3 columns
Difficulty levelHard techniqueExpert technique
Our puzzles that use it480 / 8,000 (6%)61 / 8,000 (0.8%)
What it doesRemoves 1 digit from the rest of 2 linesRemoves 1 digit from the rest of 3 lines

How often our puzzles need it

Of the 8,000 puzzles in our library, 480 (6%) use X-wing at least once on the way to the solution. In 143 of them it is the hardest technique the puzzle needs.

LevelPuzzlesUse itShareNeed it as the hardest
Easy2,00000%0
Medium2,00000%0
Hard2,0001437%143
Expert2,00033717%0

A technique is counted when our solver, which always takes the simplest available step first, applies it at least once. A pattern that is on the board but not needed is not counted. These numbers are recalculated from the puzzle files whenever the site is built.

Common mistakes

  • Using rows that have three candidates. Each base row must have exactly two candidates for the digit.
  • Using columns that do not match. Both rows need their two candidates in the same two columns.
  • Removing the digit from the rectangle’s own cells. The elimination is in the other cells of the two columns.
  • Forgetting the transposed version. The same pattern works with columns as the base lines and rows as the cover lines.

Tips for finding it faster

  • Pick the digit with the fewest candidates left on the board. Fish patterns are easiest to see for digits that are almost fully placed.
  • List, for that digit, the rows where it has exactly two candidates. If two of those rows use the same two columns, you have an X-wing.
  • Do the same with columns. The pattern is symmetric, so it is worth checking both directions.

Frequently asked questions

What is an X-wing in Sudoku?

An X-wing is a rectangle of four cells where one digit can only go in two cells in each of two rows, and those cells share the same two columns. The digit must sit in opposite corners, so it is removed from the rest of both columns.

Why is it called an X-wing?

If you join the two possible diagonals of the rectangle, they form an X. The digit sits on exactly one of the two diagonals.

Does an X-wing work with columns instead of rows?

Yes. If the digit has two candidates in each of two columns and they share two rows, the digit is removed from the rest of those two rows.

What is the difference between an X-wing and a swordfish?

An X-wing uses two rows and two columns. A swordfish uses three rows and three columns. They share the same logic, but a swordfish is rarer and harder to spot.

Keep learning

Try it yourself on real positions:

Practice X-wing drillsTake the X-wing lesson

Two related techniques

All sudoku strategiesOpen the step-by-step solverPlay Hard