According to the 22nd Amendment of the U.S. Constitution, a president can serve only two terms, or 8 years in office. In exceptional circumstances, it is possible for a former vice president to serve 10 years as president.
The 22nd Amendment was passed in Congress in 1947, immediately following Franklin Delano Roosevelt's presidency. Roosevelt served three full terms and part of a fourth before his death; he was the first and only president to serve more than two terms.
The 22nd Amendment limits a president's number of terms to two. However, if a vice president takes over for a president with less than two years of his term remaining, that vice president is allowed to run for two more terms, for a total maximum of 10 years serving as president. This has never happened in U.S. history.