Born in Niles, Ohio, in 1843, McKinley briefly attended Allegheny College, and was teaching in a country school when the Civil War broke out. Enlisting as a private in the Union Army, he was mustered out at the end of the war as a brevet major of volunteers. He studied law, opened an office in Canton, Ohio, and married Ida Saxton, daughter of a local banker.