How castling works
The only move in chess where two pieces move at once, and the only one where a piece jumps over the king. It tucks the king away and brings a rook into the game, which is why almost every game contains it.
- O-O kingside
- O-O-O queenside
- Five conditions
Castling is a king move. The king slides two squares towards one of his rooks and that rook hops over him and lands on the square he just crossed. It counts as one move and you touch the king first.
A king with both castles available
White to move, with everything cleared out between the king and both rooks. The dots are the king's legal moves as the engine generates them, and two of them are castles: g1 to the right, c1 to the left.
Kingside castling: O-O
Castling kingside
The short castle. The king goes e1 to g1, the rook goes h1 to f1, and the whole thing is written O-O with two capital letter Os.
1.O-O
The king is behind three unmoved pawns and the rook has come from the corner to the middle of the back rank.
Queenside castling: O-O-O
Castling queenside
The long castle. The king goes e1 to c1, the rook goes a1 to d1, and it is written O-O-O. The king travels the same two squares; the rook travels one further, which is why there is an extra square to clear on this side.
1.O-O-O
Note that the b1 square is now empty and the king is one square nearer the edge than after O-O. Many players follow up with Kb1 to tuck him further away.
The five conditions, all of which must hold
- Your king has never moved. Not once, and moving back does not restore the right.
- That rook has never moved. Each rook carries its own right, so moving the h-rook only kills the kingside castle.
- Every square between them is empty. Bishop, knight and queen all have to be out of the way first.
- You are not in check right now.
- The king does not cross or land on an attacked square. The square he passes over counts, which catches people out.
The three that involve check are worth their own page, because the exact wording decides several very common positions: see when you cannot castle, where each one is set up on a board and put to the engine.
Which side should you castle?
Kingside, most of the time. It is one move quicker, it needs one fewer square cleared, and the king ends up further from the middle of the board where the pieces are. Around nine club games out of ten feature at least one short castle.
Queenside is the aggressive choice. It puts a rook on the d-file immediately, which is often the file that matters, and it is what you play when you intend to throw your kingside pawns at your opponent's king. If you castle on opposite sides from your opponent, the game usually becomes a race and calculation matters more than structure.
Castle early, but not automatically
The usual advice is to castle within the first ten moves and it is good advice, because a king in the centre when the position opens is the single commonest way a beginner game is decided. The exception is an already closed position, where the king is fine in the middle for a while and there are better things to do with the move.
There is one more reason not to leave it too long: castling rights are lost the instant the king moves, and an awkward check that forces the king to step aside can cost you the right permanently.
Black to move. Castling is a developing move as well as a safety move, and sometimes it is the tactic.
Show the answer
11.Re1 11...Qg2+ 12.Ke3 12...O-O
The line ends with the pattern paying off in material. The position is from a real game on Lichess, rated 1467 in their puzzle pool, and it is one of the positions in the Stafford Gambit skill in the trainer.
Questions people ask
Can you castle if the rook has moved?
Not with that rook. The right belongs to the individual rook, so if your h1 rook has moved you can no longer castle kingside, but you may still castle queenside with the a1 rook if that side is untouched. Moving the king kills both at once.
Can you castle after being in check?
Yes, as long as you got out of check without moving the king. Blocking the check or capturing the checking piece leaves your castling rights intact, and you can castle on any later move. It is only castling while you are in check that is forbidden.
Which piece do you touch first when castling?
The king. Under the touch-move rule, picking up the rook first means you have committed to a rook move, and a strict opponent can hold you to it. Move the king two squares first, then the rook.
Is castling one move or two?
One. It is written as a single move in the notation, O-O or O-O-O, it takes one turn, and it is the only move in chess that relocates two of your pieces.
Related
Castling sits under The special moves in the reference. Nearby: