Castling consists of moving the king two squares towards a rook, then placing the rook on the other side of the king, adjacent to it. It is not allowed to move both king and rook in the same time, because "Each move must be played with one hand only". King is moved first.

Castling is only permissible if all of the following conditions hold:

- The king and rook involved in castling must not have previously moved (this means each player may only perform castling once per game);

- There must be no pieces between the king and the rook;

- The king may not currently be in check, nor may the king pass through or end up in a square that is under attack by an enemy piece (though the rook is permitted to be under attack and to pass over an attacked square);

- The castling must be kingside or queenside.


Examples of kingside and queenside castling:

Situation before castling: White will castle on king's side and black on queen's side.


Situation after castling.

Note that this is the only move in chess that allows the player to move two pieces during their turn. Also, it's the only move that allows the King to advance two squares.