To castle in chess, move your king two squares sideways toward one of your rooks, then lift that rook over the king and place it on the square right next to it, on the other side. It counts as one move. You may castle only if the king and that rook have never moved, the squares between them are empty, your king is not in check, and the king does not pass through or land on a square that an enemy piece attacks.

Castling is a special move with two big jobs. It tucks your king away into a safer corner, and it brings a rook toward the middle where it can join the game. Let us learn how it works, step by step.

The two kinds of castling

You can castle on either side of the board.

  • Kingside castling (short castling): the king moves from e1 to g1, and the rook jumps from h1 to f1. Black does the same on the eighth row: king e8 to g8, rook h8 to f8. It is written O-O.
  • Queenside castling (long castling): the king moves from e1 to c1, and the rook jumps from a1 to d1. For Black: king e8 to c8, rook a8 to d8. It is written O-O-O.

In both cases the king moves exactly two squares. Only the rook's distance changes: two squares on the kingside, three on the queenside.

8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
Follow the arrows for White. Kingside: the king goes e1 to g1 and the rook h1 to f1. Queenside: the king goes e1 to c1 and the rook a1 to d1.

The castling rules: when are you allowed?

Here are all the conditions. Every one must be true.

  1. The king has never moved in this game. Even if it moved and came back to e1, castling is gone for good, on both sides.
  2. That rook has never moved. If only the h1-rook has moved, you can still castle queenside with the a1-rook.
  3. All the squares between the king and the rook are empty. On the queenside that means b1, c1 and d1 must be empty.
  4. Your king is not in check right now. You cannot castle to escape a check.
  5. The king does not cross or land on an attacked square. For kingside castling, f1 and g1 must not be attacked. For queenside castling, d1 and c1 must not be attacked.

Two surprises that are allowed

  • The rook may be under attack. The safety rules are only about the king's squares.
  • On the queenside, b1 (or b8 for Black) may be attacked. The king never touches that square; only the rook passes over it. It just has to be empty.
8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
The black bishop on e4 attacks the rook on h1 and the square b1. Can White still castle? Try both: drag the king two squares to g1, reset, then try c1.

Your turn: move the pieces on the board.

Tap a piece, then tap where it should go, or drag it.

Both work. The h1-rook is attacked, but that is fine. The b1 square is attacked, but the king never goes there. The king's own path (f1 and g1, or d1 and c1) is safe, so both castling moves are legal.

8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
Now the bishop sits on f3 and attacks d1. White can castle kingside, but not queenside, because the king would have to pass through the attacked d1 square.

When should you castle?

Most coaches advise beginners to castle early, often within the first ten moves. The middle of the board opens up quickly once pawns start trading, and a king left on e1 can get caught by checks and attacks. Kingside castling is usually quicker, because only the knight and bishop need to move out of the way first.

Castling fits naturally with the other chess opening principles: bring out your knights and bishops, fight for the centre, then castle. After castling, try not to push the pawns in front of your king without a good reason. A king with no escape square can fall into a back rank checkmate.

8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
A real game position. White has developed the queenside pieces. Find the castling move that is allowed here and play it. Why can White not castle kingside yet?

Your turn: move the pieces on the board.

Tap a piece, then tap where it should go, or drag it.

Only queenside castling is possible, because the bishop on f1 is still blocking the kingside. After O-O-O the white rook lands on d1, ready to use the open d-file.

Puzzle: checkmate by castling

8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
White to move. The black king has wandered to d3. Find the move that gives checkmate. Hint: two white pieces move at once.

White to move. Make your move on the board.

Tap a piece, then tap where it should go, or drag it.

Castling queenside puts the rook on d1, giving check down the d-file. The king on c1 covers c2 and d2, the knight covers e2, the pawns cover c4 and e4, and the pawns on c3 and e3 are protected, so they cannot be captured. The black king has nowhere to go. It is rare, but it shows how powerful the castled rook can be.

Questions parents and kids ask

Can you castle if the rook is under attack?

Yes. Only the king's squares matter. The rook may be attacked, and on the queenside the b1 or b8 square may be attacked too.

Can you castle out of check?

No. If your king is in check, you must deal with the check in another way. You can castle later, once the check is gone, as long as the king has not moved.

Can you castle after moving the king and moving it back?

No. Once the king has moved even once, you lose the right to castle on both sides for the rest of the game.

How many times can you castle in a game?

Only once per game for each player, because castling moves the king, and a king that has moved can never castle again.

Is castling with the queen allowed?

No. Castling is only between the king and one of its rooks. The queen never castles.