Castling in chess: the rules, explained

Castling moves your king two squares toward a rook, and that rook jumps to the square the king just crossed. You can only do it if neither piece has moved, the squares between them are empty, and your king is not in check and doesn't pass through or land on an attacked square.

Castling is the only move in chess where two of your pieces move at once. It tucks your king away from the centre and brings a rook into the game, which is why almost every good game has it in the first ten or so moves.

How to castle

Castling always starts with the king. It moves two squares toward one of its rooks, and that rook then jumps over to the square right next to the king, on the other side.

Short castling (king side). The king goes from e1 to g1 and the rook from h1 to f1. For Black: e8 to g8, and the rook from h8 to f8.

8765432a1bcdefgh
Short castling: the king goes from e1 to g1 and the rook from h1 to f1. (White to move)

The pieces

  • King
  • Queen
  • Rook
  • Bishop
  • Knight
  • Pawn

Long castling (queen side). The king goes from e1 to c1 and the rook from a1 to d1. For Black: e8 to c8, and the rook from a8 to d8. It's called long because the rook travels three squares instead of two.

8765432a1bcdefgh
Long castling: the king goes from e1 to c1 and the rook from a1 to d1. (White to move)

Castling counts as one move: a king move.

The conditions

You can castle only if all of these are true:

  1. Your king has never moved in this game, not even if it moved and came back.
  2. The rook you castle with has never moved. If only one rook has moved, you can still castle with the other one.
  3. Every square between the king and the rook is empty. For long castling that includes b1 (or b8).
  4. Your king is not in check right now.
  5. Your king doesn't pass through or land on a square your opponent attacks. For short castling that means f1 and g1; for long castling, d1 and c1.

Conditions 1 and 2 are permanent: once the king or that rook has moved, that castling is gone for the rest of the game. Conditions 3 to 5 are temporary: if a square is attacked now, you may be able to castle a few moves later.

Try it: castle short here.

The cases that confuse beginners

Can you castle through check?

No. The king can't pass through or land on an attacked square. Here the black rook covers f1, so short castling is illegal. The other side is still fine.

Can you castle if your rook is attacked?

Yes. The rules only care about the king's squares. If the rook is under attack, you can still castle, and castling often saves it.

Can the rook pass through an attacked square?

Yes, in long castling. The b1 square (b8 for Black) must be empty, but it may be attacked, because only the rook passes over it, not the king.

Can you castle after being in check?

Yes. If your king was checked a few moves ago and you blocked the check without moving the king, you can still castle later. What matters is whether the king itself has moved.

Can you castle out of check?

No. If you are in check right now, deal with the check first: move the king, capture the checking piece or block. Castling may be possible on a later move, as long as the king itself didn't move.

Can you castle on both sides?

No, only once per game. Castling moves your king, and a king that has moved can never castle again. So you choose one side.

In one sentence: castling is legal when the rook is under attack, but not when the king is, or would be on its way.

How to castle on a phone or computer

In most chess apps, including Chessmigo, Lichess and Chess.com, you move the king two squares toward the rook and the app moves the rook for you. Some apps also let you drop the king on the rook. If the app won't let you, one of the five conditions isn't met.

On a real board, move the king first, with one hand, and then the rook. Under the official rules, if you deliberately touch the rook first and then the king, you aren't allowed to castle on that side for that move.

When to castle

Early. Most beginner games are lost by a king left in the centre while the pieces around it are traded off and the files open up. A simple plan for the opening:

Our guide to chess opening principles explains why, and the 10-minutes-a-day plan puts castling into your first weeks.

Long castling puts the king a bit further from the corner and brings the rook straight to the centre. It's more common in sharper games where both players attack each other's king. For now, short castling is the safer default.

Quick summary

Sources

  • FIDE Laws of Chess (in effect since 1 January 2023): article 3.8.2 (castling and when it's prevented) and article 4.4.2 (touching the rook before the king).