Abu Hurairah reported,

The Prophet ﷺ said, "Whoever fasts Ramadan out of faith and seeking reward will have his past sins forgiven."Abdullah bin Ahmad said, "My father said, 'I heard it four times from Sufyan. Once he said, "Whoever fasts Ramadan," and once he said, "Whoever stands in prayer." And whoever stands in prayer on Laylat al-Qadr out of faith and seeking reward will have his past sins forgiven.'"

Azami 4310

Sahih

عن أبي هريرة

عن النبي ﷺ: من صام رمضان إيمانا واحتسابا غفر له ما تقدم من ذنبه قال عبد الله بن أحمد: قال أبي: سمعته أربع مرات من سفيان، وقال مرة: من صام رمضان، وقال مرة: من قام، ومن قام ليلة القدر إيمانا واحتسابا غفر له ما تقدم من ذنبه.

الأعظمي 4310صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Fasting
Chapter
Obligation of fasting, its virtue, and its rulings
Section
Virtue of fasting the month of Ramadan
Numbering
Jami al-Kamil 4310 (2nd edition)
Azami 4310