ChessNextMove.ai
CalculatorAnalysisPuzzlesLeaderboardPricing
Try Pro
  1. Home
  2. /
  3. Learn chess
  4. /
  5. Castling
♜

Castling in Chess

How to castle, every rule, and when to do it

What is castling?

Castling is a special move in which the king and one rook move at the same time. The king steps two squares toward the rook, and the rook jumps over the king to the square right beside it. It is the only move that shifts two of your pieces at once, and the only time a king may travel two squares.

You can castle once per game, and it does two jobs in one move. It takes the king out of the centre, where the central files open early, and tucks it behind a wall of pawns. It also brings a rook from the corner toward the middle, where it can reach open files.

Kingside and queenside castling

You can castle toward either rook. The half of the board where the kings start, the e- to h-files, is the kingside. The queens' half, the a- to d-files, is the queenside.

Kingside: O-O

Also called short castling. Only f1 and g1 need to be empty.

8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h
1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.O-O. King e1 to g1, rook h1 to f1. moved from moved to

Queenside: O-O-O

Also called long castling. b1, c1 and d1 must all be empty.

8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h
1.e4 d6 2.d4 Nf6 3.Nc3 g6 4.Be3 Bg7 5.Qd2 O-O 6.O-O-O. King e1 to c1, rook a1 to d1. moved from moved to
CastleKingRookMust be empty
White O-Oe1 → g1h1 → f1f1, g1
White O-O-Oe1 → c1a1 → d1b1, c1, d1
Black O-Oe8 → g8h8 → f8f8, g8
Black O-O-Oe8 → c8a8 → d8b8, c8, d8

How to castle, step by step

  1. Check that castling is allowed. Your king and the rook have never moved, every square between them is empty, your king is not in check, and the squares the king crosses and lands on are not attacked.
  2. Touch and move the king first. Pick up the king and move it two squares toward the rook: e1 to g1 for kingside castling, e1 to c1 for queenside (e8 to g8 or c8 for Black).
  3. Jump the rook over the king. With the same hand, place the rook on the square the king just crossed: h1 to f1 kingside, a1 to d1 queenside (h8 to f8 or a8 to d8 for Black).
  4. Press the clock. King and rook together count as one move. In a timed game, press the clock only after both pieces are in place.

Over the board, the order matters. FIDE's Laws of Chess say castling is a king move, made with one hand. If you deliberately touch the rook first, you may not castle on that side on that move. Online, you simply drag the king two squares and the rook follows by itself.

The castling rules

You may castle only if every one of these is true:

  1. Your king has never moved. Not once, not even a step away and back.
  2. The rook you castle with has never moved. Moving the h-rook only costs you kingside castling. You can still castle queenside.
  3. Every square between the king and that rook is empty. Your own pieces block castling just as much as enemy pieces do.
  4. Your king is not in check. You cannot castle to escape a check.
  5. The king does not pass through an attacked square. That is f1 for O-O and d1 for O-O-O (f8 and d8 for Black).
  6. The king does not land on an attacked square. That would be moving into check, which is never legal.
8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h
Illegal: the bishop on c4 attacks f1, so the king cannot pass through it. No O-O. attacked
8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h
Legal: the bishop attacks b1, but only the rook crosses b1. The king's squares are safe. O-O-O is fine. attacked safe

What does not stop you castling

  • Your rook is attacked.
  • On the queenside, the rook crosses an attacked b1 or b8 square.
  • Your king was in check earlier in the game but never moved.
  • Castling gives check, or even checkmate.

How players lose the right to castle

The right to castle is spent the moment the king moves. After 1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.Ke2 Nf6 5.Ke1 d6, White's king is back on e1, both rooks are still at home and f1 and g1 are empty, yet White can never castle. The FEN string, the one-line record engines use for a position, shows it in its third field:

r1bqk2r/ppp2ppp/2np1n2/2b1p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w kq - 0 6

kq means only Black can still castle. At the start it reads KQkq: capitals for White, K for kingside, Q for queenside. When you copy a position from one of your games into the chess calculator, check that field first: Stockfish plays by the castling rights the FEN gives it.

Being checked is different. After 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nf6 4.d3 Bb4+, White blocks with 5.c3, and after 5...Ba5 plays 6.O-O. The check did not cost anything, because the king never moved.

How castling is written

  • O-O is kingside castling and O-O-O is queenside castling. A handy memory aid: the number of O's matches how far the rook moves, two squares on the kingside (h1 to f1) and three on the queenside (a1 to d1).
  • PGN files and most software use the capital letter O. FIDE's Laws of Chess print zeros: 0-0 and 0-0-0. Both mean the same thing.
  • Add + for check or # for checkmate, as in O-O-O#.
  • Engines speaking the UCI protocol write castling as a king move: e1g1 or e1c1.

The full system is in the chess notation guide.

Can castling give checkmate? Yes

Castling with check is common, because the rook lands on an open file. Castling with mate is rare, and the best-known case is a famous king hunt: Edward Lasker vs George Thomas, London 1912. 1.d4 e6 2.Nf3 f5 3.Nc3 Nf6 4.Bg5 Be7 5.Bxf6 Bxf6 6.e4 fxe4 7.Nxe4 b6 8.Ne5 O-O 9.Bd3 Bb7 10.Qh5 Qe7 11.Qxh7+ Kxh7 12.Nxf6+ Kh6 13.Neg4+ Kg5 14.h4+ Kf4 15.g3+ Kf3 16.Be2+ Kg2 17.Rh2+ Kg1. Black's king has been chased from g8 all the way to g1.

