What is castling in chess?

Castling in chess is usually used to protect the king and/or begin the development of the rook. There are some restrictions. First, there can't be any pieces between the king and the rook. Second, you can't castle if you have already moved the king or the rook you want to castle with. Third, if the square beside the king and between the king and the rook is under attack, you cannot castle. (You'd be moving the king "across" an attacked square, which is not allowed.) Lastly, you cannot castle if your king is in check. (You cannot castle to get out of check.) To castle, first move the king two squares towards the rook on the side you wish to castle on. Then pick up the rook and put it on the square that king "passed over" when it was moved to castle.