How do you castle on the king side?
Castling is the only move in the whole game where you move two of your own pieces on one turn. It is also the only time a king ever moves more than one square.
King side castling is the short one, because the king is close to that rook.
1. Move the knight and the bishop off f1 and g1, so the squares between the king and the rook are empty.
2. Move your king two squares towards the rook, from e1 to g1.
3. Lift the rook from h1 and put it on f1, on the far side of the king.
Both pieces move on the same turn, and it counts as one move. Always move the king first when you play with a real set. If you touch the rook first, an arbiter can rule that you must move the rook alone.
Black castles the same way, from e8 to g8 with the rook from h8 to f8.
How do you castle on the queen side?
Queen side castling is the long one. The rook travels further, so three squares have to be empty, not two.
1. Move the knight, the bishop and the queen off b1, c1 and d1.
2. Move your king two squares towards the rook, from e1 to c1.
3. Lift the rook from a1 and put it on d1.
The king always moves exactly two squares, whichever side you castle. The rook is the piece that travels a different distance.
The square b1 does not have to be safe, only empty. That surprises most players, and the next section explains it.
When is castling not allowed?
There are six cases. The first two last forever; the other four only stop you for the moment.
1. Your king has already moved. Even if it comes back home, castling is gone for the rest of the game.
2. That rook has already moved. You can still castle with the other rook if it has stayed at home.
3. A piece stands between the king and the rook. Yours or your opponent's, it makes no difference.
4. Your king is in check. You must answer the check another way first.
5. The king would cross an attacked square. For king side castling that is f1; for queen side castling that is d1.
6. The king would land on an attacked square. That is g1 or c1. This is only the normal rule that a king may never move into check.
Cases four, five and six can disappear on a later move. If the enemy piece stops attacking those squares, you may castle then.
Can you castle when the rook is attacked?
Yes, and most players do not know this. Learning it will win you games that you would otherwise think were lost.
The rule only protects the king. The rook is allowed to be attacked, and the rook is allowed to cross an attacked square. FIDE's Laws of Chess say it plainly. The king may not pass through or land on a square an enemy piece attacks. The rook has no such condition.
So when you castle queen side, an enemy piece attacking b1 does not stop you. The rook simply passes over it. The same is true for Black on b8.
How do you write castling?
King side castling is written O-O, with two capital letter O's and a hyphen. Queen side castling is written O-O-O, with three.
Count the O's like the squares the rook travels: two for the short castle, three for the long one.
Older books print 0-0 and 0-0-0 with zeros. They mean exactly the same thing.
A mistake we see learners make
The common mistake is waiting. Learners bring out a knight, then another knight, then a bishop, and leave the king in the middle. Then a file opens, and it is too late.
Our coaches give learners one simple rule. Castle inside the first ten moves unless you have a very good reason not to. A king left in the middle is the reason most short games end early.
The second mistake is castling into an attack without looking. Before you castle, check the squares around your new home. Count the enemy pieces that can reach them. If your opponent has three attackers there and you have one defender, castle on the other side or wait one move.