John B. Anderson, a former Republican congressman from Illinois who bolted his party to run as a plain-spoken independent candidate for president in 1980, drawing an enthusiastic if transient following among liberals and college students, died on Sunday night in Washington. He was 95.

His death was confirmed by his daughter Diane Anderson.

The United States was struggling with a recession, a severe energy crisis and the protracted Iranian hostage crisis when Mr. Anderson gave up a safe seat in the House of Representatives to seek the Republican presidential nomination. When that try fizzled, he reintroduced himself as an independent, honest-dealing alternative to the rancorous business-as-usual politics of the major parties.

For a while he had the national spotlight, a 58-year-old maverick whose white hair, horn-rimmed glasses and clearheaded presentation gave him the air of a genial professor who was not so much above the fray as he was unwilling to play by its rules.

Mr. Anderson refused to pander, telling voters in Iowa that he favored President Jimmy Carter’s embargo on grain sales to the Soviet Union after it had invaded Afghanistan. He called for a gasoline tax of 50 cents per gallon — when a gallon cost $1.15 — to save energy.