Castling in Chess: How It Works and When You Can Castle
Learn how to castle in chess: the kingside and queenside moves, the five conditions that make castling legal, common mistakes and when to castle.
Castling is the only move in chess where you move two pieces at once: your king and one of your rooks. It does two useful jobs in a single turn. It tucks your king away from the center, where most of the fighting happens, and it brings a rook toward the middle of the board where it can join the game.
Every chess player castles in almost every game, so it is worth learning the rule properly. This guide explains exactly how castling works, when it is allowed, and when it is not.
How do you castle in chess?
To castle, you move your king two squares toward one of your rooks, and then place that rook on the square the king just crossed. Both pieces move on the same turn, and it counts as one move.
There are two ways to castle:
- Kingside castling (short castling): the king goes from e1 to g1 and the rook from h1 to f1. For Black, the king goes from e8 to g8 and the rook from h8 to f8.
- Queenside castling (long castling): the king goes from e1 to c1 and the rook from a1 to d1. For Black, the king goes from e8 to c8 and the rook from a8 to d8.
Click "Show me" to see kingside castling:
And here is queenside castling. The king still moves only two squares, but the rook travels three:
The rules: when can you castle?
Castling is legal only when all of the following are true:
- Neither the king nor that rook has moved yet in the game. If your king has moved even once (and come back), you can never castle again. If only one rook has moved, you can still castle on the other side.
- All squares between the king and the rook are empty. For kingside castling that means f1 and g1; for queenside castling, b1, c1 and d1.
- Your king is not in check. You cannot castle to escape a check.
- The king does not pass through a square that is attacked by an enemy piece. For kingside castling, f1 must be safe; for queenside castling, d1 must be safe.
- The king does not end up in check. Like any other move, castling cannot put your own king in check.
These conditions come from Article 3.8 of the FIDE Laws of Chess, and the US Chess rulebook uses the same ones. The first condition is permanent: once the king or a rook has moved, that right to castle is gone for good. Conditions 2 to 5 only block castling for the moment. As soon as the square is empty again or the check is gone, you may castle.
Notice that the rules are all about the king. The rook is allowed to be attacked, and it may pass over an attacked square. In queenside castling the rook crosses b1, and it does not matter if an enemy piece controls b1.
Try it yourself
It is White's turn. Castle kingside: pick up the king and move it two squares to the right.
When is castling not allowed?
Beginners most often forget conditions 3 to 5. Here is an example. The black bishop on c4 attacks f1, so White cannot castle kingside: the king would have to pass through an attacked square.
Compare it with the next position. The black rook on b8 attacks b1, but queenside castling is still legal, because only the rook crosses b1. The king's path (d1 and c1) is safe.
Other situations where you cannot castle:
- You are in check right now. Deal with the check first; if your king and rook still have not moved, you can castle on a later turn.
- A piece of either color stands between the king and the rook.
- The rook you want to castle with has been captured, or it has moved and come back.
Try it: only one side is legal
White still has both castling rights here, but the bishop on c4 covers f1. Castling kingside (O-O) would take the king through an attacked square, so it is illegal. The king's queenside path, d1 and c1, is safe. Castle the legal way:
Castling after a check
A check does not take away the right to castle. Here the bishop on b4 checks the white king. White cannot castle out of check, so the knight blocks on c3 instead. On the next move the check is gone, the king and rook have never moved, and White castles normally.
Had White escaped the check with a king move such as Kf1, castling would be gone for the rest of the game, because the king would have moved.
How to castle on a real board (and online)
In over-the-board games, touch the king first and move it two squares, then move the rook with the same hand. Under FIDE rules, castling is a king move. If you touch the rook first, it is treated as a rook move and you may lose the right to castle on that turn because of the touch-move rule.
Online, you simply drag the king two squares (or onto the rook on some sites), and the rook moves by itself. On Chessyo you can drag or click the king and then its destination square.
How castling is written in notation
In chess notation, kingside castling is written O-O and queenside castling O-O-O. Some books and sites use zeros (0-0 and 0-0-0); the meaning is the same.
When should you castle?
There is no fixed move number, but strong players usually castle in the first ten moves. A good rule of thumb from the opening principles is:
- Develop your knights and bishops first, so the squares between your king and rook are empty.
- Castle before you start an attack, especially if the center is opening up.
- Kingside castling is quicker (only two pieces need to move out of the way) and usually safer for beginners.
- Queenside castling activates the rook faster but leaves the a-pawn unprotected, so the king often steps to b1 later.
Leaving your king in the center too long is one of the most common reasons beginners lose. The center files open quickly, and an uncastled king becomes a target for checks and tactics.
Frequently asked questions
Can you castle out of check?
No. If your king is in check, you must get out of check first by moving the king, blocking or capturing the checking piece. Castling is not one of the options. If the king and rook still have not moved afterwards, you may castle on a later move.
This is the same under FIDE and US Chess rules. The king's starting square must not be attacked when you castle.
Can you castle after being in check?
Yes. Being checked earlier in the game does not cost you the right to castle. Once the check is over, you may castle on any later move, as long as the king and that rook have never moved and the other conditions are met.
The FIDE Laws (Article 3.8.2) separate the two cases: moving the king or the rook removes the right to castle permanently, while a check, an attacked square or a piece in the way only prevents castling for now. US Chess rules work the same way. The catch is how you escape: if you get out of check by moving the king, the king has moved, and castling is gone for the rest of the game. Block or capture instead if you want to keep it.
Can you castle through check?
No. The king may not cross a square that an enemy piece attacks: f1 (or f8 for Black) when castling kingside, and d1 (or d8) when castling queenside.
This rule is about the king only. The rook may cross an attacked square, so queenside castling is still legal when only b1 (or b8) is attacked. The interactive board above, where a bishop on c4 rules out O-O but not O-O-O, shows the difference.
Can you castle into check?
No. Castling may not put your own king in check, so the square the king lands on must not be attacked: g1 or c1 for White, g8 or c8 for Black. This is the same rule that applies to every king move. If an enemy piece covers that square, castle on the other side or wait until the square is safe.
Can you castle if the rook is attacked?
Yes. The rules only protect the king. The rook may be attacked, and in queenside castling it may cross an attacked square. Only the king's starting square, the square it crosses and the square it lands on must be safe.
Can you castle after moving your king or rook?
Not with a piece that has moved. Once the king has moved, castling is no longer allowed for the rest of the game, even if the king returns to e1 (or e8). If only one rook has moved, you lose the right to castle on that side but can still castle with the other rook.
Moving a rook away and back does not restore the right. Castling is also gone on a side whose rook has been captured.
Can you castle twice in one game?
No. Each player can castle at most once per game, because castling moves the king and after that the king has moved.
Is castling with the king or with the rook first?
Move the king first. FIDE rules treat castling as a king move, so you lift the king, place it two squares over, and then move the rook. Touching the rook first can cost you the right to castle on that move.
Does castling count as one move?
Yes. Even though two pieces move, castling counts as a single move for both the move count and the clock.
Keep learning
Related guides
- En Passant: The Chess Rule Explained With Examples — What is en passant in chess? Learn how this special pawn capture works, the exact conditions, why the rule exists and how to write it in notation.
- Pawn Promotion: What Happens When a Pawn Reaches the End — What happens when a pawn reaches the other side of the board? Learn the pawn promotion rule, which pieces you can choose, and when to underpromote.
- The Rules of Chess: Complete List of Official Rules (FIDE and US Chess) — The official rules of chess in one complete list: setup, piece moves, castling, en passant, check, draws, touch-move, clocks and FIDE vs US Chess rules.
- How Do Chess Pieces Move? A Guide to Every Piece — How each chess piece moves and captures: king, queen, rook, bishop, knight and pawn, with interactive boards, piece values and tips for beginners.
- Check, Checkmate and Stalemate: What's the Difference? — Learn the difference between check, checkmate and stalemate in chess, the three ways to get out of check, and how to avoid stalemating your opponent.