William H. Farrar (1826 – November 21, 1873) was an American politician who served as mayor of Portland, Oregon, in 1862. Appointed as Oregon Territorial District Attorney in 1853 by President Franklin Pierce, he served as District Attorney for Oregon from 1853–1859. In 1857, he was a delegate to the Oregon Constitutional Convention representing Multnomah County. According to the Oregon State Archives, he voted against approving the Constitution. He was elected in 1862 as the mayor of Portland, Oregon. He died on November 21, 1873, in Washington City, District of Columbia (present-day Washington D.C.).
The October 18, 2012, edition of the Portland Mercury listed Farrar as the "Worst Mayor Ever." According to the article, at the beginning of Farrar's term, he informed the city council he had to take a three-month leave of absence for business. He was never seen in Portland again.