كتاب الإيمان
1  
The Book of Faith
(59)
Chapter: If a person thinks of doing a good deed it will be recorded for him, and if he thinks of doing a bad deed it will not be recorded for him
(59)
باب إِذَا هَمَّ الْعَبْدُ بِحَسَنَةٍ كُتِبَتْ وَإِذَا هَمَّ بِسَيِّئَةٍ لَمْ تُكْتَبْ ‏‏
Sahih Muslim 129

Abu Huraira reported that Muhammad, the Messenger of Allah (ﷺ), said:

When it occurs to my bondsman that he should do a good deed but he actually does not do it, record one good to him, but if he puts it into practice, I make an entry of ten good acts in his favour. When it occurs to him to do evil, but he does not commit it, I forgive that. But if he commits it, I record one evil against his name. The Messenger of Allah (ﷺ) observed. The angels said: That bondsman of Yours intends to commit evil. though His Lord is more Vigilant than he. Upon this He (the Lord) said: Watch him; if he commits (evil), write it against his name but if he refrains from doing it, write one good deed or him, for he desisted from doing it for My sake. The Messenger of Allah said: He who amongst you is good of faith, all his good acts are multiplied from ten to seven hundred times (and are recorded in his name) and all the evils that he commits are recorded as such (i, e. without increase) till he meets Allah.
وَحَدَّثَنَا مُحَمَّدُ بْنُ رَافِعٍ، حَدَّثَنَا عَبْدُ الرَّزَّاقِ، أَخْبَرَنَا مَعْمَرٌ، عَنْ هَمَّامِ بْنِ مُنَبِّهٍ، قَالَ هَذَا مَا حَدَّثَنَا أَبُو هُرَيْرَةَ، عَنْ مُحَمَّدٍ، رَسُولِ اللَّهِ صلى الله عليه وسلم فَذَكَرَ أَحَادِيثَ مِنْهَا قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ قَالَ اللَّهُ عَزَّ وَجَلَّ إِذَا تَحَدَّثَ عَبْدِي بِأَنْ يَعْمَلَ حَسَنَةً فَأَنَا أَكْتُبُهَا لَهُ حَسَنَةً مَا لَمْ يَعْمَلْ فَإِذَا عَمِلَهَا فَأَنَا أَكْتُبُهَا بِعَشْرِ أَمْثَالِهَا وَإِذَا تَحَدَّثَ بِأَنْ يَعْمَلَ سَيِّئَةً فَأَنَا أَغْفِرُهَا لَهُ مَا لَمْ يَعْمَلْهَا فَإِذَا عَمِلَهَا فَأَنَا أَكْتُبُهَا لَهُ بِمِثْلِهَا ‏"‏ ‏.‏ وَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ قَالَتِ الْمَلاَئِكَةُ رَبِّ ذَاكَ عَبْدُكَ يُرِيدُ أَنْ يَعْمَلَ سَيِّئَةً - وَهُوَ أَبْصَرُ بِهِ - فَقَالَ ارْقُبُوهُ فَإِنْ عَمِلَهَا فَاكْتُبُوهَا لَهُ بِمِثْلِهَا ‏.‏ وَإِنْ تَرَكَهَا فَاكْتُبُوهَا لَهُ حَسَنَةً - إِنَّمَا تَرَكَهَا مِنْ جَرَّاىَ ‏"‏ ‏.‏ وَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ إِذَا أَحْسَنَ أَحَدُكُمْ إِسْلاَمَهُ فَكُلُّ حَسَنَةٍ يَعْمَلُهَا تُكْتَبُ بِعَشْرِ أَمْثَالِهَا إِلَى سَبْعِمِائَةِ ضِعْفٍ وَكُلُّ سَيِّئَةٍ يَعْمَلُهَا تُكْتَبُ بِمِثْلِهَا حَتَّى يَلْقَى اللَّهَ ‏"‏ ‏.‏
Reference : Sahih Muslim 129
In-book reference : Book 1, Hadith 243
USC-MSA web (English) reference : Book 1, Hadith 235
  (deprecated numbering scheme)