1 John 1:9 - If we confess our sins, He is faithful and just and will forgive us our sins and purify us from all unrighteousness.
Here’s the thing about sin: we've all done it. We all still do it from time to time. “All have sinned and fallen short of the glory of God.” If you try to say you are without sin you are a liar and God is not in you. As long as we are in this world we will have our sinful nature, the flesh, as a part of who we are.
So we know that we have all sinned, yet we still try to hide it. We think that if we keep things looking good on the outside no one will know. First of all, God knows, because He looks into your heart. So He already knows what you did. But if that’s the case why do we need to confess it?
Confession of sin is not for God’s sake, but for our own. If you have sinned or are living in sin part of the problem is denial. We try to justify what we have done and make ourselves believe it is not as bad as it actually is. The reality: sin is sin. All sin is bad and deserves death.
Our sin deserves death, but we do not have to die because God has made a way for forgiveness to come through His Son, Jesus. Because of what Christ has done, forgiveness is waiting for us. It already there, all we have to do is confess our sins and receive it.
I am not saying that you have to announce your sin to the world, but you definitely need to confess it to yourself and God. After that He will lead you and tell you if you ought to confess to others and ask their forgiveness. So all in all we must recognize that our confession leads to our purification. Through Christ we are made righteous and holy.