Castling in chess
By Chessvia · Updated Nov 4, 2026
Castling moves the king two squares toward a rook and puts that rook on the square the king crossed, all in one move.
It is legal only if neither piece has moved, every square between them is empty, and the king is not in check, does not pass through an attacked square and does not land in check.
Kingside castling, legal
1 of 9 · White to move
After 1.e4 e5 2.Nf3 Nc6 3.Bc4 Nf6 the knight and bishop have left f1 and g1.
Select the king, then the square two files to its side, or tap the rook. Here: O-O, the king from e1 to g1.
Try castling in nine positions
Two positions allow castling, six break one rule each, and the last looks illegal but is not.
1. Kingside castling, legal
After 1.e4 e5 2.Nf3 Nc6 3.Bc4 Nf6 the knight and bishop have left f1 and g1.
O-O: legal.
The king lands on g1 and the rook on f1, in one move.
Try it on the board2. Queenside castling, legal
After 1.d4 d5 2.Nc3 Nc6 3.Bf4 Bf5 4.Qd2 e6 the squares b1, c1 and d1 are empty.
O-O-O: legal.
The king lands on c1 and the rook on d1. The rook moves three squares here, two when castling kingside.
Try it on the board3. The king has already moved
White's king stepped to e2 on move 4 and went back to e1 on move 5. Both rooks never moved.
O-O: not legal, the king has moved. The king has already moved this game, so it can never castle again, even back on its home square.
The board looks the same as a legal castle. Only the game's moves show the king left e1.
Try it on the board4. The h1 rook has already moved
White's rook went to g1 on move 4 and back to h1 on move 5.
O-O: not legal, the rook has moved. The rook on h1 has already moved this game, so castling on this side is gone for good. The other side may still castle.
The a1 rook has not moved, so White can still castle queenside later, once b1, c1 and d1 are clear.
Try it on the board5. A knight is in the way
After 1.d4 d5 2.Bf4 Nf6 3.e3 e6 4.Qe2 c5 the squares c1 and d1 are empty, but the knight is still on b1.
O-O-O: not legal, pieces between king and rook. Your knight on b1 is in the way. Every square between the king and the rook must be empty.
Play Nc3 or Nd2 first. b1 has to be empty, though it may be attacked: only the rook crosses it.
Try it on the board6. The king is in check
After 4.d3 Black's bishop gives check from b4, down the diagonal the d-pawn opened.
O-O: not legal, the king is in check. You cannot castle out of check: the black bishop on b4 attacks your king.
Answer the check first, for example with c3 or Bd2. Being checked does not cost the right to castle later.
Try it on the board7. The king would pass an attacked square
Black's bishop on a6 looks down the diagonal to f1.
O-O: not legal, the king crosses an attacked square. The king would cross f1, which the black bishop on a6 attacks. The king may not pass through an attacked square.
g1 itself is safe. Castling is still illegal, because the king would pass f1 on the way.
Try it on the board8. The king would land in check
With White's f-pawn gone, the bishop on c5 aims straight at g1.
O-O: not legal, the king lands in check. The king would land on g1, attacked by the black bishop on c5.
A pawn or piece on d4, e3 or f2 would block the bishop and make castling legal again.
Try it on the board9. The rook is attacked: still legal
Black's rook on h8 attacks White's rook on h1 down the open h-file.
O-O: legal.
The rules test only the king's squares, e1, f1 and g1. An attacked rook may castle, and after O-O it is safe on f1.
Try it on the board
The six castling rules
Castling is legal only when all six of these hold at the moment you castle.
- The king has not moved. Once the king moves, even if it comes straight back, it can never castle again in that game.
- The rook has not moved. A rook that has moved loses castling on its own side. The other rook may still castle.
- Nothing stands between them. Kingside, f1 and g1 must be empty. Queenside, b1, c1 and d1 must be empty.
- The king is not in check. Answer the check first. You can castle on a later move if the other rules still hold.
- The king does not cross an attacked square. That is f1 kingside and d1 queenside. b1 may be attacked, because only the rook crosses it.
- The king does not land in check. g1 or c1 must not be attacked, as for any king move.
The first two rules are permanent: the right is gone for the rest of the game. The other four only stop castling on this move, and it may become legal again once the square is cleared or the attack is blocked.
Kingside and queenside: where the pieces go
The king always moves two squares toward the rook, and the rook lands on the square the king crossed.
| Castling | King | Rook |
|---|---|---|
| White kingside, O-O | e1 to g1 | h1 to f1 |
| White queenside, O-O-O | e1 to c1 | a1 to d1 |
| Black kingside, O-O | e8 to g8 | h8 to f8 |
| Black queenside, O-O-O | e8 to c8 | a8 to d8 |
Kingside castling is also called short castling and queenside castling long castling. The kingside rook moves two squares and the queenside rook three. Black castles by the same rules on the eighth rank.
Why castling is written O-O and O-O-O
O-O means kingside castling and O-O-O means queenside castling; the longer symbol is the longer castle.
FIDE's notation appendix writes them with zeros, 0-0 and 0-0-0. PGN files and most chess software use the capital letter O. A check is added as usual, so O-O+ means the rook gives check after castling.
Over the board, move the king first, two squares, then the rook. Under FIDE's touch-move rule, touching the rook first means you may not castle with it on that move.
Questions players ask
Why is castling called O-O-O?
O-O-O is how queenside castling is written: the king goes from e1 to c1 and the rook from a1 to d1. Kingside castling is O-O. The longer symbol marks the longer castle, since the queenside rook moves three squares and the kingside rook two.
Can the queen castle?
No. Castling is a move of the king and one rook only. The queen never castles, and a rook cannot castle with anything but its own king.
Can you castle through check?
No. The king may not pass through a square an enemy piece attacks, so with f1 attacked White cannot castle kingside even when g1 is safe. The rook may cross an attacked square: queenside castling is legal with b1 attacked.
Rules and examples
Credits
Every position is an original teaching example, replayed and checked with chess.js; the board's verdicts come from chess.js.
Piece set: MIT.
