The religious views of Samuel Johnson are expressed in both his moralistic writings and his sermons.

Moralistic writings
Samuel Johnson regarded himself as a moralist during his career between 1748 and 1760. Although Johnson wrote a poem, many essays, and a short novel, all of these works are connected by a common intent and each relates to others. The works during this period cannot be separated without disregarding Johnson's major ideas and themes.

As David Greene points out, Johnson's moral writings contain no "predetermined and authorized pattern of 'good behavior,'" although they do emphasize certain kinds of conduct. To be moral, in Johnson's view, an individual must always be self-aware and self-critical.  Johnson respected committed Christians of other denominations than his own High Church Anglicanism. . His aversion to Milton's politics entails no attack on Milton's religious beliefs. He defended Thomas Browne by saying, in his Life of Browne:
Men may differ from each other in many religious opinions, and yet all may retain the essentials of Christianity; men may sometimes eagerly dispute, and yet not differ much from one another: the rigorous prosecutors of error should, therefore, enlighten their zeal with knowledge, and temper their orthodoxy with charity; that charity without which orthodoxy is vain.
He attacks other religions or their adherents on the grounds that they betray Christ's teachings. This is not to say that Johnson was passive in his religious observance; instead, he was an 18th-century evangelical, which, as he defines in his Dictionary, means "Agreeable to gospel; consonant to the Christian law contained in the holy gospel".

The Vanity of Human Wishes

The Vanity of Human Wishes is a sort of prologue to Johnson's career as a moralist.

The Rambler

The Idler

Rasselas

Rasselas is a sort of epilogue to Johnson's career as a moralist.

Sermons
Johnson's sermons, according to Donald Greene, are "a neglected but important and rewarding section of his writings". They are dry and formally organized because Johnson did not approve of the emotionally charged rhetoric of 17th century preachers at the pulpit. Christian religion and ethics are the primary topic of the sermons with emphasis on marriage, repentance, hardening the heart, charity, pride, wisdom, and compassion. Sometimes Johnson discussed theological topics like the nature of God or political topics like morality's role in governmental action.

Views
Johnson was a rationalist and believed that rational thought was vital to morality.

On poverty
In his review of Soame Jenyns's A Free Enquiry into the Nature and Origin of Evil and its argument that those "born to poverty" should not be educated so they could enjoy the "opiate of ignorance", Johnson wrote, "To entail irreversible poverty upon generation after generation only because the ancestor happened to be poor, is, in itself, cruel, if not unjust".

On madness
When Jenyns claimed that madness was a way God ensured that the poor would be content with life, Johnson responded:
On the happiness of madmen, as the case is not very frequent, it is not necessary to raise a disquisition, but I cannot forbear to observe that I never yet knew disorders of mind increase felicity; every madman is either arrogant and irascible, or gloomy and suspicious, or possessed by some passion or notion destructive to his quiet. He has always discontent in his look, and malignity in his bosom. And, if we had the power of choice, he would soon repent who should resign his reason to secure his peace.

On education
Johnson responds to Jenyns's final argument, that the ends justify the means when it comes to keeping the poor uneducated, by saying:
I am always afraid of determining on the side of envy or cruelty. The privileges of education may sometimes be improperly bestowed, but I shall always fear to withhold them lest I should be yielding to the suggestions of pride, while I persuade myself that I am following the maxims of policy; and under the appearance of salutary restraints, should be indulging the lust of dominion, and that malevolence which delights in seeing others depressed.

On slavery
Johnson's anti-slavery views were so strong that Boswell characterized them in this way: "His violent prejudice against our West-Indian and American settlers appeared whenever there was an opportunity." Boswell also notes that at Oxford Johnson gave a toast and said, "Here's to the next insurrection of the Negroes in the West Indies", in addition to criticizing American independence for its hypocrisy regarding slavery.

Notes

References
 .
 .
 .

Morality
Johnson, Samuel