The 22nd Amendment to the United States Constitution is meant to limit the number of terms that a president can run to two 4-year terms. This was more of a tradition than a rule until 1947, when the amendment was passed following Franklin D. Roosevelt being elected to four 4-year terms.
The new amendment limited presidents to the service years that were suggested by George Washington when he was elected as president. It took until 1951 for the amendment to be ratified by all of the states. If a president or vice president who becomes president in his or her place only serves 2 years or less of a term, they are still allowed to serve two full 4-year terms, if elected.