X-Wing in Sudoku: how to spot it and what it clears
What you are looking for
Pick one digit and look only at where it can still go. In two different columns, that digit has exactly two candidate squares each, and both columns use the same two rows. The four squares are the corners of a rectangle. That is an X-Wing.
The pattern works just as well on its side: two rows where the digit has two spots each, both in the same two columns.
On the board below the digit is 9. Columns 6 and 7 each have two squares that can still hold a 9, and in both columns they are in rows 2 and 8. The four highlighted squares are the rectangle.
Why it works
Column 6 needs exactly one 9, and it can only go in row 2 or row 8. Say it goes in row 2. Then column 7 cannot put its own 9 in row 2, so it has to use row 8. If column 6 puts its 9 in row 8, column 7 takes row 2.
Either way, row 2 gets one of these two 9s and row 8 gets the other. Both rows have their 9 taken care of, so any other 9 in row 2 or row 8 would be a second 9 in the same row. Every other candidate 9 in those two rows can go.
You never have to work out which diagonal is right. The pattern removes candidates while the answer is still open, which is why it helps on a stuck board.
What it clears on this board
In the first picture, apart from the rectangle, row 2 still lists a 9 in columns 3 and 4, and row 8 lists one in columns 4 and 9. Those four candidates are crossed out in the second picture.
The X-Wing places nothing by itself. It only removes pencil marks.
How to scan for one
You do not need to hunt for rectangles by eye. Take one digit and go down the columns, counting how many squares can still hold it. Ignore any column with zero, one, or three or more. Among the columns with exactly two, look for a pair whose squares share the same two rows. Then do the same across the rows.
It helps to mark candidates for a single digit across the whole board first, the way the pictures here do. The rectangle is easy to see when only 9s are on show. The auto-notes button on the Sudoku page fills in every candidate, and you can ignore all but one digit at a time.
Mistakes that break it
A line with three candidate squares is not an X-Wing, because the argument above needs exactly two choices per line.
The squares also have to line up. Columns 6 and 7 must use the same two rows. If one column uses rows 2 and 8 and the other uses rows 2 and 9, there is no rectangle.
The last mistake is crossing out in the wrong place. In this column-based X-Wing the digit comes out of the two rows. In a row-based one it comes out of the two columns.
How often you will need it
You will need it rarely at first. Of 200 hard boards the game generated, 7 needed an X-Wing. The rest finished with singles, locked candidates and pairs. So the practical order is to run through those first, and reach for an X-Wing when a board has stalled and you would otherwise have to guess.
Questions
Does an X-Wing place a digit?
No. It removes candidates. Afterwards a square may be left with one candidate, or a digit may have one home in a row, column or box, and that is when it gets placed.
Can an X-Wing use rows as well as columns?
Yes. The board here uses columns as the base lines and crosses out squares in two rows. Swap rows and columns and everything works the same way.
What is a Swordfish?
It is the same idea stretched to three lines and three crossing lines. It is harder to see, so learn the X-Wing first.