Castling in chess: how to castle, and when you can't

Castling is the one move in chess where two pieces move at the same time. The king slides two squares towards a rook, and the rook jumps over him and lands on the square he passed through. It is a single turn, and it is the fastest way to get a king out of the middle of the board. Tap the white king below and both versions of it show up as dots.

White can castle either way here. Among the king's dots, g1 castles kingside and c1 castles queenside. Tap one and watch the rook move by itself.

How to castle kingside (short castling)

Kingside is the half of the board the king starts on, and it is the shorter trip, so this one is called short castling. The king goes from e1 to g1, two squares towards the corner, and the h1 rook lands on f1 beside him. Black does the same thing a row further up: king e8 to g8, rook h8 to f8.

Only two squares have to be empty, f1 and g1, which is why most players castle short and why it usually happens inside the first ten moves. Move the knight and the bishop out of the way and the king can go.

How to castle queenside (long castling)

Queenside is the other half, where the queen starts, and it is the longer trip: long castling. The king goes from e1 to c1 and the a1 rook swings all the way over to d1. The king still only moves two squares. The rook is the piece doing the travelling.

Three squares have to be clear this time, b1, c1 and d1, so queenside castling takes a move or two longer to set up. In exchange the rook lands closer to the middle of the board, which is often the better square for it.

The four castling rules

Castling is legal only when all four of these hold.

  1. Neither the king nor that rook has ever moved. Moving either one and putting it back does not restore the right. Losing the h1 rook's rights leaves the queenside one intact, and the other way round.
  2. Every square between the king and the rook is empty. Your own pieces count as blockers just as much as the other player's.
  3. The king is not currently in check.
  4. The king does not pass through or land on an attacked square. Going kingside that means f1 and g1; going queenside, d1 and c1.

The next three boards show what each of those looks like in practice. In every one, tap the white king and see which dots are missing.

You cannot castle out of check. The bishop on h4 is attacking the king along the diagonal, so the only dots are ordinary king moves: d1, d2, e2 and f1. No c1, no g1.
You cannot castle through check either. The rook on f8 covers the whole f-file, including f1, the square the king would cross going kingside. Queenside is untouched, so c1 is still there.
The exception people miss. The black rook attacks b1, but the king never visits b1 going queenside, only the rook passes over it. Both castling dots, c1 and g1, are still legal.

That last board is worth a second look, because the rule only ever talks about the king. The rook may be attacked, and on the queenside it may pass over an attacked square, and castling is still fine. Only the king's own squares matter.

Why castle at all?

Two reasons, and you get both for one move. The king ends up in the corner behind a wall of unmoved pawns instead of standing in the middle of the board where every open line eventually points. And the rook, which starts the game stuck in a corner doing nothing, lands next to the middle where it can actually see something.

That second half is easy to undervalue. Rooks are worth five points each and beginners routinely finish a game having never moved either of them. Castling puts one straight into play.

When should you castle?

Early, as a habit. Get a knight and a bishop out, then castle, usually somewhere between moves four and ten. The longer a king sits on e1 or e8, the more likely a file opens in front of it and the whole plan falls apart.

Short castling is the default because it is quicker and the pawns in front of the king are usually still where they started. Castle long when you want the rook on the central file, or when the kingside pawns have already been pushed forward and the shelter there is gone. One thing to keep in mind: after castling queenside the king sits on c1, with the a-pawn slightly loose, so many players spend a later move tucking the king to b1.

How to castle on this site

Tap the king, then tap the square two along. That is the whole thing. The rook moves itself as part of the same move, and the board only offers the castling square when all four conditions are met, so you cannot castle illegally by accident. Dragging the king two squares works too.

It behaves the same way in both modes: passing one device back and forth in 2 player chess offline, or on a shared link in online play. If you are still setting up, there is how to set up a chess board, and the movement of every piece involved is on chess pieces names and moves, alongside the rules of chess in full.

Frequently asked questions

Can you castle out of check?

No. If your king is in check you have to deal with the check first, by moving the king, blocking the attack or capturing the attacker. Castling is never a legal answer to check.

Can you castle through check?

No. The king may not cross a square that an enemy piece attacks, or land on one. If either of the two squares it travels over is covered, that side is closed off, though the other side may still be available.

Can you castle after moving your king?

No. Once the king has moved, even if it goes straight back to its starting square, the right to castle is gone for the rest of the game on both sides of the board.

Can you castle if the rook is attacked?

Yes. The rule only covers the king's squares. Your rook can be attacked, and going queenside it can pass over an attacked square as well, and castling is still legal.

Can you castle twice in a game?

No. Castling requires a king that has never moved, and castling moves it, so each player gets at most one castle per game.

Is castling one move or two?

One move, even though two pieces change square. It uses your whole turn and it is written down as a single move, O-O for kingside and O-O-O for queenside.

Can you castle if only the other rook has moved?

Yes. The two sides are independent. Moving your h-rook costs you kingside castling but leaves queenside available, as long as the king itself has stayed put.

Now play it

Play 2 player chess offline on one device or play chess online with a friend.