There are 5 conditions for the acceptance of tawbah:
1. That you sincerely repent, seeking the face of Allah that He forgives you. One should not seek to show off, to impress the people, or to repel the harm from the leader, but solely to seek the face of Allāh and gain his forgiveness.
2. That you are regretful. When one is regretful it shows that one is truthful in his repentance.
3. That you stay away from that sin. This is the most important of the conditions, but it is the hardest. Question: if one sins should he tell the people? Shaykh al-ʿUthaymīn said that, if Allāh has blessed you by covering your sins, then do not tell anyone what you have done. The Prophet (ṣallallāhu ʿalayhi wa-sallam) said, “All of my Ummah will be forgiven except those who openly expose their sins.” If it is a sin that involves a punishment then one can go to the Muslim leader in a Muslim country so the punishment can be established. Other than that do not expose yourself.
4. That you are determined not to return to that sin in the future. If you intend to return to it then your tawbah is not accepted.
5. That you have to repent at a time when repentance is accepted. It is obligatory that one repents before he knows he is actually going to die. For example, if a man is in an accident and knows he is going to die and then says, “I repent now.” This is due to Allāh’s saying, “There is no tawbah for those who do evil deeds and when death comes to them they say, ‘I repent now.’” It is too late. Another time when it is too late to repent is after the sun rises from the west. No repentance will befit anyone in that time.
Tawbah is obligatory upon everyone: Allāh says, “All of you repent to Allāh, O believers, so that you may be successful.”