Rugby’s offside Law restricts where on the field players can be, to ensure there is space to attack and defend.
As illustrated in this section of the World Rugby Laws site, in general, a player is in an offside position if that player is further forward (nearer to the opponents’ goal-line) than the team-mate who is carrying the ball or the team-mate who last played the ball.
Being in an offside position is not, in itself, an offence, but an offside player may not take part in the game until they are onside again.
If an offside player takes part in the game, that player will be penalised.
In a tackle or ruck situation, offside lines are created at a tackle when at least one player is on their feet and over the ball, which is on the ground. Each team’s offside line runs parallel to the goal line through the hindmost point of any player in the tackle or on their feet over the ball, as illustrated here.