Castling in Chess: Rules, Kingside vs Queenside, When to Castle
How kingside and queenside castling work, the five conditions that forbid castling, when you should castle and what changes when the kings castle on opposite sides.
By AcademiaTal9 min read
Castling is the move in which the king steps two squares towards one of its rooks and that rook jumps over the king to the square next to it. It does two jobs at once: it tucks the king away behind its pawns and brings the rook out of the corner. You can castle only once per game and only when five conditions are met, and they are worth knowing by heart, because they cause more arguments at the club than almost any other rule.
How kingside and queenside castling work
There are two ways to castle, depending on which rook the king goes towards:
Kingside castling (O-O), towards the rook on the king's side. For White, the king goes from e1 to g1 and the rook from h1 to f1. For Black, the king goes from e8 to g8 and the rook from h8 to f8.
Queenside castling (O-O-O), towards the rook on the queen's side. For White, the king goes from e1 to c1 and the rook from a1 to d1. For Black, the king goes from e8 to c8 and the rook from a8 to d8.
They are also called short and long castling, after the distance the rook travels: two squares in one case, three in the other. In algebraic notation it is written with the letter O (or with zeros, 0-0, in many books), never by naming the squares.
A quiet Italian Game shows kingside castling at its most natural: the knight and bishop are out, the path is clear and the king goes to g1.
1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O
Queenside castling needs three empty squares instead of two —b1, c1 and d1— so the knight, the bishop and the queen all have to move first. That is why it takes one move longer:
1.d4 d5 2.Nc3 Nf6 3.Bf4 e6 4.Qd2 Be7 5.O-O-O
The five conditions: when you cannot castle
The FIDE Laws of Chess distinguish two kinds of restriction. The first two are permanent; the other three apply only on that move, and once they disappear you may castle again.
The right is lost for good:
If the king has already moved. Even if it has gone back to e1, it can no longer castle on either side.
If the rook on that side has already moved. Only castling on that side is lost: if the h1 rook has moved, you can still castle queenside.
Not allowed on that move:
If the king is in check. Castling is not a way out of check.
If the king crosses or lands on an attacked square. For kingside castling, f1 and g1 must not be controlled by any enemy piece; for queenside castling, d1 and c1.
If there is any piece between the king and the rook, yours or your opponent's.
The fourth is the one people get wrong most often. In this position White cannot castle kingside, because the bishop on c4 controls f1 and the king would have to pass through it:
The black bishop controls f1: kingside castling is forbidden while it stays there.
But the rule is about the king's squares, not the rook's. In queenside castling the rook crosses b1, and that square can be attacked without any problem. Here White may play O-O-O:
The bishop attacks b1, but the king does not pass through b1: queenside castling is legal.
For the same reason, you can castle while your rook is attacked. And you can castle after having been in check earlier, as long as the king did not move to escape it: if the check was blocked or the checking piece captured, the right remains intact.
How to castle over the board
In a tournament game knowing the rule is not enough: how you touch the pieces matters too. Under Article 4 of the FIDE Laws:
Touch the king first. A player who touches the king and then the rook must castle on that side, if it is legal.
If you touch the rook first, you cannot castle on that side on that move, and under the touch-move rule you must move the rook.
Use one hand only, as with any move: first the king two squares, then the rook.
In a friendly game nobody will complain about the order, but getting used to moving the king first from day one saves you an awkward moment at your first tournament. If you are preparing for one, how to prepare for your first chess tournament covers more of the rules worth knowing beforehand.
In Chess960, the variant popularised by Bobby Fischer, the king and rooks start on other squares, but castling ends up the same way: king on g1 and rook on f1, or king on c1 and rook on d1.
When you should castle
The classic advice in the opening principles is to castle early, and there is a concrete reason for it: a king on e1 sits on the e-file, which is the first file to open when the central pawns are exchanged. A rook or queen on that file, with the king still there, often decides the game within a few moves.
But "early" does not mean "on the first possible move". A few guidelines:
Castle when the centre threatens to open. If the central pawns are locked, the king can stay in the centre a little longer and you can use that time to develop.
Do not leave the king in the centre to win a pawn. Scholar's mate and opening traps punish exactly that. Many of the chess opening traps work only because a king stayed uncastled.
Look at where you are castling. If your opponent already has pieces aimed at the kingside, castling there can mean walking into the lion's den. Sometimes it is better to wait or to choose the other side.
Do not push the pawns in front of your castled king without a reason. Once castled, the f, g and h pawns (or a, b and c pawns) are the shield. Each one that advances leaves a weak square behind.
The extreme case of a king that loses the right to castle is the Fried Liver Attack: after the knight sacrifice on f7, the black king has to step out and fight and can never hide again.
Black has won a piece, but the king has moved and will never castle. The guide to the Fried Liver Attack explains why serious Black players avoid this line with 5...Na5.
Artificial castling
When you cannot castle —because the king has already moved, or because an attacked square stops you for too long— there is still a way out: walk the king there by hand. With the king on f1, for example, you play g3 and Kg2, and then the h1 rook comes out via Rf1 or becomes active along the h-file. It takes two or three moves longer than castling, but it leaves the king on the same safe square.
It is a resource that turns up often in master games, and one worth remembering before you panic because a check forced your king to move. A king that cannot castle is not lost: it is just behind schedule.
Opposite-side castling: when the game becomes a race
When one side castles kingside and the other queenside, the nature of the game changes. With both kings on the same side, the pawns that protect your own king are the same ones that would have to advance to attack the other, so nobody wants to weaken themselves. With the kings on opposite wings, that problem disappears: each side can throw its pawns at the enemy king without exposing its own.
The best-known example is the Yugoslav Attack against the Dragon Variation of the Sicilian Defence:
White's plan is to push h4 and h5, open the h-file and exchange the g7 bishop with Bh6. Black attacks on the other wing, with the half-open c-file, ...Qa5 and sometimes an exchange sacrifice on c3. Whoever gets there first wins, and a single tempo of delay often decides the game.
In these positions the priorities shift:
Time is worth more than material. A pawn given up to open a file against the enemy king is usually a good investment.
Defending is rarely enough. The best defence is usually a faster attack on the other wing.
Rooks go to the files that are opening, not to the central ones.
The course Structures, attack and pressure: resources for competitive chess has a lesson devoted to opposite-side castling and to working out who gets there first.
Common castling mistakes
Castling in check or through an attacked square. In a tournament it is an illegal move and gets corrected; online, the platform simply will not let you. Check the squares before you touch the king.
Moving the rook "just for a moment" and losing castling on that side. It happens a lot with the h1 rook that steps to g1 to support a pawn push.
Castling on autopilot. Castling towards the side where your opponent has all their pieces is not safety, it is an invitation.
Pushing the castling pawns without a reason.h3 and g4 in the same game with no plan behind them leave the king without a roof.
Forgetting the rook after castling. Castling brings the rook out of the corner, but you still have to put it on an open file for it to be useful.
To see how an attacking master exploits an uncastled or badly castled king, the course Mikhail Tal's Legacy goes through games in which Tal sacrificed material precisely to leave the enemy king stuck in the centre. And if after a game you wonder whether castling at a given moment was right, with Ask the GM you can ask a master about the exact move.
The king moves two squares towards one of its rooks, and that rook jumps over the king to the square the king has just crossed. It is the only move in which two pieces move at once, and it counts as a single move.
When are you not allowed to castle?
Never again if the king has already moved, or if the rook on that side has moved. On a given move you also cannot castle if the king is in check, if any square the king crosses or lands on is attacked, or if there are pieces between the king and the rook.
Can you castle if your rook is attacked?
Yes. Only the king's squares matter: the one it starts on, the one it crosses and the one it lands on. In queenside castling the rook passes over b1 (or b8), and that square may be attacked, although it has to be empty.
Is it better to castle kingside or queenside?
Kingside castling is quicker and leaves the king better protected, which is why it is more common. Queenside castling takes one move longer and leaves the a-pawn exposed, but it puts the rook on a central file straight away and is the basis of attacks with opposite-side castling.
Can you castle after being in check?
Yes, as long as the king did not move to get out of the check. If the check was blocked by another piece or the checking piece was captured, the right to castle is untouched.
Courses that cover this
If you want to put this into practice with structured material: