When it is said
In the Orthodox service of baptism, the priest sings it with the people right after the baptism, while he washes his hands.
Before confession, it gives words for the step the whole psalm turns on, from hiding a sin to telling it.
Stop at the line “I will confess my wrongs to the LORD” and take it as your own.
Where it comes from
Author by tradition
A psalm of David
The Hebrew heading calls it a maskil of David, a word the margin of the King James Version explains as a psalm “giving instruction.” In the Greek Bible (the Septuagint) it is Psalm 31.
The Hebrew Bible, on Mechon Mamre; The King James Version, with its margin, on eBible; Brenton’s translation of the Septuagint, on eBible
Paul quotes it
Paul quotes the first two verses in Romans 4:7-8. He reads them as David’s picture of the blessing of the person whom God counts righteous apart from works (Romans 4:6).
The Scripture in it
Blessed is he whose transgressions are forgiven, whose sins are covered. Blessed is the man whose iniquity the LORD does not count against him, in whose spirit there is no deceit. When I kept silent, my bones became brittle from my groaning all day long. For day and night Your hand was heavy upon me; my strength was drained as in the summer heat. Selah Then I acknowledged my sin to You and did not hide my iniquity. I said, “I will confess my transgressions to the LORD,” and You forgave the guilt of my sin. Selah Therefore let all the godly pray to You while You may be found. Surely when great waters rise, they will not come near. You are my hiding place. You protect me from trouble; You surround me with songs of deliverance. Selah
Bible text: Berean Standard Bible, public domain.