Castling is the only move in chess where two of your pieces move at once: the king slides two squares toward a rook, and that rook hops over to the square beside it. It exists so you can get your king out of the dangerous center quickly, without spending three or four separate moves doing it.
The conditions: neither the king nor that rook can have moved earlier in the game, the squares between them must be empty, and the king can't castle out of, through, or into check. Kingside castling (toward the h-file) is the short, common version; queenside is longer and leaves the king slightly more exposed.
8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
Both sides have cleared the squares between king and kingside rook. White can castle right now.
Castle the king to safety.
8
7
6
5
4
3
2
a1
b
c
d
e
f
g
h
