Praise be to Allah.
1 – There are two types of dhikr: dhikr with the tongue such as reciting Qur’aan and du’aa’s, which is encouraged in sharee’ah, and dhikr in the heart, which means thinking of Allaah and His greatness and power, or reciting the Qur’aan in one’s heart. This does not bring the same reward as reading Qur’aan, 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’aa’; they should be spoken on the tongue and it is not sufficient to recite it in the heart.
The scholars differentiated between the two types of dhikr. They said that it is makrooh to remember Allaah on the tongue (by speaking) in the bathroom and glorify Allaah in that place. With regard to remembering Allaah in one's heart, they said that this is not makrooh 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’aan in his heart, but it is haraam for him to recite it out loud or utter it.
(The scholars) are agreed that if a person who is junub thinks of Qur’aan in his heart, without moving his tongue, he is not reciting it in the way that is forbidden for one who is junub.
Sharh al-Nawawi ‘ala Saheeh Muslim, 4/103
Ibn al-Mundhir said in al-Awsat:
‘Ikrimah said: A person should not remember Allaah on his tongue (by speaking) when he is in the toilet, rather (he should do so) in his heart.
The Standing Committee said:
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: “Allaahumma inni a’oodhu bika min al-khubthi wa’l-khabaa’ith (O Allaah, I seek refuge with You from the male and female devils).” But he should not mention Allaah after he enters, rather he should stop mentioning Him after he enters.
Fataawa al-Lajnah al-Daa’imah, 5/93
Shaykh ‘Abd al-‘Azeez ibn Baaz said:
Remembering Allaah in one's heart is permissible at all times and in all places, in the washroom and elsewhere. Rather what is makrooh in the washroom and similar places is to remember Allaah on one’s tongue (by speaking), except for saying Bismillaah when beginning to do wudoo’. He should say that if it is not easy for him to do wudoo’ 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.
Fataawa al-Shaykh Ibn Baaz, 5/408
And Allaah knows best.