Rules and notation
An en passant capture that exposes the king
A timely en passant capture can still be illegal if it exposes your own king. Vacate the capturing pawn’s square and remove the captured pawn before checking for attacks.
Worked example
Position in text
White to move. White: king a5, pawn b5. Black: king h8, pawn c5, rook h5.
FEN: 7k/8/8/KPp4r/8/8/8/8 w - c6 0 2
Black has just played c7–c5. Try bxc6 in your head: the white pawn leaves b5 and the black pawn disappears from c5. That clears the fifth rank from h5 to White’s king on a5, so the capture is illegal.
A plausible mistake
If you leave the captured pawn on c5 in your mental picture, it looks like there is still a shield. En passant can open a line by emptying two adjacent squares at once.
Try it yourself
Position in text
Black to move. White: king a8, rook a4, pawn f4. Black: pawn g4, king h4.
FEN: K7/8/8/8/R4Ppk/8/8/8 b - f3 0 1
White has just played f2–f4. Can Black reply gxf3 en passant? Trace the relevant line.
Check your answer
No. g4 and f4 would both become empty and the rook on a4 would check the king on h4 across rank 4. The king need not move on the attempted capture for it to be illegal.