From Abu Hurairah RA, the Prophet PBUH said:
مَنْ صَامَ رَمَضَانَ، إِيمَانًا وَاحْتِسَابًا، غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ
“Whoever fasted the month of Ramadan out of sincere Faith (i.e. belief) and hoping for a reward from Allah, then all his past sins will be forgiven,” Sahih al-Bukhari (38) and Sahih Muslim (760)