In chess, a pin is a situation brought on by an attacking piece in which a defending piece cannot move without exposing a more valuable defending piece on its other side to capture by the attacking piece. Moving the attacking piece to bring on the pin is called pinning; the defending piece so restricted is described as pinned. Only pieces that can move an indefinite number of squares in a horizontal, vertical, or diagonal line can pin. Kings, knights, and pawns cannot pin. Any piece can be pinned except the king, since the king must be immediately removed from check under all circumstances.
Types
Absolute pin
An absolute pin is one where the piece shielded by the pinned piece is the king. In this case it is illegal to move the pinned piece out of the line of attack, as that would place one's king in check. A piece pinned in this way can still give check or defend another piece from capture by the king.
A relative pin is one where the piece shielded by the pinned piece is a piece other than the king, but typically is more valuable than the pinned piece. Moving such a pinned piece is legal but may not be prudent, as the shielded piece would then be vulnerable to capture.
Partial pin
If a rook or queen is pinned along a or, or a bishop or queen is pinned along a, the pin is a partial pin: the pinned piece can still move along its line but cannot leave that line. A partially pinned piece can break its own pin by capturing the pinning piece; however, this can still be advantageous to the pinning player, as in the example diagram. Note that a queen can only ever be partially pinned, as it can move in any linear direction. It is possible for two opposing pieces to be partially pinning each other. It is also possible for one piece to be pinned in one direction and partially pinned in another, or otherwise pinned in two or more directions.
Sometimes a piece may be considered to be in a situational pin. A situational pin is not an absolute pin and the pinned piece can still legally be moved; however, moving the pinned piece out of the line of attack can result in some detriment to the player. Consider the diagrammed position, it is White's turn to move. The black bishop on d5 is unprotected and White can capture it with 1.Nxd5; however, White should not play the capture or otherwise move the knight, due to 1...Rb1+ winning White's rook. It can be said that the white knight is "pinned to the b1-square" rather than pinned to a piece.
Pin combinations
Pinning can also be used in combination with other tactics. For example, a piece can be pinned to prevent it from moving to attack, or a defending piece can be pinned as part of tacticundermining an opponent's defense. A pinned piece can usually no longer be counted on as a defender of another friendly piece or as an attacker of an opposing piece. However, a pinned piece can still check the opposing king - and therefore still can defend friendly pieces against captures made by the enemy king.
Unpinning
The act of breaking a pin is unpinning. This can be executed in a number of ways: the piece creating the pin can be captured; another unit can be moved onto the line of the pin; or the unit to which a piece is pinned can be moved. Although a pin is not a tactic in itself, it can be useful in tactical situations. One tactic which takes advantage of a pin can be called working the pin. In this tactic, other pieces from the pinning piece's side attack the opposing pinned piece. Since the pinned piece cannot move out of the line of attack, the pinned piece's player may move other pieces to defend the pinned piece, but the pinning player may yet attack with even more pieces, etc.
A pin that often occurs in openings is the move Bb5 which, if Black has moved...Nc6 and...d6 or...d5, pins the knight on c6, because moving the knight would expose the king on e8 to check. A common way to win the queen is to pin her to the king with a rook: for instance with the black queen on e5 and the black king on e8 and no other pieces on the e-file, the move Re1 by White would pin Black's queen.
Examples from games
The diagram shows Vladimir Lenin–Maxim Gorky, Capri 1908, with White to move. Black is threatening the following rook sacrifice and : White cannot play 27.gxh3, because the queen on g3 is pinning the pawn to the g-file. The only move that postpones the mate is 27.Nf4, which temporarily blocks Black's bishop from protecting his queen, but to no avail as Black can simply play 27...Bxf4 renewing the mate threat. Or, Black can respond by mating a different way: In this case, White cannot capture 29.gxf3 because the queen now on h2 pins the pawn to the 2nd rank. With mate being inevitable, White resigned after move 26.