8
7
6
5
4
3
2
1a
b
c
d
e
f
g
h
Lasker vs Thomas, 1912, after 17...Kg1. Both 18.Kd2# and 18.O-O-O# are checkmate. key square

Lasker finished with 18.Kd2#, which uncovers the rook on a1 along the first rank. 18.O-O-O# mates too, with the rook landing on d1. White can still castle queenside here because the king and the a1 rook have never moved.

Castling in Chess960

In Chess960 (Fischer Random), the back-rank pieces start in a shuffled order, always with the king somewhere between the two rooks. Castling still exists, and the king and rook finish on the same squares as in normal chess: king g1 and rook f1 after O-O, king c1 and rook d1 after O-O-O. Every square the king or the rook crosses or lands on must be empty, apart from those two pieces themselves, and the king still may not be in check, pass through check or land in check. Depending on the start, only one of the two pieces may actually move.

When should you castle?

Usually early

In most openings, castle within the first ten moves. Develop the knight and bishop on that side, then castle before the centre opens. A king left on e1 when the e- and d-files open is one of the most common ways to lose quickly.

Consider waiting when

  • The centre is locked by pawns and your king is not in danger on e1.
  • Your opponent is already aiming pieces or pawns at the side you would castle on.
  • Keeping the choice open hides your plans. Castling commits your king to one wing.

Avoid castling into

  • An attack that is already under way, such as a queen and bishop aimed at h7 or h2.
  • A broken pawn shelter, for example after your g-pawn has been exchanged.
  • Open files your opponent's rooks can use against your king.

When both players castle on the same side, the game tends to be quieter and positional. When they castle on opposite sides, as in the queenside example above, both can push the pawns in front of the enemy king without weakening their own, and the game turns into a race. After queenside castling, many players follow up with Kb1 to cover the a2-pawn and step off the c1-h6 diagonal. In the endgame, castling matters far less: the king becomes a fighting piece and belongs in the centre.

Common castling myths

"You can't castle if you've ever been in check."

You can, as long as the king never moved.

"You can't castle while your rook is attacked."

You can. Only the king's squares must be safe.

"Queenside castling needs b1 to be safe."

It doesn't. The rook crosses b1, the king never does.

"Castling counts as two moves."

It is one move, made by the king, with the rook coming along.

"If the king goes back to e1, you can castle again."

No. Any king move ends castling for good.

Frequently asked questions

Can you castle out of check?

No. If your king is in check you must deal with the check first by moving the king, blocking or capturing. If you move the king to escape, you lose the right to castle for the rest of the game.

Can you castle through check?

No. The king may not pass over a square attacked by an enemy piece. For kingside castling that square is f1 (f8 for Black). For queenside castling it is d1 (d8 for Black).

Can you castle if your rook is attacked?

Yes. The rules only protect the king. The rook may be under attack, and on the queenside it may also cross an attacked b1 or b8 square.

Can you castle if you were in check earlier in the game?

Yes, as long as your king never moved. If you answered the check by blocking or capturing, your castling rights are untouched.

Can you castle after your king has moved and come back?

No. Once the king has moved, even one square and back, you can never castle again in that game. Moving a rook only loses castling on that rook's side.

How many times can you castle?

Once per game. After castling, the king has moved, so the right is used up on both sides.

Is kingside or queenside castling better?

Kingside castling is more common because only the knight and bishop have to move first, and the king ends closer to the corner. Queenside castling takes longer but puts the rook straight onto the d-file, and it often leads to sharp games where both sides attack.

How is castling written in chess notation?

Kingside castling is O-O and queenside castling is O-O-O. PGN files use the capital letter O, while FIDE's own Laws of Chess print the zeros 0-0 and 0-0-0. Add + or # if castling gives check or checkmate.

Related lessons

  • The en passant ruleThe pawn capture that exists for one move only, with examples from real games.
  • How chess pieces moveHow the king, queen, rook, bishop, knight and pawn move and capture, and what each is worth.
  • Chess notation guideAlgebraic notation, PGN files and FEN strings, from e4 to O-O-O#.
  • Checkmate patterns every player should knowFool's mate, Scholar's mate, back rank, smothered, Anastasia's and Arabian mates.
  • How to set up a chess boardLight square on the right, queen on her colour, and where all 32 pieces start.

Or browse all free chess lessons.

Practise castling in real games.

Play against the computer →Check a position with the best move calculatorOpening guides

Ready to Practice?

Solve Puzzles Play vs AI Move Calculator

Want more? Try Pro — Go Pro for 3650 ELO analysis, Position Reader & unlimited AI coaching

Learn chessHow to set up a chess boardCastlingEn passantStalemateChess notation
Chess openingsItalian GameSicilian DefenseCaro-Kann DefenseQueen's GambitFried Liver Attack
CalculatorAnalysis BoardPlay vs ComputerOpeningsSolverStockfish OnlinePuzzles2 PlayersELO TestELO CalculatorCheckmate CheckerPricingBlogAboutContactFeedbackPrivacy PolicyTerms of ServiceRefund PolicyCookie PolicyDisclaimer

© 2025 - 2026 ChessNextMove.