All the spaces between the rook and the king need to be free spaces. To castle with the rook to the right of your king, the bishop and the knight on that side need to have moved elsewhere. To castle with the rook to the left of your king, the bishop, knight, and queen must have moved elsewhere. Likewise, these spaces cannot be occupied by your opponent’s pieces, meaning you can’t castle to capture a piece. The king and the rook must not have moved. If your king or your rook has moved before, whether or not it’s at the same spot, it cannot castle. The king must not currently be in check, move through any squares under attack by enemy pieces, and must not end up in check after castling. If you have been checked previously in the game but has not moved or is not currently in check, you are allowed to castle. If the rook is threatened, you’re still permitted to castle.

To castle kingside, move your king two spaces right, toward the rook on that side, replacing the original position of the knight, which must be elsewhere. To castle queenside, move your king two spaces left, toward the rook on that side, replacing the original position of the bishop on that side, which must be elsewhere. Castling is a king move. If you’re playing with touch move you’ll have to touch the king first or you’ll have to make a rook move. Likewise, in online chess you must click on the king, not the rook to castle (if you move the rook the program will assume you meant to just move the rook over).

On a kingside castle, the rook will replace the position of the bishop on that side. On a queenside castle, the rook will replace the position of the queen.

Castling was introduced at some time in the 1500s to increase the speed of play and open up new defensive avenues for players, balancing offensive and defensive strategy into a more fluid style of play.

This is only a recommendation, and might and will not be for every circumstance. Some find that this helps, some don’t. Do not make this something a “have to,” and base the choice on your situation. '

Some players castle early, sometimes within the first five moves, as a way of mounting their offense. If you prefer to orient the pieces having castled, go for it. In general though, you’re removing the possibility of a later castle that will throw your opponent off. It’s generally used more as a defensive maneuver, rather than an offensive strategy.

Alternatively, consider leaving your king in place if the action is mostly to the side. An unusual occurrence, perhaps, but it can happen. Play cautiously and read the board always before deciding to castle.

Never castle into an attack. Usually your best bet is to castle on the opposite side, taking special care to defend against the pawns as they swarm in. So, if your opponent has overloaded your kingside, castle to the queen. [9] X Research source

Castling kingside is usually a defensive strategy, whereas castling queenside allows for greater offense, with an active queen rook.