William Alexander was born in 1819 in Woodford County, Kentucky, to a prominent family of farmers and stock raisers. He graduated from Centre College, Kentucky, and Yale University. He later studied law at Frankfort, Kentucky, and began his practice after moving to Galveston, Texas, in May 1846. In 1857 he moved to Austin. He opposed secession and left Texas during the Civil War to travel in Mexico and study Spanish and Mexican law. After the war he served as attorney general of Texas under provisional governor Andrew J. Hamilton in 1865–66. In September 1867 he again was appointed attorney general of Texas by Gen. Charles Griffin, commander of the Fifth Military District. He resigned in October, however, after a difference of opinion with Governor E. M. Pease over the validity of the state Constitution of 1866. Alexander was appointed attorney general of Texas for the third time in 1870 by Governor Edmund J. Davis and served until 1874. Thereafter he continued practicing law in Austin, where he died on February 16, 1882.