Puzzle Maker Online

Sudoku X Wing Explained: The Rectangle That Clears Two Lines

Here is the sudoku X wing explained in one sentence: pick a single digit, find two rows in which that digit has exactly two possible cells, and if those two pairs of cells sit in the same two columns, the digit can be erased from those two columns everywhere else on the grid.

Four cells at the corners of a rectangle. One digit. Two full columns cleaned out. It is the first technique that works on the geography of a digit rather than on the contents of a cell, and once you can see it, you can see it in about fifteen seconds per number.

Below: the exact conditions, the two-case proof, a fully worked row-based example with a real candidate map, a column-based one, the counting method for the payoff, and the four look-alikes that are not X-Wings.

Sudoku X wing explained: the pattern, stated precisely

An X-Wing is a single digit appearing in exactly two cells in each of two rows, with both rows using the same pair of columns — a 2×2 rectangle of candidates.

Every one of these conditions must hold:

RequirementDetail
One digit onlyThe whole pattern concerns a single number. Ignore every other candidate in those cells.
Two base rowsTwo rows in which the digit has exactly two candidate cells each.
Matching columnsThe candidate cells in both rows must fall in the same two columns.
Four cornersThe result is a rectangle: R*a*C*x*, R*a*C*y*, R*b*C*x*, R*b*C*y*.
EliminationThe digit is removed from columns x and y in every row other than a and b.

The pattern works identically with rows and columns swapped. Two columns each holding the digit in exactly two cells, both using the same two rows, lets you clear those two rows. The base lines and the cover lines simply trade places.

One thing that surprises people: the four corner cells may hold any number of other candidates. R2C3 can read {1, 4, 7, 9}. All that matters is where the digit 7 can and cannot go along the two base rows.

Why it works

Because the two base rows each need one copy of the digit, and the only columns available are the same two, those two columns are already fully committed — one digit each, both inside the base rows.

Take digit 7 with base rows 2 and 6, cover columns 3 and 8. There are exactly two ways to fill it:

ArrangementRow 2's 7Row 6's 7Column 3's 7Column 8's 7
AR2C3R6C8R2C3R6C8
BR2C8R6C3R6C3R2C8

The rows cannot both use column 3 — a column holds one 7. They cannot both use column 8 either. So the arrangement is one diagonal or the other, and in both arrangements column 3's single 7 and column 8's single 7 are already placed inside rows 2 and 6.

That means no cell in column 3 or column 8 outside those two rows can be a 7. You never find out which diagonal is live, and it does not matter — the conclusion is identical either way. This is a proof, not a trial.

Worked example: a row-based X-Wing on the digit 7

Map where a single digit can still go, row by row, and the pattern either exists or it does not.

Here is the full candidate map for the digit 7 on a stalled grid. Rows 3 and 9 already have their 7 placed.

Before — every cell that can still be a 7:

RowColumns where 7 is still possibleCount
R1C1, C4, C73
R2C3, C82
R3(7 already placed)
R4C3, C5, C93
R5C2, C3, C8, C94
R6C3, C82
R7C1, C82
R8C3, C52
R9(7 already placed)

Rows 2 and 6 each have exactly two homes for the 7, and both use columns 3 and 8. That is the X-Wing: corners at R2C3, R2C8, R6C3, R6C8.

Rows 7 and 8 also have exactly two homes each, but row 7 uses columns 1 and 8 and row 8 uses columns 3 and 5. Neither matches another row's column pair, so neither is part of a pattern.

Now clear columns 3 and 8, skipping rows 2 and 6.

CellWasNow
R4C3can be 77 removed
R5C3can be 77 removed
R8C3can be 77 removed
R5C8can be 77 removed
R7C8can be 77 removed

Five eliminations from one observation. But the second-order effects are the real prize.

After — the same map:

RowColumns where 7 is still possible
R1C1, C4, C7
R2C3, C8
R4C5, C9
R5C2, C9
R6C3, C8
R7C1 ← only one home left
R8C5 ← only one home left

Two hidden singles fall out immediately. Row 7 had its 7 at C1 or C8; C8 is gone, so R7C1 = 7. Row 8 had its 7 at C3 or C5; C3 is gone, so R8C5 = 7.

Neither placement was available before the X-Wing. That is the shape of a good X-Wing find: a handful of erased candidates, and then the grid starts moving again on its own.

The column-based version

Swap the roles: two columns each holding the digit in exactly two cells, both using the same two rows, and you clear those two rows.

Digit 5. Column 2 can hold a 5 only at R1C2 and R9C2. Column 7 can hold a 5 only at R1C7 and R9C7. Same two rows — 1 and 9.

Corners: R1C2, R1C7, R9C2, R9C7. The two 5s for columns 2 and 7 sit on one diagonal or the other, and either way rows 1 and 9 have their 5s used up.

Erase 5 from every other cell in rows 1 and 9:

CellResult
R1C55 removed
R1C95 removed
R9C45 removed

Three eliminations. Smaller than the first example, and that is normal — the payoff depends entirely on how crowded the two cover lines are.

The direction matters for your search habit, not for the logic. Solvers who only ever scan rows find roughly half the X-Wings on a grid. Scan both.

How much is an X-Wing worth?

Count the digit's candidate cells in the two cover lines before you commit — an X-Wing on nearly empty columns eliminates nothing at all.

