🧩 Strategy & Techniques

X-Wing Sudoku: How the Technique Works (With Examples)

Learn the X-Wing Sudoku technique: why two lines sharing two positions remove candidates, how to spot it step by step, common mistakes, and the Swordfish.

537619598686348317266284195879?
In this article
  1. What is an X-Wing in Sudoku?
  2. Why it works: two lines, two positions
  3. Row-based vs column-based X-Wings
  4. How to spot an X-Wing, step by step
  5. Common mistakes
  6. Bigger siblings: Swordfish and beyond
  7. How to practise X-Wings

The X-Wing is usually the first “advanced” technique players learn, and the first one that feels a bit like magic. You don’t place a number. Instead, you prove that a digit can’t go in a few cells that are far away from the pattern. Once you see why it works, it stops being magic and becomes a simple rectangle you scan for.

This guide walks through the logic, both directions of the pattern, a step-by-step way to find it, the mistakes almost everyone makes at first, and its bigger sibling, the Swordfish. Every diagram is a real position from a real puzzle, taken from the same solver that powers hints on Sudoku.my.

What is an X-Wing in Sudoku?

An X-Wing is a pattern for one digit at a time. You ignore every other number and look only at where, say, the 9 can still go. If two parallel lines (two rows, or two columns) each have only two spots left for that digit, and those spots line up, the four cells form the corners of a rectangle. Draw the two diagonals and you get an X, which is where the name comes from.

The X-Wing is the smallest member of a family that solvers call fish: X-Wing uses two lines, Swordfish three and Jellyfish four. They all rely on the same idea, so learning the X-Wing properly makes the bigger ones easy.

You need pencil marks for this. An X-Wing lives in the candidates, not in the given numbers, so if your notes are incomplete or out of date you will either miss it or “find” one that isn’t there. If you’re not yet writing notes, read our guide to Sudoku pencil marks first.

Why it works: two lines, two positions

Take the column version. Suppose that in column 2 the 9 can only go in row 4 or row 7, and in column 4 the 9 can also only go in row 4 or row 7. Every column needs a 9, so each of these columns will put its 9 in one of those two rows.

There are only two ways that can play out:

  • Column 2 takes its 9 in row 4. Then column 4 can’t use row 4 (one 9 per row), so it takes row 7.
  • Column 2 takes its 9 in row 7. Then column 4 must take row 4.

Either way the 9s land on two opposite corners, and either way row 4 and row 7 both get their 9 from these two columns. That means no other cell in row 4 or row 7 can be a 9. You don’t know which diagonal is right yet, and you don’t need to. Both possibilities lead to the same eliminations.

Here is that exact situation in a real expert-level position. First, try to find it yourself:

An expert position with full pencil marks. Look only at the 9s: which two columns have exactly two of them, in the same rows?

And here is the answer:

In columns 2 and 4, the 9 can only go in rows 4 and 7. Whichever diagonal is right, rows 4 and 7 get their 9 from these corners, so 9 is removed from row 4, column 1; row 4, column 5; and row 7, column 9.

Notice the payoff: row 4, column 1 had only 5 and 9 as candidates. With the 9 gone, it becomes a naked single, a 5. That is typical. An X-Wing rarely solves a cell on its own, but it usually unlocks an easy move right after.

Row-based vs column-based X-Wings

The pattern works in both directions, and the rule for which way to eliminate is always the same: find the two lines where the digit is restricted, then eliminate along the other direction.

The two kinds of X-Wing
Column-basedRow-based
Look forTwo columns with the digit in exactly two cellsTwo rows with the digit in exactly two cells
The cells must shareThe same two rowsThe same two columns
Remove the digit fromThe rest of those two rowsThe rest of those two columns
Example aboveColumns 2 and 4, rows 4 and 7(none in this position)

A handy way to remember it: the lines that are restricted are the ones that “own” the digit. The lines that cross them are where the cleanup happens. In the example, columns 2 and 4 are restricted, so rows 4 and 7 get cleaned.

How to spot an X-Wing, step by step

X-Wings are hard to see by staring at the whole board. A routine works much better. Make sure your notes are complete, then:

  1. Pick one digit. Start with one that is already placed many times, since it has fewer candidates left and the pattern stands out.
  2. Scan the columns. For each column, count the cells that still hold that digit as a candidate. Note every column with exactly two.
  3. Compare their rows. If two of those columns have their two candidates in the same pair of rows, you have an X-Wing.
  4. Check for eliminations. Look along those two rows for any other cell with the digit. If there is none, the X-Wing is real but useless right now; move on.
  5. Repeat with rows, then move on to the next digit.

On Sudoku.my, selecting a cell highlights its row, column and box and every matching number on the board, which makes it quicker to see where a digit is already placed and which lines still need it. On desktop you can toggle notes with the N key and type candidates with 1–9.

Common mistakes

Almost every “my X-Wing was wrong” moment comes from one of these. The position above is full of near misses, which makes it a good place to practise.

1. Using a line with three or more positions

Each of the two base lines must have the digit in exactly two cells. In the example, look at rows 4 and 7 instead of columns 2 and 4. Row 4 has the 9 in four cells (columns 1, 2, 4 and 5), so the rows do not form an X-Wing. The pattern only exists because the columns are restricted. If a base line has a third spot, the digit could go there, and the whole argument falls apart.

