# How to Castle in Chess: Rules and Examples

Canonical: https://chesswitch.com/blog/how-to-castle-in-chess
Publisher: [Chesswitch](https://chesswitch.com/about)
Published: 2026-11-07
Updated: 2026-11-09

## Quick answer

Castling moves the king two squares toward a rook and places the rook on the square beside it. It is legal only if neither piece has moved, the intervening squares are empty, and the king is not in check, does not cross an attacked square, and does not land on one. The rook’s starting square may be attacked.

Castling is the only chess move that moves two pieces at once. It usually shelters the king and brings a rook toward the center, but it is not automatically legal or wise. Check the king’s history, the rook’s history, the squares between them, and every square the king crosses. Then castling becomes a practical decision rather than a rule to recall under pressure.

## Board example

Practice position

Complete practice position: White king e1 and rook h1 are unmoved; Black king e8 is shown for orientation. All other squares are empty.

Position: Complete sparse castling position from the browser practice. Castling rights are retained by the exercise, and all unlisted squares are empty.
Side to move: White
Pieces: white king on e1; white rook on h1; black king on e8

## What the move does

Castling uses a king and rook on the same rank. On the kingside, the king moves two squares toward the rook and that rook lands immediately on the other side. White goes e1–g1 with h1–f1; Black e8–g8 with h8–f8. The notation is O-O.

On the queenside, White goes e1–c1 with a1–d1; Black e8–c8 with a8–d8. The notation is O-O-O. The letter O represents the move, not the number zero.

- Kingside: e1 and h1 become g1 and f1 for White; e8 and h8 become g8 and f8 for Black.
- Queenside: e1 and a1 become c1 and d1 for White; e8 and a8 become c8 and d8 for Black.
- The rook may be under attack; the restrictions concern the king’s square and path.

## The conditions for legal castling

The king and the chosen rook must never have moved; returning to the original square does not restore the right. Every square between them must be empty: f1 and g1 (or f8 and g8) on the kingside; b1, c1, and d1 (or b8, c8, and d8) on the queenside.

The king may not castle in check, through an attacked square, or onto an attacked square. Thus e1, f1, and g1 must be safe for White’s O-O, with the equivalent three squares for Black and for the c-file path. The rook’s starting square may be attacked. Its landing square, f1 or d1 for White and f8 or d8 for Black, must be safe because the king crosses it. In queenside castling, b1 or b8 may be attacked as long as the king’s path is safe.


## Try it yourself

Practice position: check the three king squares

Use the displayed position to rehearse the castling checklist.

Practice prompt: Can White legally castle kingside in the displayed practice position? What information must be verified first?

Answer: Check that the king and h1-rook have not moved, that f1 and g1 are empty, and that e1, f1, and g1 are not attacked. The exercise supplies the castling right; the empty squares and king route still matter.

Practice this position: [Open practice](https://play.chesswitch.com/?lang=en&practice=castling)

## Common illegal-castling mistakes

A piece between the king and rook prevents castling. A king in check cannot escape by castling, and an enemy bishop attacking f1 prevents White’s O-O even if g1 is safe. Do not confuse an attacked rook with an attacked king path: the rook may be attacked while castling remains legal.

For this test, an enemy piece can count as attacking a square even when moving it would expose its own king; a pinned piece can still make a king path unsafe. Scan enemy lines and knight attacks on the king’s starting, crossing, and landing squares.


## When castling helps your position

Castling often helps after development because it shelters the king and activates the rook, potentially helping connect the rooks later. It is not a race: waiting can be correct if castling opens a file toward your king or abandons a defender, while delaying as the center opens can be dangerous. Check the opponent’s piece lines and your pawn cover before choosing a side.

Before moving, confirm the right exists, the path is empty, and the three king squares are safe. Once the king or chosen rook has moved, that castling right is permanently lost.


## Questions and answers

### Can you castle out of check?

No. The king cannot castle while in check, through an attacked square, or onto one. An attacked rook does not by itself prevent castling if neither piece has moved, the path is empty, and the king’s path is safe.

### What are kingside and queenside castling?

Kingside is O-O: White’s king goes e1–g1 and rook h1–f1, with equivalent e8–g8 and h8–f8 for Black. Queenside is O-O-O: White goes e1–c1 and a1–d1, with Black’s equivalent.

Further reading: [FIDE Laws of Chess](https://handbook.fide.com/chapter/e012023)

## Keep learning

- [How to Play Chess: A Beginner’s Guide](https://chesswitch.com/blog/how-to-play-chess)
- [Check, Checkmate, and Stalemate Explained](https://chesswitch.com/blog/check-checkmate-stalemate)

About the game: [What is Chesswitch?](https://chesswitch.com/about)
Editorial policy: https://chesswitch.com/editorial
Play chess: https://play.chesswitch.com/?lang=en&practice=castling