SituationTypical eliminations
Cover lines nearly empty of the digit0 — valid pattern, no payoff
One or two other candidates per cover line2–4
Crowded cover lines5–7

A zero-elimination X-Wing is not a mistake; it is just a pattern that has already done its work through other techniques. Note it, move on, and do not spend time double-checking your logic — check the cover lines first, and only trace the geometry if there is something to erase.

Finding X-Wings without hunting blind

Work one digit at a time and write down the candidate map. The pattern is invisible in a normal candidate grid and obvious in a per-digit map.

  1. Complete your candidate grid. As with every technique above singles, acting on stale pencil marks will destroy the puzzle.
  1. Pick a digit. Start with the ones that already appear five or six times on the grid — the more copies placed, the more constrained the rest, and the more likely two rows have exactly two homes each.
  1. List, for each row, the columns where that digit is still possible. A nine-line list, exactly like the table above. Ignore rows where the digit is already placed.
  1. Circle every row with exactly two entries. On a stalled grid there are usually two to five.
  1. Compare the circled rows' column pairs. Any two rows sharing an identical pair is an X-Wing. This is a handful of comparisons, not a search.
  1. Repeat down the columns. Same list, built the other way.
  1. Erase, then return to singles. As the worked example showed, hidden singles are the usual follow-on.

The per-digit map is the whole trick. Trying to spot a rectangle inside a nine-by-nine field of pencil marks is genuinely hard; spotting a repeated pair in a nine-line list is trivial.

Four things that look like an X-Wing but are not

Every failed X-Wing traces back to one of these four, and all four are caught by re-reading the definition before you erase.

The sentence check works here as well. "Rows 2 and 6 can only put their 7 in columns 3 and 8, so those two columns get their 7 from those two rows, so nothing else in columns 3 or 8 is a 7." If you cannot say it cleanly, you have not found one.

A geometric note worth knowing

Two base rows in the same band — rows 2 and 3, say — can only form an X-Wing if the two cover columns are in different stacks. If the columns were also in the same stack, all four corners would sit inside a single box, requiring two copies of the digit in one box. That is impossible, so the configuration never appears on a legal grid.

Finned X-Wings

If a pattern is a perfect X-Wing except for one extra candidate cell in a base line, and that extra cell sits in the same box as one of the corners, you have a finned X-Wing. It still eliminates — but only from cells that see both the fin and the corresponding corner, which is a much smaller set. It is worth knowing that the near-miss is not always worthless; it is not worth hunting for until the plain version is second nature.

Where the X-Wing sits in the ladder

The X-Wing is the entry point to single-digit pattern solving, and everything above it on the ladder is a variation on the same idea. Learn the sudoku X wing explained here and the swordfish costs you almost nothing extra.

OrderTechniqueIdeaGuide
1SinglesOne option leftHow to play sudoku
2Locked candidateDigit trapped in an intersectionLocked candidate sudoku
3Naked pairsTwo cells, two digitsNaked pairs sudoku
4X-WingOne digit, 2×2 rectangleThis page
5SwordfishOne digit, 3×3 extensionSwordfish sudoku
6Y-WingThree bi-value cellsY wing sudoku
7SkyscraperTwo conjugate pairs, shared baseSkyscraper sudoku

The next technique to learn is the swordfish. It is the same logic stretched to three rows and three columns, and if you understand why the X-Wing works you already understand ninety percent of it. If this page felt like a jump, drop back to naked pairs first.

Our free puzzle maker generates unlimited classic 9×9 sudoku at easy, medium and hard, prints one to six per page with an answer key, and verifies a unique solution on every grid.

Frequently asked questions

What is an X-Wing in sudoku?

An X-Wing is a single-digit pattern made of four cells at the corners of a rectangle. Two rows each have exactly two remaining places for the digit, and both rows use the same two columns. Because each row must place one copy of the digit and only those two columns are available, both columns get their copy from inside those two rows — so the digit can be erased from those columns in every other row.

Why is it called an X-Wing?

Because of the two possible solutions. The digit ends up on one diagonal of the rectangle or the other, and drawing both diagonals over the four corners makes an X. The name has nothing to do with the shape of the eliminations, which run down two straight lines rather than diagonally.

Do the four cells of an X-Wing have to contain only that digit?

No, and this is the most common misunderstanding. The corner cells can hold any number of other candidates. The pattern is about a single digit's geography — where that number can still go along two lines — and every other candidate in those cells is irrelevant to the deduction.

Can an X-Wing work on three rows?

Not as an X-Wing. Extend it to three rows in which the digit is confined to the same three columns and you have a swordfish, which follows exactly the same reasoning at a larger size. Four rows and four columns is a jellyfish. Beyond that the patterns exist but are effectively never needed, since a five-line fish on a 9×9 grid always has a simpler counterpart.

How is the sudoku X wing explained differently from a skyscraper?

They start from the same place and separate on one column. An X-Wing needs both base rows to use the same two columns. A skyscraper takes the case where the two rows share one column and differ on the other — the shared column becomes the base, the two odd cells become the roof, and the eliminations land on cells that see both roof cells rather than down two full lines.

How often do X-Wings appear?

Rarely at easy and medium level, because those puzzles resolve through singles, locked candidates and pairs long before a digit gets constrained to two cells in two rows. On hard and expert grids an X-Wing shows up perhaps one time in three, usually in the middle of the solve once the candidate grid has thinned out. It is worth a dedicated per-digit scan whenever a grid stalls.