William Riley Shartzer was born on January 8, 1842, in Roanoke County, Virginia, to Benjamin and Bidsey Shartzer. His father was a shoemaker who owned $100 of real estate by 1850. The family moved to Grayson County, Kentucky, in the late 1840s, and Shartzer attended school there. He remained loyal to the Union during the Civil War. He enlisted in the Union army on October 28, 1861, and he mustered in as a private in Company E of the 25th Kentucky Infantry on January 1, 1862. He was transferred to Company I of the 17th Kentucky Infantry on April 13, 1862. The regiment took part in the Siege of Corinth, the Battle of Chickamauga, the Battle of Missionary Ridge, and the Atlanta Campaign. He supported emancipation by September 1864 and endorsed President Abraham Lincoln in that year’s election. He mustered out on January 23, 1865.
Shartzer returned to Kentucky after the war. He married a woman named Mary, and they had two children, including Celina, born around 1868. He worked as a blacksmith in Short Creek, Kentucky. He applied for a federal pension in November 1885 and eventually secured one. By 1900, he was living in Leitchfield, Kentucky. He died in Clarkson, Kentucky, on February 4, 1917.