Castling is the only move in chess where two pieces move at once: the king steps two squares to the side, and the rook jumps over it to stand on the king's other side. It does two jobs in one go, tucking the king into the corner and bringing the rook into play, which is why it turns up in almost every game. To practice right away, start a game of free chess.
Kingside and queenside castling
Castling toward the kingside (the h-file side) is called short castling, written O-O. Castling toward the queenside (the a-file side) is called long castling, written O-O-O.
Either way, the king moves two squares and the rook lands on the square right next to the king, on the other side. After long castling the rook arrives on the d-file, where it's often useful straight away.
The five times you can't castle
If any one of these is true, you can't castle:
- The king has already moved: even if it moved away and came back, you can never castle on either side for the rest of the game.
- That rook has already moved: if the h1 rook has moved, you can't castle short. But if the a1 rook hasn't moved, you can still castle long.
- There are pieces between the king and the rook: your own or your opponent's, it doesn't matter.
- The king is in check: you can't castle to get out of check.
- The king passes through or lands on a square the opponent attacks: the king can't cross the line of fire, and it can't step into it.
Rule five is the one people get wrong most, so here's a picture:
The rule only cares about the squares the king crosses. Squares the rook crosses, or the rook itself being attacked, don't affect castling.
When should you castle?
- The sooner the better: the three opening principles are take the center, develop fast, castle early. A king left in the middle is in real danger once the center opens.
- Develop first, then castle: castling short only needs the kingside knight and bishop out. Castling long also needs the queen out of the way.
- Don't move your king for no reason: one king move and you lose the right to castle on both sides. If your king gets checked in the opening, block if you can rather than rushing to move the king.
Which side should you castle?
Most of the time, castle short: the king ends up closer to the corner, has three pawns in front of it, and it's quicker.
Castling long is riskier, because the a2 pawn in front of the king is far away, and you often need an extra move, Kb1, to be safe. But it has one big plus: the rook goes straight to the d-file.
When the two sides castle on opposite sides, the game often turns into a race where both push pawns at the other king, and whoever gets there first wins. The Dragon Sicilian is the classic example: White castles long and pushes the h-pawn, while Black castles short and strikes back down the c-file.
Puzzle: mate by castling
The rook can give check the moment it lands after castling, and once in a while that's even checkmate:
Show answer
1. O-O-O# White castles long. The rook lands on d1 and checks the black king on d3 through d2, and the king on c1 covers c2. As for the king's other escapes, c3 is covered by the b2 pawn and e2 by the bishop on h5, and the rest are blocked by Black's own pawns. Checkmate.
Frequently asked questions
When castling, do I move the king or the rook first?
In official games, move the king first, then the rook. If you touch the rook first, your opponent can insist that you move only the rook and not castle. On this site, you can click the king and then its destination square, or just click your own rook.
If my king was in check earlier, can I still castle?
Yes. Having been in check before doesn't matter. As long as neither the king nor the rook has moved and you're not in check right now, you can castle.
Can the rook be under attack when I castle?
Yes. The rule only looks at the king's current square, the square it passes through and the square it lands on. The rook being attacked, or the rook crossing an attacked square (like b1 when castling long), doesn't matter.
Try it yourself
Go play chess online and try to castle before move ten. For the other special move, see en passant. To learn how to develop and attack after castling, pick an opening from the openings guide.