Look at candidate 4 in rows 5 and 7 of the board below. In both rows, it fits only in columns 3 and 7. Those two rows will put a 4 in each of those columns, so you can cross out the other 4s in the columns: r4c7, r9c3 and r9c7. You don't have to choose which corner gets which 4.
That is a row-based X-Wing in Sudoku. The restriction concerns one digit's positions across two rows. The four corner cells can still have other candidates.
Find the four corners without losing the rest of the board
Coordinates start at the top left: r5c3 means row 5, column 3. This is an original practice position, not today's daily puzzle. You can inspect the whole board, but the useful evidence is confined to two rows:
| Row | All positions that still allow 4 |
|---|---|
| 5 | c3, c7 |
| 7 | c3, c7 |
Check the entire row before drawing the rectangle. A third possible 4 elsewhere in either row would break this particular argument. Other digits in the four cells are fine: r5c3, for example, still allows 2, 4, 6 and 9. An X-Wing does not require a pair of identical two-number cells.
For the basic rules behind the pencil marks, use the Sudoku rules and technique guide. Here the small 4s follow directly from the filled rows, columns and boxes. No earlier candidate removals are hidden from the example.
Why both possible diagonals remove the same candidates
Suppose the 4 in row 5 goes in column 3. The 4 in row 7 cannot share that column, so it must go in column 7. Both columns have received their 4.
Now take the other possibility. If row 5 uses column 7, row 7 must use column 3. The exact placements change, but the two columns are occupied again.
So the 4 at row 4, column 7 cannot survive. Nor can the 4s in row 9, columns 3 and 7. Remove those three pencil marks, leaving the other candidates in each cell alone.
| Cell | Before the X-Wing | After removing 4 |
|---|---|---|
| r4c7 | 2, 4, 6, 9 | 2, 6, 9 |
| r9c3 | 1, 2, 4, 8, 9 | 1, 2, 8, 9 |
| r9c7 | 2, 4, 6, 9 | 2, 6, 9 |
None becomes a single immediately. That does not make the move unhelpful. It removes possibilities safely, which can expose a pair, a different pattern or a later single. It does not, by itself, tell you the final values of those three cells.
A rectangle can look right and still fail
Consider a separate candidate map. Row 2 allows 6 in c2 or c8. Row 8 allows 6 in c2, c8 or c5. The four cells in columns 2 and 8 make a rectangle, but row 8 is not confined to those columns.
It could use c5 while row 2 uses c8. Column 2 would then still need its 6 elsewhere. You have no X-Wing reason to remove a 6 from another cell in column 2. This is a schematic counterexample, not an extra pencil mark to add to the practice board above.
A diagonal alone does not create a Sudoku relationship. The crossed lines in an X-Wing picture stand for the two possible placements. They do not add a rule that digits on a long diagonal must differ.
Turn the search around when the rows do not help
You can start from columns instead. Find two columns where a digit has only two possible rows, with the same pair of rows in each column. Those columns supply the digit to both rows, so remove it from the rest of those rows.
Keep track of which direction supplied the evidence. In the worked example, the two rows were restricted, and the eliminations ran down the columns. Do not delete an unrelated 4 elsewhere in row 5 just because row 5 is highlighted. In fact, a valid row-based X-Wing already has no other 4 candidate in either base row.
A short check before you move on
In a separate puzzle, the only 7s in columns 2 and 8 lie in rows 3 and 9. Which outside 7s can the pattern remove?
Show the answer
Remove 7 from other cells in rows 3 and 9, outside columns 2 and 8. Leave the four corners. This is the column-based version, so deleting down the rest of columns 2 and 8 would reverse the argument.
Watch the row-and-column argument
SudokuVideoTutorials' X-Wing lesson shows worked rectangles on other boards. Use it to compare the two directions after checking the three removals in this article.
Watch SudokuVideoTutorials on YouTube
When you want another position, open expert Sudoku. A puzzle may need an X-Wing or an XY-Wing, so don't assume every expert grid contains this exact pattern. On your next Sudoku board, finish the obvious singles before scanning one digit's candidate positions across whole rows.
References
HoDoKu's basic fish reference states the row/column restriction. SudokuCoach's X-Wing explanation follows both possible diagonals. The board, three figures and candidate-removal table here are original GridPuzzles practice material.