In the four quarters of an NBA game, a team has four fouls that it can commit before the other team is automatically awarded two automatic free throws (on the fifth foul). A free throw is when a player shoots from behind a line that is 15 feet away from the basket without anybody guarding him. In overtime, a team can only give three fouls without the other team shooting and on the fourth foul, the other team shoots two free throws. On the first three fouls of overtime, the other team inbounds the ball from the sideline instead of shooting free throws.
At the beginning of the last two minutes of any NBA period, the foul limit for a team is reset. If the team has already committed its foul limit (four in a quarter, three in overtime) this does not affect them. If they have not committed the foul limit, they have one foul left to give in the last two minutes. For example, if a team has only committed one foul in overtime, but they commit fouls in the last two minutes, the other team gets to shoot two free throws on the third foul.
Players have a limit of 6 fouls before they are ejected from a game. Overtime does not change this limit as players still are ejected when they receive their sixth foul. When a player has reached his foul limit, he can be replaced with another player after the foul has been called.
Overtime is forced when two teams are tied after 48 minutes of regulation play. The overtime period is five minutes long. The team that has the most points at the end of the overtime is declared the winner. If the teams are tied at the end of overtime they go into a second overtime; and overtime periods will continue until one team is winning at the end of an overtime period. No matter how many overtime periods there are, the team foul rules remain the same. Teams do not carry over fouls from quarter to quarter (to overtime period) but players do carry fouls over from earlier periods.