En passant in chess: when the pawn capture is legal

En passant lets a pawn capture an opposing pawn immediately after that pawn moves two squares from its starting position past a square your pawn attacks. Your pawn lands on the square the other pawn crossed. The captured pawn comes off the square where it finished its two-square move.
What does the move look like on a board?
Place a white pawn on e5 and a black pawn on d7. Give Black the move and advance that pawn to d5. White’s pawn attacks d6, the square Black just crossed. If the capture is otherwise legal, White can move from e5 to d6 and remove the black pawn from d5. The move is recorded exd6, optionally with an en passant note.
Now change one detail. Start the black pawn on d6 and move it just one square to d5. The final pawn positions look identical, but the capture is unavailable.
How long is the opportunity available?
White may choose another legal move. Once that turn passes, the en passant opportunity from Black’s two-square advance is gone. Also check your king: a pawn move that exposes your king to attack is illegal even when the two-square condition is met.
FAQ
Can another piece take en passant? A pawn makes this special capture, and its target is a pawn.
Why does the move list say d6 when the captured pawn stood on d5? The notation gives the destination of the moving pawn. Our algebraic notation guide walks through how to read it.