Follow a bad deed with a good one

Fear Allah, follow a sin with a good deed, and treat people well.

Narrated by Abu Dharr and Mu'adh ibn Jabal

Fear Allah wherever you are, follow a bad deed with a good one and it will wipe it out, and treat people with good character.

Jami' at-Tirmidhi 1987

What this hadith teaches

Prayer is one of the good deeds that wipe out sins.

Reference and grade

Grade
Hasan (al-Albani)
Narrator
Abu Dharr and Mu'adh ibn Jabal

The hadith in Arabic نص الحديث

اتَّقِ اللَّهَ حَيْثُمَا كُنْتَ وَأَتْبِعِ السَّيِّئَةَ الْحَسَنَةَ تَمْحُهَا وَخَالِقِ النَّاسَ بِخُلُقٍ حَسَنٍ

Arabic text of Jami' at-Tirmidhi 1987, as given on sunnah.com.