Amazing Grace first appeared in the Olney Hymns, a collection John Newton compiled with the poet William Cowper, his neighbor and friend at Olney, published in 1779 to give the parish's evangelical prayer meetings a shared body of song written specifically for ordinary worship rather than adapted from older liturgical sources. Newton wrote the hymn's words; its now familiar tune, New Britain, was not attached to the text until decades later in the United States, where the hymn became especially popular in camp meeting revivals during the nineteenth century, a development Newton did not live to see.
The opening line, amazing grace, how sweet the sound, that saved a wretch like me, is widely read as a direct reference to Newton's own past, the word wretch carrying the specific weight of his years captaining ships in the slave trade rather than functioning as generic self deprecation, though the hymn itself never states this connection explicitly. In his last decades Newton made that connection to his past explicit elsewhere, testifying before a parliamentary committee investigating the slave trade in 1788 and publishing a pamphlet, Thoughts Upon the African Slave Trade, that described the trade's cruelty in detail from his own firsthand experience of it, work that directly supported William Wilberforce's long campaign for abolition. The hymn and that later public testimony are usually read together in modern scholarship as two expressions of the same reckoning, one addressed to God in the language of grace and one addressed to Parliament in the language of policy.