The letter says that if sins are confessed, God is faithful and just to forgive sins and to cleanse from all unrighteousness. It contrasts confession with denying sin. See 1 John 1:9.
In 1 John 1:8–10, the writer gives three “if we say” tests about wrongdoing and truthfulness. Claiming to have no “sin” is self-deception and shows that truth is not operating within a person. The positive alternative is open confession, which matches God’s dependable character and results in forgiveness and cleansing. These verses sit inside an early section where the writer contrasts walking in light versus darkness (1:5–2:2). Just before this, the author links genuine shared life with God to living openly in the light, and he mentions cleansing connected to Jesus’ blood (1:7).
These verses treat speech-claims about moral reality as a serious test. Three times the writer frames the issue as “if we say” or “if we confess,” showing that what people assert about themselves can conflict with what is true (Stage A: “Saying ‘we have no sin’ results in self-deception”; “Saying ‘we haven’t sinned’ makes God out to be a liar”).
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with 1 John 1:9, then read the surrounding section so the answer stays connected to the passage's flow.
9If we confess our sins, he is faithful and righteous to forgive us the sins, and to cleanse us from all unrighteousness.