Offside is one of the laws in association football, codified in Law 11 of the Laws of the Game. The law states that a player is in an offside position if any of their body parts are in the opponents' half of the pitch, and closer to the opponent's goal line than both the ball and the second-last opponent (the last opponent is usually, but not necessarily, the goalkeeper).[1][2]
Being in an offside position is not an offence in itself, but a player so positioned when the ball is played by a teammate can be judged guilty of an offside offence if they receive the ball or will otherwise become "involved in active play", will "interfere with an opponent", or will "gain an advantage" by being in that position. Offside is often considered one of the most difficult-to-understand aspects of the sport.[3]