"مَنْ أحْسَنَ في الإسْلامِ لَمْ يُؤَاخَذْ فِيمَا عَمِلَ في الْجَاهلَيَّة، وَمَنْ أَسَاءَ مِنْكُمْ في الإِسْلام، أُخِذَ بِمَا عَمِلَ في الْجَّاهِلِيةِ والإِسْلام".
See similar narrations below:
Collected by Bukhārī, Muslim, Aḥmad, Dārimī, Ibn Ḥibbān, Bayhaqī, SuyūṭīA man said, "O Messenger of Allah ﷺ! Shall we be punished for what we did in the Prelslamic Period of ignorance?" The Prophet ﷺ said, "Whoever does good in Islam will not be punished for what he did in the Pre-lslamic Period of ignorance and whoever does evil in Islam will be punished for his former and later (bad deeds).
رَجُلٌ يَا رَسُولَ اللَّهِ أَنُؤَاخَذُ بِمَا عَمِلْنَا فِي الْجَاهِلِيَّةِ قَالَ مَنْ أَحْسَنَ فِي الإِسْلاَمِ لَمْ يُؤَاخَذْ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الإِسْلاَمِ أُخِذَ بِالأَوَّلِ وَالآخِرِ
Messenger of Allah, would we be held responsible for our deeds committed in the state of ignorance (before embracing Islam)? Upon his he (the Holy Prophet) remarked: He who amongst you performed good deeds in Islam, He would not be held responsible for them (misdeeds which he committed in ignorance) and he who committed evil (even after embracing Islam) would be held responsible or his misdeeds that he committed in the state of ignorance as well as in that of Islam.
أُنَاسٌ لِرَسُولِ اللَّهِ ﷺ يَا رَسُولَ اللَّهِ أَنُؤَاخَذُ بِمَا عَمِلْنَا فِي الْجَاهِلِيَّةِ قَالَ أَمَّا مَنْ أَحْسَنَ مِنْكُمْ فِي الإِسْلاَمِ فَلاَ يُؤَاخَذُ بِهَا وَمَنْ أَسَاءَ أُخِذَ بِعَمَلِهِ فِي الْجَاهِلِيَّةِ وَالإِسْلاَمِ
We once said: Messenger of Allah, would we be held responsible for our deeds committed in the state of ignorance? He (the Holy Prophet) observed: He who did good deeds in Islam would not be held responsible for what he did in the state of ignorance, but he who committed evil (after having come within the fold of Islam) would be held responsible for his previous and later deeds.
قُلْنَا يَا رَسُولَ اللَّهِ أَنُؤَاخَذُ بِمَا عَمِلْنَا فِي الْجَاهِلِيَّةِ قَالَ مَنْ أَحْسَنَ فِي الإِسْلاَمِ لَمْ يُؤَاخَذْ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الإِسْلاَمِ أُخِذَ بِالأَوَّلِ وَالآخِرِ
A man said, "O Messenger of Allah ﷺ! Shall we be punished for what we did in the Prelslamic Period of ignorance?" The Prophet ﷺ said, "Whoever does good in Islam will not be punished for what he did in the Pre-lslamic Period of ignorance and whoever does evil in Islam will be punished for his former and later (bad deeds). (Using translation from Bukhārī 6921)
رَجُلٌ لِلنَّبِيِّ ﷺ أَيُؤَاخَذُ أَحَدُنَا بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ؟ قَالَ مَنْ أَحْسَنَ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْبِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الْإِسْلَامِ أُخِذَ بِالْأَوَّلِ وَالْآخِرِ
[Machine] We said, "O Messenger of Allah, what do you think about what we have done in association (with Allah)? Will we be held accountable for it?" He said, "Whoever excels in Islam will not be held accountable for what they have done in association (with Allah), and whoever does wrong in Islam will be held accountable for what they have done in association (with Allah) and in Islam."
قُلْنَا يَا رَسُولَ اللهِ أَرَأَيْتَ مَا عَمِلْنَا فِي الشِّرْكِ نُؤَاخَذُ بِهِ؟ قَالَ مَنْ أَحْسَنَ مِنْكُمْ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْ بِمَا عَمِلَ فِي الشِّرْكِ وَمَنْ أَسَاءَ مِنْكُمْ فِي الْإِسْلَامِ أُخِذَ بِمَا عَمِلَ فِي الشِّرْكِ وَالْإِسْلَامِ
[Machine] A man said, "O Messenger of Allah, will a person be held accountable for what they did in pre-Islamic times?" He replied, "Whoever does good in Islam will not be held accountable for what they did in pre-Islamic times, and whoever does evil in Islam will be held accountable for both the past and present."
رَجُلٌ يَا رَسُولَ اللَّهِ أَيُؤَاخَذُ الرَّجُلُ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ؟ قَالَ «مَنْ أَحْسَنَ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْ بِمَا كَانَ عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الْإِسْلَامِ أُخِذَ بِالْأَوَّلِ وَالْآخِرِ»
ذِكْرُ الْإِخْبَارِ بِأَنَّ الْمَرْءَ الْمُسْلِمَ يَنْفَعُهُ إخْلَاصُهُ حَتَّى يُحْبِطَ مَا كَانَ قَبْلَ الْإِسْلَامِ مِنَ السَّيِّئَةِ، وَأَنَّ نِفَاقَهُ لَا تَنْفَعُهُ مَعَهُ الْأَعْمَالُ الصَّالِحَةُ
[Machine] A man said, "O Messenger of Allah, will Allah hold us accountable for what we used to do in the time of ignorance?" The Prophet ﷺ said, "Whoever does good in Islam will not be held accountable for what they did in the time of ignorance, and whoever does evil in Islam will be held accountable for both the past and the present."
رَجُلٌ يَا رَسُولَ اللَّهِ أَيُؤَاخِذُ اللَّهُ أَحَدَنَا بِمَا كَانَ يَعْمَلُ فِي الْجَاهِلِيَّةِ؟ قَالَ «مَنْ أَحْسَنَ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الْإِسْلَامِ أُخِذَ بِالْأَوَّلِ وَالْآخِرِ»
A man said, "O Messenger of Allah ﷺ! Shall we be punished for what we did in the Prelslamic Period of ignorance?" The Prophet ﷺ said, "Whoever does good in Islam will not be punished for what he did in the Pre-lslamic Period of ignorance and whoever does evil in Islam will be punished for his former and later (bad deeds). (Using translation from Bukhārī 6921)
قَالَ رَجُلٌ يَا رَسُولَ اللهِ أَنُؤَاخَذُ بِمَا عَمِلْنَا فِي الْجَاهِلِيَّةِ؟ قَالَ مَنْ أَحْسَنَ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الْإِسْلَامِ أُخِذَ بِالْأَوَّلِ وَالْآخِرِ
"مَنْ أَحْسَن فِي الإِسْلامِ لَمْ يُؤاخَذْ بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ، وَمَنْ أَسَاءَ فِي الإِسْلامِ أُخذَ بالأوَّلِ والآخِر".