William Cowper was the son of a Hertfordshire rector and was educated at a local boarding school and Westminster School. He studied law at the Inner Temple in London, but never practised it as a career. He suffered from depression all his life and his mental health was fragile. The strain on his mind was increased by his father's decision to ban him from marrying his first love, his cousin Theodora Cowper.
In 1763 the prospect of an examination for a job in the House of Lords caused a mental breakdown and he attempted suicide. He was nursed back to health by a clergyman, Morley Unwin, and his wife Mary. Cowper stayed with the Unwins and became engaged to Mary after Morley's death. His worsening mental condition made marriage impossible, but they remained close friends.
Cowper's state of mind was not improved by the company of the curate John Newton, a gloomy Calvinist. Under Newton's influence, Cowper came to believe that he was destined for eternal damnation, and in 1773 he suffered another attack of madness. Although his association with Newton produced the book Olney Hymns (1779), it can hardly be described as a fruitful partnership for Cowper, and his health improved when the preacher left for London.
Encouraged by Mary Unwin, Cowper wrote a series of moral satires which were published in Poems (1782), and his happier frame of mind at this time can be seen in poems such as 'Retirement ' and 'Conversation'. Another friend, the widow Lady Austen, provided the story for the ballad 'The Journey of John Gilpin', as well as the initial idea which Cowper developed into The Task.
In his later years Cowper translated Homer and Milton's Greek and Latin poems. The death of Mary Unwin in 1796 resulted in the profound despair which is expressed in his last great poem, 'The Castaway'.