Repentance (tawbah) means turning back to Allah: regretting a sin, stopping it, and meaning not to return to it. The Prophet ﷺ said Allah is more pleased with a servant's repentance than a traveller who finds his lost camel in the desert, and that the door stays open until the soul reaches the throat.
From the Quran
يَـٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوا۟ تُوبُوٓا۟ إِلَى ٱللَّهِ تَوْبَةً نَّصُوحًا عَسَىٰ رَبُّكُمْ أَن يُكَفِّرَ عَنكُمْ سَيِّـَٔاتِكُمْ وَيُدْخِلَكُمْ جَنَّـٰتٍ تَجْرِى مِن تَحْتِهَا ٱلْأَنْهَـٰرُ يَوْمَ لَا يُخْزِى ٱللَّهُ ٱلنَّبِىَّ وَٱلَّذِينَ ءَامَنُوا۟ مَعَهُۥ ۖ نُورُهُمْ يَسْعَىٰ بَيْنَ أَيْدِيهِمْ وَبِأَيْمَـٰنِهِمْ يَقُولُونَ رَبَّنَآ أَتْمِمْ لَنَا نُورَنَا وَٱغْفِرْ لَنَآ ۖ إِنَّكَ عَلَىٰ كُلِّ شَىْءٍ قَدِيرٌ ﴿8﴾
O you who have believed, repent to Allāh with sincere repentance. Perhaps[1709] your Lord will remove from you your misdeeds and admit you into gardens beneath which rivers flow [on] the Day when Allāh will not disgrace the Prophet and those who believed with him. Their light will proceed before them and on their right; they will say, "Our Lord, perfect for us our light and forgive us. Indeed, You are over all things competent."
At-Tahrim 66:8إِلَّا مَن تَابَ وَءَامَنَ وَعَمِلَ عَمَلًا صَـٰلِحًا فَأُو۟لَـٰٓئِكَ يُبَدِّلُ ٱللَّهُ سَيِّـَٔاتِهِمْ حَسَنَـٰتٍ ۗ وَكَانَ ٱللَّهُ غَفُورًا رَّحِيمًا ﴿70﴾
وَمَن تَابَ وَعَمِلَ صَـٰلِحًا فَإِنَّهُۥ يَتُوبُ إِلَى ٱللَّهِ مَتَابًا ﴿71﴾
70Except for those who repent, believe and do righteous work. For them Allāh will replace their evil deeds with good. And ever is Allāh Forgiving and Merciful. 71And he who repents and does righteousness does indeed turn to Allāh with [accepted] repentance.
Al-Furqan 25:70-71أَلَمْ يَعْلَمُوٓا۟ أَنَّ ٱللَّهَ هُوَ يَقْبَلُ ٱلتَّوْبَةَ عَنْ عِبَادِهِۦ وَيَأْخُذُ ٱلصَّدَقَـٰتِ وَأَنَّ ٱللَّهَ هُوَ ٱلتَّوَّابُ ٱلرَّحِيمُ ﴿104﴾
Do they not know that it is Allāh who accepts repentance from His servants and receives charities and that it is Allāh who is the Accepting of Repentance,[503] the Merciful?
At-Tawbah 9:104إِنَّمَا ٱلتَّوْبَةُ عَلَى ٱللَّهِ لِلَّذِينَ يَعْمَلُونَ ٱلسُّوٓءَ بِجَهَـٰلَةٍ ثُمَّ يَتُوبُونَ مِن قَرِيبٍ فَأُو۟لَـٰٓئِكَ يَتُوبُ ٱللَّهُ عَلَيْهِمْ ۗ وَكَانَ ٱللَّهُ عَلِيمًا حَكِيمًا ﴿17﴾
The repentance accepted by Allāh is only for those who do wrong in ignorance [or carelessness] and then repent soon [after].[172] It is those to whom Allāh will turn in forgiveness, and Allāh is ever Knowing and Wise.
An-Nisa 4:17وَأَنِ ٱسْتَغْفِرُوا۟ رَبَّكُمْ ثُمَّ تُوبُوٓا۟ إِلَيْهِ يُمَتِّعْكُم مَّتَـٰعًا حَسَنًا إِلَىٰٓ أَجَلٍ مُّسَمًّى وَيُؤْتِ كُلَّ ذِى فَضْلٍ فَضْلَهُۥ ۖ وَإِن تَوَلَّوْا۟ فَإِنِّىٓ أَخَافُ عَلَيْكُمْ عَذَابَ يَوْمٍ كَبِيرٍ ﴿3﴾
And [saying], "Seek forgiveness of your Lord and repent to Him, [and] He will let you enjoy a good provision for a specified term and give every doer of favor his favor [i.e., reward]. But if you turn away, then indeed, I fear for you the punishment of a great Day.
Hud 11:3إِلَّا ٱلَّذِينَ تَابُوا۟ وَأَصْلَحُوا۟ وَبَيَّنُوا۟ فَأُو۟لَـٰٓئِكَ أَتُوبُ عَلَيْهِمْ ۚ وَأَنَا ٱلتَّوَّابُ ٱلرَّحِيمُ ﴿160﴾
Except for those who repent and correct themselves and make evident [what they concealed]. Those - I will accept their repentance, and I am the Accepting of Repentance,[59] the Merciful.
Al-Baqarah 2:160
From the hadith
Narrated Anas bin Malik:Allah's Messenger (ﷺ) said, "Allah is more pleased with the repentance of His slave than anyone of you is pleased with finding his camel which he had lost in the desert
Ibn `Umar narrated that the Prophet (ﷺ) said:“Indeed Allah accepts the repentance of a slave as long as (his soul does not reach his throat).”
Abu Huraira reported Allah's Messenger (ﷺ) as say- ing:He who seeks repentance (from the Lord) before the rising of the sun from the west (before the Day of Resurrection), Allah turns to him with Mercy
Sahih Muslim 2703SahihAnas narrated that the Prophet (ﷺ) said:"Every son of Adam sins, and the best of the sinners are the repentant
Abu Sa'id al-Khudri reported Allah's Messenger (ﷺ) as saying that a man killed ninety-nine persons and then he began to make an inquiry whether there was any way left for him for repentance. He came to a monk and asked him about that, and he said:There is no chance for repentance for you. He killed the monk also and then began to make an inquiry and moved from one village to another village where there lived pious persons, and as he had covered some distance, he was overtaken by death, but he managed to crawl upon his chest (to the side nearer to the place where the pious men lived). He died and then there was a dispute between the angels of mercy and the angels of punishment and (when it was measured) he was found to be nearer to the village where pious persons were living equal to the Space of a span and he was thus included among them
Sahih Muslim 2766SahihIt was narrated that Ibn Ma’qil said:“I entered with my father upon ‘Abdullah, and I heard him say: ‘The messenger of Allah (ﷺ) said: “Regret is repentance.” My father said: ‘Did you hear the Prophet (ﷺ) say: “Regret is repentance?” He said: ‘Yes.’”
Sunan Ibn Majah 4252Hasan
Quran: the Arabic Uthmani text from Tanzil.net (CC BY 3.0); English, Saheeh International, from QuranEnc.com.
Hadith: the English and the grades from the open hadith dataset (fawazahmed0/hadith-api), the same narrations MuslimGPT checks every quote against. Each one opens its own page with the Arabic.
The introduction is ours. For a ruling on your own situation, ask a scholar you trust.