Uqba bin Amir reported,

The Messenger of Allah ﷺ said, "The example of one who commits evil deeds and then performs good deeds is like a man wearing a tight coat of mail that is choking him. Then he performs a good deed, and one ring comes loose. Then he performs another good deed, and another ring comes loose, until it falls off onto the ground."

Azami 11393

Hasan

عن عقبة بن عامر قال

قال رسول الله ﷺ: إن مثل الذي يعمل السيئات ثم يعمل الحسنات كمثل رجل كانت عليه درع ضيقة قد خنقته ثم عمل حسنة فانفكت حلقة، ثم عمل حسنة أخرى فانفكت حلقة أخرى حتى يخرج إلى الأرض.

الأعظمي 11393حسن
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Repentance and seeking forgiveness
Chapter
Comprehensive and general supplications
Section
Indeed good deeds remove bad deeds
Numbering
Jami al-Kamil 11393 (2nd edition)
Azami 11393