Castling in Chess: How It Works and When You Can't Castle
TL;DR
In one sentence The king moves two squares toward a rook, and the rook jumps over to the other side of the king. Kingside (O-O) King to g1, rook to f1 (Black: g8 and f8) Queenside (O-O-O) King to c1, rook to d1 (Black: c8 and d8) Why do it It hides your king behind pawns and brings a rook toward the center, in one move When you can't King or rook has moved, pieces in the way, king in check, or crossing or landing on an attacked square
How castling works
Castling is the only move in chess where you move two pieces at once. It does two jobs: it takes your king out of the center, where it's easy to attack, and it brings a rook from the corner toward the middle, where it can join the game.
Kingside castling (O-O)
1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5
This is the Italian Game, and White's next move is usually 4. O-O:
Kingside castling is the most common kind because only two pieces (the knight and the bishop) need to move out of the way first.
Queenside castling (O-O-O)
On the queenside there are three squares between the king and the rook, so the knight, bishop and queen all have to move first. The king still moves two squares, to c1, and the rook lands on d1.
1. d4 d5 2. Nc3 Nf6 3. Bf4 e6 4. Qd2 Be7 5. O-O-O
Queenside castling puts the rook on a central file straight away, but the king is a little more exposed: the a2 pawn is further away, and the king has to watch the b1 and a2 squares. When the two players castle on opposite sides, both usually throw their pawns at the other king, and the game turns into a race.
The five rules: when you can't castle
You may castle only when all of these are true:
- Your king has never moved. Even if it moved and came back, castling is gone for the rest of the game.
- The rook you castle with has never moved. If only the h1 rook has moved, you can still castle queenside, and the other way around.
- Every square between the king and the rook is empty.
- Your king is not in check. You can't castle out of check.
- The king doesn't pass through or land on an attacked square. The squares the king crosses (f1 and g1, or d1 and c1) must not be covered by an enemy piece.
Notice what is not on the list. The rook may be attacked, and on the queenside the rook may pass over an attacked square on b1. Only the king's path matters.
A real example: castling with check
Castling usually is a quiet move, but not always. Here's a position from one of our puzzles, taken from a real Lichess game, with White to move:
Black's king is stuck in the center on d8, and the d-file is open. 18. O-O-O+ brings the king to safety and gives check with the rook in one move. After 18...Nd7 19.Rxd7+ Qxd7 20.Rd1, Black's queen is pinned to the king, and White wins it for a rook. It's a good reminder of why castling early matters: here it's Black's king that never got out of the center.
When should you castle?
- Usually early. Develop your knights and bishops, then castle, often within the first ten moves. Our opening principles guide explains why.
- Before the center opens. If pawns are being traded in the middle of the board, a king on e1 is in danger.
- Look before you castle. Castling into an attack (pawns already marching at that side, or a bishop aimed at h7 or h2) can be worse than waiting.
- Don't push the pawns in front of your castled king without a reason. Those pawns are its shield.
How to castle on Lichess, Chess.com and over the board
Online, drag or click your king two squares toward the rook, and the rook follows on its own. Over the board, touch the king first and move it two squares, then move the rook with the same hand. If you touch the rook first, the touch-move rule lets your opponent insist that you move the rook.
Practice it
Every opening Coach teaches you when to castle in that opening, against real replies at your rating. To see castling as a winning move, try our castling puzzles. Next, read about the other special pawn rule, en passant, or browse the full chess terms glossary.
FAQ
How does castling work in chess?
The king moves two squares toward one of its rooks, and that rook jumps over the king to the square right next to it. Kingside (O-O), the king goes to g1 (g8 for Black) and the rook to f1 (f8). Queenside (O-O-O), the king goes to c1 (c8) and the rook to d1 (d8).
Can you castle out of check?
No. You can't castle while your king is in check. You also can't castle through a square that an enemy piece attacks, or onto a square where your king would be in check.
Can you castle if the king has moved and gone back?
No. Once the king has moved, even if it returns to its starting square, you can never castle in that game. If only one rook has moved, you can still castle on the other side.
Can you castle if your rook is attacked?
Yes. The rules only care about the king. The rook may be attacked, and on the queenside it may pass over an attacked square (b1 or b8).
Which piece do you touch first when castling?
The king. Over the board, move the king two squares first, then the rook. If you touch the rook first, under the touch-move rule your opponent can insist that you make a rook move instead. Online, you just move the king two squares and the rook follows.
Can castling give check?
Yes. If the rook lands on a file or rank that leads to the enemy king, castling gives check. It's rare, but it does happen, especially with queenside castling along the d-file.
Every opening Coach shows you when to castle and why, against the replies real players at your rating choose.
Browse all 36 openings free →