Sunan Ibn Majah, Volume 1, Book 1, Hadith 301 (DarusSalam)

It was narrated that Anas bin Malik said: "Whenever the Prophet exited the toilet, he would say: 'Al-hamdu lillahilladhi adhhaba 'annial-adha wa 'afani (Praise is to Allah Who has relieved me of impurity and given me good health).'"

حَدَّثَنَا هَارُونُ بْنُ إِسْحَاقَ، حَدَّثَنَا عَبْدُ الرَّحْمَنِ الْمُحَارِبِيُّ، عَنْ إِسْمَاعِيلَ بْنِ مُسْلِمٍ، عَنِ الْحَسَنِ، وَقَتَادَةَ، عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ كَانَ النَّبِيُّ ـ صلى الله عليه وسلم ـ إِذَا خَرَجَ مِنَ الْخَلاَءِ قَالَ ‏ "‏ الْحَمْدُ لِلَّهِ الَّذِي أَذْهَبَ عَنِّي الأَذَى وَعَافَانِي ‏" ‏ ‏.‏

sunnah.com