Castling in Chess

Castling is the only move in chess that moves two pieces at once: the king steps two squares toward one of its rooks, and that rook jumps over the king to land right beside it on the other side. It tucks the king away in a safer corner and brings the rook toward the middle where it can work. Each side may castle at most once per game, and only when five conditions are met. Below, with diagrams: short and long castling, the five conditions, the common myths, and two Try it boards.
By · every move and position checked with the move generator our games run on

Last updated:

How do you castle?

There are two kinds of castling, depending on which rook the king goes to:

Short castling (on the kingside, toward the h-rook): the white king goes from e1 to g1 and the rook from h1 jumps to f1. Black does the same: king e8 to g8, rook h8 to f8. It is written O-O (two capital letters O, not zeros). The king and rook have only two squares between them, hence “short”.

Long castling (on the queenside, toward the a-rook): the white king goes from e1 to c1 and the rook from a1 jumps to d1. For Black: king e8 to c8, rook a8 to d8. It is written O-O-O. Here there are three squares between king and rook (b, c and d), hence “long” — but the king still moves just two squares; the rook moves three.

Short castling: the white king goes from e1 to g1, the rook from h1 jumps to f1
Short castling, O-O: king to g1, rook to f1
Long castling: the white king goes from e1 to c1, the rook from a1 jumps to d1
Long castling, O-O-O: king to c1, rook to d1

The easiest way to remember it: the king always moves two squares, and the rook always lands on the square the king just crossed. Castling counts as one move (a king move); then it is the other side's turn.

When can you castle? The 5 conditions

Quick checklist (all 5 must hold to castle): 1. The king has not moved yet; 2. That rook has not moved yet; 3. No pieces stand between the king and rook; 4. The king is not in check; 5. The squares the king crosses and lands on are not attacked.

The FIDE Laws (Article 3.8.2) split the conditions into two kinds. Two things take the right away for good:

(1) The king has already moved — even if it later went back to its square — and then you can never castle on either wing; (2) that rook has already moved — then you can't castle with that rook, though you still can with the other one if it hasn't moved.

Three more only stop you for now, and once things change you may castle again: (3) there is any piece between the king and the rook (yours or the opponent's); (4) the king is in check; (5) the square the king passes over, or the square it lands on, is attacked by an enemy piece (landing on an attacked square would be moving into check).

In each of the four diagrams below White can't castle short right now; the red arrow shows the threat, or the blocked path:

The white bishop is still on f1, between the king and the h1 rook
(3) A piece in between: the bishop is still on f1
A black rook on e8 checks the white king down the e-file
(4) In check: you can't castle out of it
A black bishop on c4 covers f1 along the diagonal; f1 is crossed out
(5) The king would cross f1, which the bishop attacks
A black rook on g7 covers g1 down the g-file; g1 is crossed out
(5) The king would land on g1, which the rook attacks

In all four, once the bishop moves out of the way, the check is dealt with, or the enemy bishop or rook leaves that line, White may castle again — the king and rook still haven't moved.

Can you castle if the rook is attacked? Common myths

Yes — the rook may be attacked. The conditions are only about the king: the square it stands on, the square it crosses and the square it lands on. Where the rook stands or passes doesn't matter. So when castling long, it is fine if b1 (b8 for Black) is attacked: the rook crosses it, the king never does. Lots of players get this wrong, so don't call foul the next time your opponent castles long past an attacked b-square.

Having been in check earlier doesn't matter. If you got out of that check by blocking or capturing and the king never moved, you may still castle later. If the king stepped away to escape, castling is gone for good.

A king that went away and came back has still moved. After Ke1-f1-e1 the king looks untouched, but castling is no longer allowed. The same goes for a rook.

Only with a rook. You can't castle with the queen or a knight, nor along a file, and each side castles at most once per game.

Try it: which side can you castle?

White's king and both rooks have never moved. One black bishop eyes f1, the other aims at the rook on a1, and the black rook watches b1. Castle now — but on which side? (Tap the king, then its square. If it isn't allowed, the board will tell you why.)

Puzzle: white king e1, rooks a1 and h1; a black bishop on c4 covers f1, another on f6 aims at a1, a black rook on b8 covers b1

