To castle, move your king two squares toward one of your rooks, then jump that rook to the square the king just crossed. It is the only move in chess that moves two of your pieces at once, and it is legal only when the king and that rook have never moved, the squares between them are empty, and the king is not in check, does not pass through an attacked square, and does not land on one.

Everything else you have heard is probably a myth. You can castle when your rook is attacked. You can castle queenside when b1 or b8 is attacked. You can castle after your king has been checked earlier in the game, as long as the king itself never moved. This guide covers the mechanics of both castles, every condition that actually forbids the move, the misconceptions that cost beginners real games, and how to decide between short and long.

The mechanics: kingside castling (O-O)

Kingside castling is also called short castling, because there are only two squares between the king and the h-file rook. In chess notation it is written O-O — that is the letter O, twice, joined by a hyphen.

Here is a standard Italian Game position. White has moved the knight and bishop off the back rank, so f1 and g1 are clear and every castling condition is satisfied.

1. e4 e5
2. Nf3 Nc6
3. Bc4 Bc5
White is ready to castle short: f1 and g1 are empty, the king has never moved, and nothing attacks e1, f1 or g1. Play this position →

Now play 4.O-O. The king travels e1 to g1, and the rook hops over it from h1 to f1.

After 4.O-O. The king sits behind an untouched f2-g2-h2 pawn shield, and the rook has gone from the corner to a half-open file in a single move. Play this position →

Notice what the one move accomplished. The king went from the middle of the board — where every open file and diagonal eventually points — to a corner shelter. And the h1 rook, the piece that would otherwise be the last to enter the game, arrived on f1 where it already eyes the f-file. That double payoff is why "castle early" is one of the few opening rules that almost never lets you down.

The mechanics: queenside castling (O-O-O)

Queenside castling, or long castling, is written O-O-O. The king again moves exactly two squares — e1 to c1 — while the rook travels three, from a1 to d1. The b1 square must be empty, but the king never touches it.

The classic illustration is the Yugoslav Attack against the Sicilian Dragon, where White deliberately clears the queenside in order to castle away from the coming pawn storm.

1. e4 c5     2. Nf3 d6    3. d4 cxd4
4. Nxd4 Nf6  5. Nc3 g6    6. Be3 Bg7
7. f3 O-O    8. Qd2 Nc6
Black castled short on move seven. White has emptied b1, c1 and d1 — knight to c3, bishop to e3, queen to d2 — and is ready to go the other way. Play this position →

Play 9.O-O-O and the two kings end up on opposite wings.

After 9.O-O-O. The rook lands on d1 — a central file — immediately, and White's h-pawn is now free to charge at Black's king. Play this position →

The queenside castle takes longer to prepare, because you have three pieces to move out of the way instead of two: the knight, the bishop, and the queen. In exchange, the rook arrives on d1, one of the two most valuable files on the board, rather than on f1. If your plan involves a break in the centre, that difference is worth the extra tempo.

Doing it correctly over the board

Under the FIDE Laws, castling counts as a king move. That has two practical consequences in an over-the-board game:

  • Touch the king first. If you touch the rook first, your opponent may insist you move only the rook. Move the king two squares, then bring the rook across.
  • Use one hand. Every move must be made with a single hand, castling included. Grabbing the king with one hand and the rook with the other is an infraction, and in fast time controls arbiters do enforce it. Online, none of this matters — you drag the king onto the rook or onto its destination square and the board does the rest. Our etiquette guide covers the rest of the courtesies.

Every condition that forbids castling

There are exactly six ways castling can be illegal. Two of them are permanent; four are temporary — and knowing which is which is where most of the practical value lies.

Permanent: the king has moved

If your king has left e1 (or e8) even once, castling is gone for the rest of the game on both sides. Moving it back does not restore the right. A single "safe" Kf1 to break a pin costs you the move forever.

Permanent: that rook has moved or has been captured

Castling rights are tracked per rook. If your a1 rook has moved, you have lost queenside castling but kingside castling is still available — a distinction many beginners miss. The same applies if a rook is captured on its starting square. Push the h-pawn and shuffle the h1 rook to g1 to prepare an attack, and short castling disappears while long castling survives.

Temporary: pieces are in the way

Every square between the king and the rook must be empty. For short castling that is f1 and g1. For long castling it is d1, c1 and b1 — three squares, which is why it takes an extra move to prepare. You cannot castle over your own knight, bishop or queen.

Temporary: the king is in check

You cannot castle out of check. This is the single most commonly misapplied rule, so here it is on a board. Black has just played ...Bb4, and White is in check along the b4-c3-d2-e1 diagonal.

White is in check from b4. Both castling paths are completely clear — and both castles are still illegal. Play this position →

Notice that f1, g1, d1, c1 and b1 are all empty and none of them is attacked. It does not matter. The king is in check, so castling is off the table this move. White's legal answers are to capture the bishop with Nxb4, block with Nc3, Bd2 or Qd2, or move the king with Kf1 or Kd1.

That last pair carries a hidden cost. Blocking keeps the castling rights alive; moving the king throws them away permanently. When you are choosing between two roughly equal answers to a check, the one that preserves castling is usually the better practical choice — a habit that quietly prevents a lot of the mistakes covered in avoiding common blunders.

Crucially, this restriction is temporary. Deal with the check by blocking or capturing, leave the king on e1, and you may castle on any later move.

Temporary: the king would pass through an attacked square

The king may not cross a square that an enemy piece controls. For short castling that square is f1; for long castling it is d1. Think of it as the king refusing to walk through live fire — if he could not legally stand there, he cannot legally travel over it.

