A player is caught offside if he’s nearer to the opponent's goal than both the ball and the second-last opponent (including the goalkeeper) when his team-mate plays the ball to him. In other words, a player can’t receive the ball from a team-mate unless there are at least two players either level with him or between him and the goal or unless his team-mate plays the ball backwards to him. It’s not an offense in itself to be offside. A player is only penalized for being offside if he is deemed to be involved in active play. So a player can only be called offside if he is:
• In the opposition’s half. • Interfering with play (that is, he’s part of the attacking move). • Interfering with an opponent (that is, he’s preventing the opponent from defending against the attacking move). • Gaining any advantage by being in that position.
A player can’t be offside from a goal kick, throw in, or corner.