Short answer
Talking while relieving yourself is makruh (disliked) in all four schools, not haram, and speaking for a real need is fine. Eating in the toilet is also disliked. Using your phone on the toilet is not haram, but do not read or play Quran or dhikr there, and do not linger.
Speaking while relieving oneself is makruh except for need, such as warning someone. Eating or drinking in the toilet is makruh, as it goes against dignity and cleanliness. Reciting the Quran or saying dhikr aloud there is makruh.
The four schools agree on this.
Explanation
A man passed by while the Prophet ﷺ was urinating and greeted him, and he did not return the greeting. From this and similar reports, scholars teach that the toilet is a place for quiet: no greetings, no dhikr out loud, and no chatting while you relieve yourself.
Hanafi guidance:
- Talking: makruh while relieving yourself. Necessary words, like telling a child not to come in or calling for help, are fine.
- Salam: do not greet or reply while relieving yourself; greet the person when you come out.
- Eating or drinking: makruh in the toilet. Food belongs elsewhere.
- Phone: not haram, but scrolling on the toilet keeps you there longer than needed. Do not read or play Quran or dhikr while relieving yourself.
- Music: has its own ruling; the bathroom does not make it better.
Modern bathrooms combine the toilet with a shower and sink. The manners of the toilet apply most strongly while you are relieving yourself. Brushing your teeth or washing at the sink is lighter, but keep the same respect, and say your duas before going in or after coming out.
For the duas, see dua for entering and leaving the bathroom. For the Quran, see reciting Quran in the bathroom. The four schools agree that talking there is disliked and not forbidden.
The evidence
Sahih Muslim 370
Sahih... مر ورسول الله صلى الله عليه وسلم يبول فسلم فلم يرد عليه ...
"A man passed by while the Messenger of Allah was urinating and greeted him, and he did not return the greeting."
Speech, even returning salam, is held back while relieving oneself.
Where the ruling is recorded
- Nur al-Idah with Maraqi al-Falah, Kitab al-Taharah, section on what is disliked when relieving oneself. Speaking while relieving oneself is disliked.
- al-Majmu' (Nawawi), Kitab al-Taharah, chapter on the manners of relieving oneself. Speech while relieving oneself is disliked.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.