Hadithcore
Sahih al-Bukhari, 44
sahih

Narrated Anas:

The Prophet (ﷺ) said, "Whoever said "None has the right to be worshipped but Allah and has in his heart good (faith) equal to the weight of a barley grain will be taken out of Hell. And whoever said: "None has the right to be worshipped but Allah and has in his heart good (faith) equal to the weight of a wheat grain will be taken out of Hell. And whoever said, "None has the right to be worshipped but Allah and has in his heart good (faith) equal to the weight of an atom will be taken out of Hell."

حَدَّثَنَا مُسْلِمُ بْنُ إِبْرَاهِيمَ، قَالَ حَدَّثَنَا هِشَامٌ، قَالَ حَدَّثَنَا قَتَادَةُ، عَنْ أَنَسٍ، عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏"‏ يَخْرُجُ مِنَ النَّارِ مَنْ قَالَ لاَ إِلَهَ إِلاَّ اللَّهُ، وَفِي قَلْبِهِ وَزْنُ شَعِيرَةٍ مِنْ خَيْرٍ، وَيَخْرُجُ مِنَ النَّارِ مَنْ قَالَ لاَ إِلَهَ إِلاَّ اللَّهُ، وَفِي قَلْبِهِ وَزْنُ بُرَّةٍ مِنْ خَيْرٍ، وَيَخْرُجُ مِنَ النَّارِ مَنْ قَالَ لاَ إِلَهَ إِلاَّ اللَّهُ، وَفِي قَلْبِهِ وَزْنُ ذَرَّةٍ مِنْ خَيْرٍ ‏"‏‏.‏ قَالَ أَبُو عَبْدِ اللَّهِ قَالَ أَبَانُ حَدَّثَنَا قَتَادَةُ حَدَّثَنَا أَنَسٌ عَنِ النَّبِيِّ صلى الله عليه وسلم ‏"‏ مِنْ إِيمَانٍ ‏"‏‏.‏ مَكَانَ ‏"‏ مِنْ خَيْرٍ ‏"‏‏.‏

References2 variants
In-Book Reference
Book 2, Hadith 37
USC-MSA web (English) reference
Vol. 1, Book 2, Hadith 43 (deprecated numbering scheme)
Sharh · explanationclick to expand
Allah’s mercy towards His slaves is immense and without limit, and it cannot be fully described. On the Day of Resurrection, Allah will show great generosity to many of His slaves, and he will bring forth from the Fire anyone in whose heart is the smallest amount of goodness and faith. In this hadith, the Prophet (blessings and peace of Allah be upon him) tells us that no one will remain forever in Hell who has in his heart an atom’s weight of faith. If the Muslim who sinned dies without having repented from his sin, it is up to Allah: if He wills, He will pardon him for it, and if He wills, He will punish him, but he will not remain forever in the Fire under any circumstances. Allah will bring forth from the Fire anyone who said La ilaha illa Allah and has in his heart as much as a grain of barley, or a grain of wheat, or even an atom’s weight of goodness, which means faith, as is explained in other reports. That is because goodness, in reality, is that which brings a person closer to Allah (may He be exalted), and that can be nothing other than faith. The word dharrah (translated here as atom) may refer to a small ant, or a speck of dust that may be seen floating in rays of sunlight, like the heads of needles. Barley is mentioned before wheat, because its grains are bigger in size, although they are very similar to one another, and the dharrah is mentioned last because it is so small. This is by way of explaining the issue by using the analogy of increasingly smaller likenesses. This hadith indicates that merely saying La ilaha illa Allah, without there being any faith in the heart, will not benefit a person or bring him forth from the Fire. It also clearly indicates how people may have different levels of faith, and that some of those believers who commit major sins may enter the Fire, but they will not abide therein forever..