2. Two lines with two positions that don’t line up

In the same position, row 2 has the 9 in exactly two cells (columns 3 and 9), and so does row 8 (columns 1 and 9). That looks promising, but the columns don’t match: 3 and 9 versus 1 and 9. Three different columns means no rectangle and no X-Wing. All four cells must sit on the corners of one rectangle.

3. Eliminating in the wrong direction

If the columns are restricted, remove the digit from the rows, never from the columns. The two base columns have no other candidates for that digit anyway, so if you find yourself “eliminating” inside them, you’ve flipped the logic.

4. Mixing up digits

All four corners must be candidates for the same digit. A rectangle of cells that share various candidates is not an X-Wing. Focus on one digit at a time and ignore the rest.

5. Working from stale notes

If you forgot to remove a candidate after placing a number, a line might look like it has three spots when it really has two (you miss the X-Wing), or worse, a line might appear to have two spots because you never wrote the third (you make a wrong elimination). Sudoku.my can remove notes automatically when you place a number; turn it on in Settings.

Bigger siblings: Swordfish and beyond

The same logic stretches to three lines. If in three rows a digit can only go in the same three columns, those three rows must fill those three columns with that digit. So the digit can be removed from every other cell in those three columns. That is a Swordfish.

The big difference from an X-Wing: each base line needs two or three of the candidates, not necessarily all three. What matters is that, together, the three lines use only three columns.

Swordfish on 7. Row 1 has the 7 in columns 2 and 6, row 3 in columns 2, 6 and 7, and row 6 in columns 2 and 7. Three rows, three columns, so 7 is removed from row 4, column 2 and row 5, column 7.

Notice that no single row in this Swordfish forms a neat rectangle with another. That’s why Swordfish patterns are so easy to miss: you have to look at three lines together. The scanning routine is the same as for the X-Wing, except you are looking for three lines whose candidates fit inside three columns.

There is a four-line version too, the Jellyfish, but it is rare. Larger fish are never needed: as the HoDoKu documentation explains, any bigger basic fish has a smaller complementary one elsewhere on the board.

Not a fish: the XY-Wing

Despite the similar name, the XY-Wing works differently. It uses three cells with two candidates each: a pivot with {X,Y} and two wings with {X,Z} and {Y,Z}. Whatever the pivot becomes, one wing must be Z, so any cell that sees both wings can’t be Z. It is the other big expert technique. For a full walkthrough with a real puzzle, read our Y-Wing (XY-Wing) guide.

Expert techniques compared
TechniqueLooks atShapeRemoves
X-WingOne digit, 2 linesRectangle (4 cells)That digit from the crossing lines
SwordfishOne digit, 3 linesUp to 9 cells in a 3×3 frameThat digit from the crossing lines
JellyfishOne digit, 4 linesUp to 16 cells in a 4×4 frameThat digit from the crossing lines
XY-WingThree two-candidate cellsPivot and two wingsZ from cells that see both wings

How to practise X-Wings

Reading about X-Wings helps, but you only really learn them by finding them yourself. A few tips that work:

  • Play Expert puzzles. On Sudoku.my, Easy puzzles need only singles, Medium adds locked candidates, Hard adds pairs and triples, and Expert puzzles may need X-Wing, XY-Wing or Swordfish. If you never play Expert, the pattern simply won’t come up.
  • Use hints as a teacher. You get three hints per puzzle, and each one names the technique and explains the move. When a hint says “X-Wing”, don’t just accept it: trace the two lines and the eliminations yourself.
  • Do a digit sweep. When you’re stuck, go through the digits 1 to 9 and, for each, mark the columns and rows with exactly two candidates. It takes a minute or two and becomes automatic with practice.
  • Keep notes clean. Turn on automatic note removal so your candidates always match the board.
  • Don’t guess. Every puzzle on Sudoku.my has exactly one solution and can be solved by logic alone. If you’re stuck, there is a pattern to find, and Miko the cat will happily wait while you look for it.

The daily challenge is a good testing ground too: it starts easier on Monday and gets harder towards the weekend, so late-week puzzles are where advanced patterns tend to appear. Track your streak on the calendar.

Frequently asked questions

What is an X-Wing in Sudoku?

A pattern for one digit: in two rows the digit fits in exactly two cells, and those cells share the same two columns (or the reverse). The digit can then be removed from the rest of those two columns.

Does an X-Wing need exactly two candidates per line?

Yes. Each of the two base lines must have the digit in exactly two cells, and all four cells must form a rectangle. A third position in either line breaks the logic.

What is the difference between an X-Wing and a Swordfish?

An X-Wing uses two lines and two crossing lines; a Swordfish uses three of each. In a Swordfish each base line may hold the digit in two or three of the three crossing lines.

Is an XY-Wing the same as an X-Wing?

No. An X-Wing looks at one digit across two lines. An XY-Wing uses three cells with two candidates each, a pivot and two wings, to remove a third digit.

Which Sudoku puzzles need the X-Wing?

Mostly expert-level puzzles. On Sudoku.my, Easy to Hard puzzles never need it, while Expert puzzles may need X-Wing, XY-Wing or Swordfish.

Sources

  1. X-Wing Strategy SudokuWiki.org
  2. Basic Fish (X-Wing, Swordfish, Jellyfish) HoDoKu

#X-Wing#Techniques#Advanced