Millard Fillmore, a member of the Whig party was the last President (1850-1853) to not be affiliated with either the Democratic or Republican parties.
According to the White House archives, Millard Fillmore, a member of the Whig party, was the 13th President of the United States (1850-1853) and the last President not to be affiliated with either the Democratic or Republican parties.
The official website of the US Embassy states that the Republican and Democratic parties — both of them heirs to predecessor parties from the 18th and 19th centuries — dominate the political process. With rare exceptions, the two major parties control the presidency, the Congress, the governorships, and the state legislatures. For instance, every president since 1852 has been either a Republican or a Democrat, and in the post-World War II era, the two major parties’ share of the popular vote for president has averaged close to 95 percent. Rarely do any of the 50 states elect a governor who is not a Democrat or a Republican. The number of independent or third-party members of Congress or of state legislatures is extremely low.