We all make mistakes, and by the grace of Allah, Glory be to Him, we can repent if we feel genuine remorse, stop the mistaken action, and resolve not to repeat it. God accepts your repentance any time before your spirit leaves your body. When you seek to clean yourself of your mistakes, offer one of the following duas (prayers) sincerely and repeatedly until you have a sense of returning to God.

I seek the forgiveness of Allah and I pray for His approval of my repentance.
astaghfiru allaaha wa as-aluka attawbata

I seek Allah’s forgiveness
For there is no god except Him
The Compassionate, the Merciful,
The Living, the Eternal, and to Him I repent.
Atagfiru allaaha alladhy
Laa ilaha huwa
Ar-Rahman ar-Rahim
Al-Hayy al-Qayyum wa atouba ilay

I seek forgiveness of Allah.
Astaghfiru-llāh al-aḍhim wa atūbu ʿilayh

Forgive me Allah, All-mighty, other than Whom no deity exists, The Ever-living, Self-subsistent, and to Him I return repentant.
Astaghfiru-llāh al-aḍhim lā ilāha illā hū al ḥayy al qayyūm wa atūbu ʿilayh

O Allah, You are Pardoning and you love pardon, so pardon me.
allahumma innaka ‘afuwwun tuhibbu ‘l-‘afwa fa‘fu ‘anni

Habib Todd Boerger