Castling is a special move in the game of chess involving the king and either rook.

Kingside castling: O-O
 
Queenside castling: O-O-O

The move can be made only if all of the following conditions hold:

  1. The player must never have moved his king;
  2. The player must never have moved the rook with which he wishes to castle;
  3. There must be no pieces between the king and the rook;
  4. The king must not be in check, the square the king crosses must not be attacked by an enemy piece and the act of castling must not place the king in check

A common mistake is to think that one may not castle if one's rook is under attack or will move over an attacked square.

Another misconception is that one may not castle if one's king has ever been in check. Neither of these circumstances disqualifies one from castling as long as the above rules are satisfied.

Castling involves moving the king two squares toward the rook, then moving the rook into the square over which the king crossed. See the diagrams to the left.

To signal the intention to castle, one should pick up the king first and move it two squares, and then move the rook over it. Picking up the rook first signals the intention to just move the rook.

The notation for castling is O-O on the king side or O-O-O on the queen side.

Castling is an important goal in the early part of a game, because it serves two valuable purposes: it moves the king into a safer position away from the center of the board, and it moves the rook to a more active position in the center of the board.

If the king is forced to move before it has the opportunity to castle, the player may still wish to maneuver the king towards the edge of the board and the corresponding rook towards the center. When a player takes three or four moves to accomplish what castling would have accomplished in one move, it is sometimes called artificial castling.

If one player castles kingside, and the other queenside, it is called opposite castling. Castling on opposite sides usually results in a fierce fight as the pawns on both sides are free to advance to attack the opposing king's castled position without exposing the player's own castled king.

An example is the Dragon Variation of the Sicilian opening.

Castling is in most non-English speaking nations known as 'Rochieren/Rochada', whilst 'queenside/kingside castling' is in those countries referred to as 'long/short' castling'.

Some chess variants have modified castling rules to handle modified starting positions. For an example, see the rules of Fischer Random Chess.