William Bayly (1737–1810) was an English astronomer.
Bayly was born at Bishops Cannings, or Carions, in Wiltshire. His father was a small farmer, and Bayly's boyhood was spent at the plough. In spite of the constant manual work he had to do, he took advantage of the kindness of an exciseman living in a neighbouring village, who offered to give him some lessons. From him he learned the elements of arithmetic. A gentleman of Bath, named Kingston, heard of the boy's taste for mathematics, and gave him some help. He became usher in a school at Stoke, near Bristol, and after a while took a similar situation in another school in the neighbourhood. While thus employed, he took every opportunity of increasing his mathematical knowledge.
Nevil Maskelyne, the astronomer-royal, happened to hear of his talents, and engaged him as an assistant at the Royal Observatory. On his recommendation Bayly, in 1769, was sent out by the Royal Society to North Cape, Norway to observe the transit of Venus that occurred in that year, and his observations were printed in the Philosophical Transactions of the society. In 1772 he accompanied William Wales as an astronomer on Cook's second voyage of discovery to the southern hemisphere. The two ships employed in the expedition, the Resolution and the Adventure, sailed on 13 June. He also sailed in Cook's third and last voyage made with the Resolution and the Discovery, which departed the English Channel on 14 July 1776. This voyage, in which Cook was killed by natives in Hawaii, came to an end in 1780.
In 1785 Bayly was made head-master of the Royal Academy at Portsmouth, an office he continued to hold until the establishment of the Royal Naval College in 1807, when he retired on a sufficient pension. The organ in the parish church of his native village is his gift. He died at Portsea, Portsmouth towards the end of 1810.