It is narrated from Sayyidah Aisha (may Allah be pleased with her) that when the Noble Prophet (peace and blessings be upon him) would come out of the toilet, he would say: «غُفْرَانَكَ» … "(O Allah!) I seek Your forgiveness."
Hadith Referenceالفتح الربانی / كتاب الطهارة / 505
Hadith Gradingمحدثین:صحیح
Hadith Takhrij«اسناده حسن ۔ أخرجه ابوداود: 30، والترمذي: 7، وابن ماجه: 300 ، (انظر مسند أحمد ترقيم الرسالة: 25220 ترقیم بيت الأفكار الدولية: 25735»
Brief Explanation
Benefits: … A person entering the toilet may recite only “Bismillah” as well, as is established from the following narration. It is narrated from Sayyiduna Ali ibn Abi Talib radi Allahu anhu that the Messenger of Allah sallallahu alayhi wa sallam said: “The veil between the eyes of the jinn and the private parts of the children of Adam, when one of them enters the toilet, is that he says ‘Bismillah.’” (Tirmidhi: 551, Ibn Majah: 301) The hadith of Ibn Majah in which the following supplication is mentioned for when exiting the toilet: “Alhamdulillah alladhi adhaba ‘anni al-adha wa ‘afani” (“All praise is due to Allah who has removed harm from me and granted me well-being”) is weak. (In the chain of this hadith is a narrator, Isma’il ibn Muslim al-Makki, who has been unanimously declared weak. (See Injaz al-Hajah: 301))