“O My slaves who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of God: verily, God forgives all sins. Truly He is Oft-Forgiving, Most Merciful.” (Quran 39:53)
God did not create humankind for any purpose other than to worship Him. However being human makes us frail and forgetful while at the same time our humanity often causes us to become full of our own importance; proud and arrogant. Arrogance in turn often causes us to commit sins, and our forgetfulness often causes us to make mistakes that can easily lead to sinful behavior. God knows us well, He is our Creator. He has not abandoned us to our own imperfect nature; He has provided us with innumerable opportunities to turn to Him for forgiveness. In fact God loves that we feel remorse, and turn to Him seeking His forgiveness and comfort. Prophet Muhammad, may the mercy and blessings of God be upon him, said to his companions, and to all those who follow them in righteousness, “If you did not commit sins, God would replace you with other people who would commit sins, and ask for God's forgiveness, and He would forgive them.”  This is not an encouragement to sin, but demonstrates the infinite Mercy of God.
The door to forgiveness is always open
God, in His infinite wisdom has made seeking forgiveness easy. If we were not able to seek and obtain God’s forgiveness we would indeed be miserable people, full of despair and self-loathing. It is for this reason that there are no transgressions too big or sins too small that God will not forgive. All sins are forgivable and the door to forgiveness is wide open almost until the Day of Judgement is upon us.
“And turn in repentance and in obedience with true Faith to your Lord and submit to Him, before the torment comes upon you, then you will not be helped.” (Quran 39:54)
When God sees the sincere repentance from one of the believers – a person who truly turns God with both fear and hope – He not only forgives the sin, but He replaces the sins with rewardable good deeds. This is from God’s infinite mercy.
“Except those who repent and believe and do righteous deeds; for those, God will change their sins into good deeds, and God is Oft-Forgiving, Most Merciful.” (Quran 25:70)
God also forgives us our sins through the difficulties that we face in our lives. When we are stricken with illness or suffering from unfavourable circumstances, we will earn forgiveness if we bear our difficulties patiently, all the time seeking a reward from God.
Major and minor sins
Disobeying God is always a serious matter; however the scholars of Islam have divided sins into major and minor categories. Major sins are those sins that entail Allah's curse or incur His wrath or are tied with the threat of punishment of Hell, which includes the sin of worshipping something other than God, which is the most grievous act a human being can commit. Other major sins include murder, sorcery and adultery. Minor sins are defined as acts that are displeasing to God but have no defined punishment mentioned in either the Quran or the authentic traditions. However they are not to be taken lightly because minor sins can easily lead on to major sins and God warned us to take minor sins seriously when He says, “…you counted it a little thing, while with God it was very great.” (Quran24:15)
Prophet Muhammad advised us that, “Righteousness is in good character and morality, and wrongdoing is that which wavers in your soul, and which you dislike people finding out about.”
Obtaining God’s forgiveness is easy
As mentioned before, sincere repentance is able to wipe out a person’s sins, forever and completely. It involves showing genuine remorse, praying for God's mercy and forgiveness, and avoiding that sin in the future. In addition to this, God has also given us other ways in which to wipe the slate clean so that a person may begin again in the eyes of God, as if he or she was a new born baby.
These acts include a nonbeliever embracing Islam, and a person performing an accepted pilgrimage (Hajj) to the House of God in Mecca, Saudi Arabia.
“Say to those who have disbelieved [that] if they cease, what has previously occurred will be forgiven for them…” (Quran 8:38)
Prophet Muhammad, may the mercy and blessings of God be upon him, said, “Do you not know that accepting Islam destroys all sins which come before it?”
“Whoever performs Hajj for God's pleasure and does not have sexual relations with his wife, and does not do evil or sins then he will return (after Hajj free from all sins) as if he were born anew”.
As for minor sins, God mercy is so complete that he forgives us our sins even as we perform obligatory acts. From the traditions of Prophet Muhammad we find several sayings that attest to this fact.
“He who performs ablution well, his sins will come out from his body, even from under his nails”.
“When the time for a prescribed prayer comes, if any believer performs ablution well and offers his prayer with humility and bowing, it will be an expiation for his past sins, so long as he has not committed a major sin; and this applies for all times”.
“… if he performs ablution completely and then goes to the mosque with the sole intention of performing the prayer, and nothing urges him to proceed to the mosque except the prayer, then, on every step which he takes towards the mosque, he will be raised one degree or one of his sins will be forgiven…”
“Whoever fasted the month of Ramadan out of sincere Faith (i.e. belief) hoping for a reward from God, then all his past sins will be forgiven”.
Sins can also be forgiven by performing good deeds, again though we must strive to do these deeds completely for the sake of God not for some worldly reward. “…Verily, the good deeds remove the evil deeds (small sins). This is a reminder for the mindful (those who accept advice).” (Quran 11:114)
God has made it easy for us to seek and obtain His forgiveness however it does not come automatically; one must seek God’s forgiveness sincerely, knowing that it is only through God's supreme mercy that anyone will enter Paradise. Prophet Muhammad said, “Do good deeds properly, sincerely and moderately, and rejoice, for no one's good deeds will put him in Paradise.” His companions asked, “Not even you, O Messenger of God?” He replied, “Not even me, unless God bestows His pardon and mercy upon me.”