Short answer
Yes. You do not need to fix every habit before saying the shahada. Islam wipes out what came before it, and the door of repentance stays open afterwards. Once you believe, do not delay your shahada: become Muslim now and keep working on what you struggle with, one step at a time.
Faith remains valid while a person still commits sins, and sins after Islam do not cancel faith unless they amount to disbelief. A person who believes must not delay entering Islam. Each sin needs its own repentance, and persisting in a sin knowingly is itself wrong, but it does not stop anyone from becoming or remaining Muslim.
The four schools agree on this.
Explanation
Many people hold back because of drinking, smoking, a relationship, or fear that they cannot manage five prayers a day yet. When Amr ibn al-As came to accept Islam, he pulled back his hand and asked for a condition: that he be forgiven. The Prophet ﷺ told him that Islam erases what came before it. He did not ask him to become perfect first.
Sunni creed, as Abu Hanifa set it out, is that a Muslim is not declared a disbeliever because of a sin. A believer who sins is still a believer who needs to repent. The Quran says to those who have wronged themselves: "do not despair of the mercy of Allah. Indeed, Allah forgives all sins." The Prophet ﷺ even said that if people did not sin, Allah would bring a people who sin and ask forgiveness so that He could forgive them.
- Say the shahada now if you believe. Waiting carries the real risk of dying before it.
- Start with prayer. It is the first duty, and it helps with everything else.
- Tackle the biggest sins first: alcohol, relationships outside marriage, anything that harms others. Small steps you keep are better than big ones you drop.
- If you slip, repent again. Allah replaces the bad deeds of those who repent with good ones.
What Islam does not allow is planning to sin on the understanding that you will repent later. That is different from honest struggle. Nobody becomes Muslim already perfect, and every born Muslim is still working on themselves too. See are past sins forgiven?, how to convert and does Allah forgive all sins?
The evidence
Quran, Surah Az-Zumar 39:53
۞ قُلْ يَٰعِبَادِىَ ٱلَّذِينَ أَسْرَفُوا۟ عَلَىٰٓ أَنفُسِهِمْ لَا تَقْنَطُوا۟ مِن رَّحْمَةِ ٱللَّهِ ۚ إِنَّ ٱللَّهَ يَغْفِرُ ٱلذُّنُوبَ جَمِيعًا ۚ إِنَّهُۥ هُوَ ٱلْغَفُورُ ٱلرَّحِيمُ ﴿٥٣﴾
Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah. Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful."
No sin is too great for Allah's forgiveness, so it should not keep anyone from Islam.
Quran, Surah Al-Furqaan 25:70
إِلَّا مَن تَابَ وَءَامَنَ وَعَمِلَ عَمَلًۭا صَٰلِحًۭا فَأُو۟لَٰٓئِكَ يُبَدِّلُ ٱللَّهُ سَيِّـَٔاتِهِمْ حَسَنَٰتٍۢ ۗ وَكَانَ ٱللَّهُ غَفُورًۭا رَّحِيمًۭا ﴿٧٠﴾
Except for those who repent, believe and do righteous work. For them Allah will replace their evil deeds with good. And ever is Allah Forgiving and Merciful.
Those who repent and believe have their bad deeds turned into good ones.
Quran, Surah Aal-i-Imraan 3:135
وَٱلَّذِينَ إِذَا فَعَلُوا۟ فَٰحِشَةً أَوْ ظَلَمُوٓا۟ أَنفُسَهُمْ ذَكَرُوا۟ ٱللَّهَ فَٱسْتَغْفَرُوا۟ لِذُنُوبِهِمْ وَمَن يَغْفِرُ ٱلذُّنُوبَ إِلَّا ٱللَّهُ وَلَمْ يُصِرُّوا۟ عَلَىٰ مَا فَعَلُوا۟ وَهُمْ يَعْلَمُونَ ﴿١٣٥﴾
And those who, when they commit an immorality or wrong themselves [by transgression], remember Allah and seek forgiveness for their sins - and who can forgive sins except Allah? - and [who] do not persist in what they have done while they know.
The believer who slips turns back to Allah and does not persist.
Sahih Muslim 121
Sahih... أما علمت أن الإسلام يهدم ما كان قبله ...
"Do you not know that Islam wipes out what came before it?"
Entering Islam clears the past, so there is no need to wait until one is perfect.
Sahih Muslim 2749
Sahih... لو لم تذنبوا لذهب الله بكم ولجاء بقوم يذنبون فيستغفرون الله فيغفر لهم ...
"If you did not sin, Allah would replace you with a people who sin, then seek Allah's forgiveness, and He would forgive them."
Sinning and repenting is part of being human, not a barrier to faith.
Where the ruling is recorded
- al-Fiqh al-Akbar, the section stating that no Muslim is declared a disbeliever because of a sin. A believer who sins remains a believer.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.