In the first place, we would like to make it clear that remembrance of Allah (dhikr) is surely a good and pure act which should not be done in the bathroom. The bathroom is for relieving oneself and answering the call of nature, not for making dhikr.
Here, we cite the fatwa issued by Sheikh Muhammad Saleh Al-Munajjid, a prominent Saudi Muslim scholar and lecturer: There are two types of dhikr: dhikr with the tongue such as reciting Qur’an and du`a’ (supplication), which is encouraged in Shari`ah, and dhikr in the heart, which means thinking of Allah and His greatness and power, or reciting the Qur’an in one’s heart. This does not bring the same reward as reading Qur’an, because the reward has to do with reading, which can only done on the tongue (by moving the tongue and speaking the words). The same applies to du`a’; they should be spoken on the tongue, and it is not sufficient to recite them in the heart.
Muslim scholars differentiated between the two types of dhikr. They said that it is makruh (reprehensible) to remember Allah on the tongue (by speaking) in the bathroom and glorify Allah in that place. With regard to remembering Allah in one’s heart, they said that this is not makruh (reprehensible) and there is nothing wrong with it.
The proof that this distinction is made between the two kinds of dhikr is the fact that the scholars are agreed that it is permissible for a person who is junub (in a state of impurity following sexual activity) to recite Qur’an in his heart, but it is haram (prohibited) for him to recite it out loud or utter it.
An-Nawawi said, “(The scholars) are agreed that if a person who is junub thinks of Qur’an in his heart, without moving his tongue, he is not reciting it in the way that is forbidden for one who is junub.” (Sharh An-Nawawi `ala Sahih Muslim)
Ibn Al-Mundhir said, “`Ikrimah said: A person should not remember Allah on his tongue (by speaking) when he is in the toilet, rather (he should do so) in his heart.” (Al-Awsat)”
In the fatwa of The Standing Committee for Fatwa and Research we read:
“It is part of Islamic etiquette that a person should remember his Lord when he wants to enter the toilet or the bathroom, by saying before he enters: ‘Allahumma inni a`udhu bika min al-khubthi wal-khaba’ith (O Allah, I seek refuge with You from the male and female devils).’ But he should not mention Allah after he enters, rather he should stop mentioning Him after he enters.”
The late Sheikh `Abd Al-`Aziz ibn Baaz, the former Mufti of Saudi Arabia, added:
“Remembering Allah in one’s heart is permissible at all times and in all places, in the washroom and elsewhere. Rather what is makruh (reprehensible) in the washroom and similar places is to remember Allah on one’s tongue (by speaking), except for saying bismillah (in the Name of Allah) when beginning to do wudu’ (ablution). He should say that if it is not easy for him to do wudu’ (ablution) outside the bathroom, because it is obligatory according to some of the scholars, and it is sunnah mu’akkadah (a confirmed Sunnah) according to the majority.