(a) It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that when the Prophet (peace and blessings be upon him) entered the toilet, he would say: 'Allahumma inni a'udhu bika min al-khubuthi wa al-khaba'ith' (O Allah, I seek refuge in You from the male and female devils among the jinn).
(b) Abd al-Aziz reports these words: "When he came to the toilet."
(c) Abd al-Aziz also reports these words: "When he intended to enter the toilet."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 452
It is narrated from Sayyiduna Anas (may Allah be pleased with him) that when the Messenger of Allah (peace and blessings be upon him) intended to enter the toilet, he would say: "'A'udhu billahi min al-khubuthi wa al-khaba'ith' (I seek refuge in Allah from the male and female evil ones)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 453
It is narrated from Sayyiduna Zayd bin Arqam (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Devils are present in the toilets. So when any one of you goes to the toilet, let him say: 'A'udhu billahi min al-khubuthi wa al-khaba'ith' (I seek refuge in Allah from the impure male and female jinn)."
(b) Imam Abu Isa al-Tirmidhi (may Allah have mercy on him) asked his teacher Imam Muhammad bin Isma'il al-Bukhari (may Allah have mercy on him): "Which narration is more authentic in your view?" He replied: "Perhaps Qatadah heard it from both of them together," and he did not give any decision on this.
(c) Imam Ahmad (may Allah have mercy on him) said that one chain is like this: 'from Ma'mar, from Qatadah, from al-Nadr bin Anas, from Anas', and this is a mistake by the narrator.
(d) Abu Sulayman (may Allah have mercy on him) read al-khubuth with a dammah on the ba; khubuth is the plural of khabith and khaba'ith is the plural of khabithah, meaning that by these he intended the male and female devils.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 454