The bishop on a6 rakes the a6-f1 diagonal. Short castling is illegal because the king would cross f1 — but long castling is completely fine. Play this position →

This is the position to memorise, because it shows both halves of the rule at once. O-O is illegal: f1 is attacked. O-O-O is legal: the king's route runs e1-d1-c1, and the bishop touches none of those squares. Losing one castle does not lose the other.

Temporary: the king would land on an attacked square

The destination — g1 or c1 — must also be safe. This is just the ordinary rule that a king may never move into check, applied to the end of the castling move. Like the previous two conditions, it is temporary: drive the attacking piece away, or block its line, and castling becomes available again.

What does not prevent castling

Now the myths. Each of these is legal, and each of them wins games for players who know it and loses games for players who don't.

An attacked rook is fine

Nothing in the rules protects the rook. If your a1 rook is sitting under the gaze of an enemy rook on an open a-file, you may still castle queenside — the rook simply moves to d1 and, conveniently, is no longer attacked.

An attacked b1 or b8 does not stop long castling

This is the big one. The rule about attacked squares applies only to the three squares the king occupies or crosses: e1, d1 and c1. The b1 square must be empty, but it may be attacked by anything Black owns. The rook is allowed to pass over an attacked square; the king is not.

The bishop on f5 attacks b1 and the rook on a8 attacks a1. Neither matters — O-O-O is perfectly legal here. Play this position →

Look at what Black has aimed at the queenside. The bishop on f5 sweeps down through e4, d3 and c2 to hit b1. The rook on a8 stares down the open a-file at a1. Both of White's queenside pieces are under fire — and White may castle long anyway, because e1, d1 and c1 are all untouched. After O-O-O the rook stands on d1, out of the a-file rook's reach entirely.

Being checked earlier does not matter

Castling rights depend on whether the king has moved, not on whether it has been checked. Survive ten checks on e1 by blocking every one of them, and you may still castle on move thirty.

The rook may be defended or undefended, it makes no difference

There is no requirement that the rook be protected, that it be on the same colour square, or that anything else be true of it. King and rook unmoved, path clear, king's three squares safe — that is the complete list.

You may castle at any point in the game

There is no "castle by move ten or lose the right." If the conditions still hold on move fifty, you may castle on move fifty. You just cannot do it twice — the king has moved.

One genuine exception: Chess960

In the Chess960 variant the pieces start on a shuffled back rank, and castling is defined by the destination squares rather than by "two squares over": the king always ends on g1/g8 (short) or c1/c8 (long), and the rook on f1/f8 or d1/d8. Sometimes the king barely moves at all. The safety conditions are unchanged.

Short or long? Choosing the right side

Both castles solve the same problem — the king in the centre — but they leave you with very different positions.

Short castling is the default, and for good reason. The king ends on g1 tucked behind an untouched f2-g2-h2 wall, only one square from the corner, with no loose pawn nearby. It takes two developing moves to prepare instead of three. In the overwhelming majority of games, if you have no concrete reason to do otherwise, castle short and get on with the game.

Long castling buys activity and pays for it in safety. Three things change:

  • The rook is instantly better. It lands on d1, a central file, without needing a follow-up move. In openings where you intend a central break, that free tempo is real.
  • The king is slightly loose. On c1 it stands on the c-file, which is half-open in a huge number of Sicilian and Queen's Gambit structures, and on the a7-g1 diagonal. The a2 pawn is also left undefended by the king.
  • You will usually want Kb1. Tucking the king to b1 costs a tempo but removes it from the c-file, steps off the exposed diagonal, and gets it off the d-file where your own rook wants to be. Strong players play this almost automatically after castling long.

Castle long when you have a specific reason:

  1. You want to attack on the kingside with pawns. You cannot throw your g- and h-pawns forward while your own king hides behind them. Move the king to the other wing and the pawns are free — this is the whole idea behind the Yugoslav Attack and many pawn-storm attacks.
  2. Your kingside is already compromised. If you have played an early g4 or h4, or traded off the f- or g-pawn, g1 is no longer a shelter.
  3. The d-file is where the game will be decided. Openings like the classical Caro-Kann and many Queen's Gambit lines put a heavy premium on getting a rook to d1 fast. See open files and rooks for why that matters so much.

Opposite-side castling changes the whole game

When you castle long and your opponent castles short, the game turns into a race. Neither side has to worry about loosening its own king's cover, so both sides throw pawns at the enemy king, and the player whose attack lands first usually wins outright. In these positions tempo outweighs material: giving up a pawn to open a file one move sooner is often correct. If you dislike that kind of chess, be aware that choosing the opposite wing is what starts it.

When not to castle at all

Castling early is excellent general advice, but it is not a law. Delay when the centre is locked and your king is genuinely safe in the middle; when your opponent has already committed to an attack on one wing and you can simply castle the other way later; or in an endgame, where the king is a fighting piece and belongs near the action.

One last habit worth building: after castling short, watch your back rank. A king on g1 with pawns on f2, g2 and h2 is safe from everything except a rook or queen arriving on the first rank. Giving the king an escape square at the right moment prevents the back-rank mate, which is the single most common way a well-castled king still gets checkmated.

Practise it on the board

Reading the rules is not the same as feeling them. Every diagram above has a Play this position link that drops you straight into the position against our engine — so open the Italian Game diagram and castle short, then open the Dragon position and castle long, then try to castle in the check diagram and watch the board refuse.

Then start a fresh game on the free board at LocalChess: develop a knight and a bishop, castle by move seven, and see how much easier the middlegame becomes when your king is already home and both rooks are talking to each other. If you are still shaky on where the pieces belong before any of that, start with the board setup guide, and once castling feels automatic, learn the other move that trips everyone up — en passant.