ChessPuzzlePrint Free chess puzzles, tools and printables

Castling in Chess

Pick a position or paste a FEN: every castling rule is ticked or crossed, so you see exactly why you can or cannot castle.

What this castling in chess checker does

Castling in chess is a special move in which the king and one rook move together in a single turn. The king moves two squares towards the rook, and the rook jumps over the king to the square next to it. Because it is the only move that shifts two pieces at once, it has more conditions than any other move.

This page checks all of them for you. Choose one of nine example positions, paste a position as a FEN, or play moves on the board. For White or Black, it shows the two castling options, kingside (O-O) and queenside (O-O-O), as legal or not allowed. Every rule is listed with a tick or a cross, so a refused castle always comes with the reason.

The checks follow the FIDE Laws of Chess and run in your browser; nothing is sent anywhere.

Castling in chess example

How to use the castling checker

To see whether you can castle in a position:

  1. Pick a position from Example position, or paste a FEN into Position (FEN) and press Enter. A FEN is the one-line text code for a position that the board editor and most chess programs can export.
  2. Choose Check castling for White or Black. It starts with the side whose turn it is in the FEN.
  3. Read the two boxes, Kingside (short, O-O) and Queenside (long, O-O-O). Each carries a green Legal or red Not allowed label.
  4. Look at the list under each label. A tick means the rule is met. A cross, shown in bold, is the rule that stops the move.
  5. To castle on the board, click the king. The squares it may go to are marked. Click the castling square (g1 or c1 for White, g8 or c8 for Black); the rook moves by itself.
  6. After any move the boxes update for the side to move, so you can see how one move changes the castling options.

Use Flip board to view the position from Black's side and Starting position to reset. The FEN is also written to the address bar, so you can copy the link and share the exact position.

What are the rules for castling in chess?

To castle in chess you must still have the right. Under Article 3.8 of the FIDE Laws of Chess (in force from 1 January 2023) the right to castle is lost for good once the king has moved, or once the rook you want to castle with has moved. That is the first rule the checker tests, and in a FEN it is the letters K, Q, k, q in the third field.

Even with the right intact, castling can be prevented for the moment. The checker tests each of these in turn:

  • Pieces in the way: every square between the king and the rook must be empty. For White's queenside that means b1, c1 and d1.
  • No castling out of check: the king's own square must not be attacked.
  • No castling through check: the square the king crosses (f1 or d1 for White) must not be attacked.
  • No castling into check: the square where the king lands (g1 or c1) must not be attacked.

Can you castle if the rook or a square next to it is attacked?

Yes. Only the three squares the king uses matter: where it starts, the square it crosses and the square where it lands. The Laws do not list an attacked rook as an obstacle, and b1 (or b8) on the queenside is crossed only by the rook, so it may be attacked. The example called Rook attacks b1 shows this: queenside castling stays legal.

What does castling do for your position?

Castling does two jobs in one move: it takes the king from the centre to a corner, usually behind a wall of pawns, and it brings a rook from the corner towards the middle of the first rank, where it can reach open files. That is why the usual advice is to castle early and to clear the pieces between king and rook as part of developing.

Kingside castling needs only two empty squares and puts the king on g1 or g8. Queenside castling needs three empty squares and puts the king on c1 or c8. The notation is O-O for kingside and O-O-O for queenside, written with letters, not zeros, in a game score.

Examples

8♚765432♜♜1abcd♚efg♜h
Rook on f2 attacks f1. Kingside (short, O-O): not allowed. f1, the square the king crosses, is attacked by the black rook on f2. You cannot castle through check. Queenside (long, O-O-O): legal
8♜♚765432♜1abcd♚efg♜h
The b1 square is attacked but only the rook crosses it, so both castling moves are legal.
♜8♝♛♚♜♟7♟♟♟♟♟♟6♞♞5♝♟4♝♟3♞♟2♟♟♟♟♟♟♜1a♞b♝c♛d♚efg♜h
Italian-style position. Kingside (short, O-O): legal Queenside (long, O-O-O): not allowed. white queen on d1, white bishop on c1 and white knight on b1 are in the way: every square between king and rook must be empty.

Questions and answers

Can you castle out of check?

No. If the king is in check you must answer the check by capturing the attacker, blocking or moving the king. The checker marks this with a cross on "The king is not in check", and both castling options show Not allowed.

Can you castle if you moved the rook and put it back?

No. The right to castle with that rook is lost the moment it moves, even if it returns to its starting square. The same is true for a king that moves and comes back. In a FEN this shows as a missing K, Q, k or q.

Can you castle through check?

No. The king may not cross a square that an enemy piece attacks, so with the king on e1 an attack on f1 stops kingside castling and an attack on d1 stops queenside castling. An attack on b1 does not stop it.

Can you castle when the rook is under attack?

Yes. The attack on the rook does not matter. The rules only look at the squares the king starts on, crosses and lands on.

How do you write castling in chess notation?

Kingside is O-O and queenside is O-O-O, using the capital letter O. If the castling move gives check, a plus sign is added, for example O-O+.

Is castling the king's move or the rook's move?

It counts as one move of the king. On the board you move the king first, two squares, and then the rook. In this checker, click the king and the castling square and the rook is moved for you.

Open-source components used by this tool: chess.js (BSD-2-Clause); ChessPieces font (Noto Sans Symbols 2 subset) (SIL OFL 1.1).

Updated