Learn chess

Castling

Castling is the only time the king moves two squares, and the only time a rook jumps. The king steps two squares toward a rook, and that rook hops to the square the king crossed.

Kingside, the white king goes from e1 to g1 and the rook from h1 to f1. Queenside, the king goes from e1 to c1 and the rook from a1 to d1. Black does the same on rank 8.

All of the following have to be true. The king and that rook have not moved yet. Every square between them is empty. The king is not in check, does not pass through a checked square, and does not land in check. You may still castle if a rook is attacked. You may not castle to escape check.

Kingside

The knight and the bishop have left f1 and g1. The king and the h1 rook have not moved. O-O is legal.

Open on the analyzer

Queenside

b1, c1, and d1 are empty. The king castles the long way. The rook finishes on d1.

Open on the analyzer

Clear the pieces, then castle

The knight on g1 and the bishop on f1 are in the way. They move first. Then O-O is legal.

Open on the analyzer

You cannot castle across a checked square

The bishop on c4 attacks f1, and e2 is empty, so the king would cross a checked square. O-O is illegal. The light-squared bishop is already off this diagram, which is why f1 is empty. d3 blocks the diagonal. After Black develops, O-O is legal.

Open on the analyzer

No castling once the right is gone

This is the same piece layout as the kingside example, but White no longer has the castling right. The king or the h1 rook has already moved. O-O is not available, so the move is an ordinary pawn push.

Open on the analyzer

You cannot castle out of check

The rook on e8 checks the king. The h1 rook is ready and the right is still there, but castling is illegal while the king is in check. Kf1 steps out, and the king move also spends the castling right.

Open on the analyzer