White to move. Tap a piece, then tap where it should go.

Hint / Answer

Hint: Look only at the squares the king crosses and lands on: f1 and g1, or d1 and c1?

Answer: O-O-O — Long castling is allowed: the king crosses d1 and lands on c1, and neither is attacked. The attacked rook on a1 and the guarded b1, which only the rook crosses, don't matter. Short castling isn't allowed: the king would cross f1, which the bishop attacks.

Why castle?

Once the game gets going, the central pawns are often exchanged and the e- and d-files open up; a king left in the middle is easy to attack with rooks and the queen. Castling moves it to a corner behind three pawns in a single move.

At the same time the rook, stuck in the corner until now, jumps to the middle (f1 or d1), ready to use an open file. That is why one of the three principles in chess openings for beginners is castle early.

After castling, keep an eye on your king: don't push the three pawns in front of it without a reason, or the enemy queen and rooks may come through; but if none of them ever moves, watch out for the back-rank mate.

Where does castling come from? According to Wikipedia's “Castling” and “Rules of chess” articles, it grew out of the medieval “king's leap”, when a king could jump two squares on its first move. Something like it was played in Europe by the 14th–15th centuries, it took its present form in the 17th century, and parts of Italy kept other castling rules until the late 19th century. How the other rules grew into today's chess is told in the history of chess.

How do you castle on Paper Generals?

Tap the king, then the square it should go to (g1 for short castling, c1 for long; g8 and c8 for Black). The rook jumps across by itself — no need to tap it. When castling is allowed, the square shows up among the king's moves as soon as you tap the king.

If castling isn't allowed, that square simply isn't among the king's moves. On this page's Try it boards and in the castling step of our lesson, the board also tells you why: “The King would pass through a square the enemy attacks”, “The King or that Rook has already moved”… The castling rules step tests exactly when you can't.

Over the board there is one more rule for your hands (FIDE Article 4.4): castling is a king move, so touch the king first; if you deliberately touch the rook first and then the king, you may not castle on that side with that move. Online, you don't need to worry about it.

Try it: Black castles

A real opening: 1.e4 e5 2.Nf3 Nf6 3.Bc4 Bc5 4.O-O — White has just castled short. Now it's Black's turn: castle too. (The board is turned to Black's side.)

Puzzle: an Italian Game where White has castled; the black king is on e8 and f8 and g8 are empty

Black to move. Tap a piece, then tap where it should go.

Hint / Answer

Hint: The queen, bishop and knight still block the queenside; on the kingside, f8 and g8 are empty.

Answer: 4...O-O — The black king goes from e8 to g8 and the rook jumps from h8 to f8. Long castling isn't possible: the queen, bishop and knight still stand between the king and the a8 rook.

Quick answers

Can you castle if your rook is attacked?

Yes. The conditions only concern the squares the king stands on, crosses and lands on; an attacked rook, or an attacked square the rook crosses, doesn't matter.

Can you castle after you have been in check?

Yes, as long as the king didn't move to get out of it (you blocked or captured instead). Once the king has moved, castling is gone for good.

How many squares does the king move in long castling?

Still two: e1 to c1 for White, e8 to c8 for Black. It's the rook that moves three squares (a1 to d1).

If the king moves away and comes back, can it still castle?

No. Once the king has moved at all, it can never castle in that game; a rook that has moved can't castle either.

What do O-O and O-O-O mean?

Castling in chess notation: O-O is short (kingside) castling and O-O-O is long (queenside) castling, written with capital letters O.

How many times can you castle in a game?

At most once per side: after castling the king has moved, so it can't castle again.

How do I castle on Paper Generals?

Tap the king, then its target square (g1 or c1; g8 or c8 for Black) and the rook follows by itself. If castling isn't allowed, that square isn't among the king's moves.

What next

Chess has two more special rules, both for pawns: en passant and promotion; and when you are winning, beware of stalemate. All the rules are on how to play chess.

Then play the computer and try to castle within your first ten moves. To see a master attack after castling long, watch the 17-move Opera Game.

The rules here follow the FIDE Laws of Chess; for tournament details (such as touch-move), the Laws themselves decide.