The Shulchan Aruch · Orach Chayim
אורח חיים פ״הOrach Chayim 85
Siman 85 of 697 in Orach Chayim — 2 se'ifim
הלכות קריאת שמעLaws of Reciting Shema· siman 85
Se’if 1א׳
לֹא יֵלֵךְ אָדָם בַּמְּבוֹאוֹת הַמְטֻנָּפוֹת וְיַנִּיחַ יָדוֹ עַל פִּיו וְיִקְרָא קְרִיאַת שְׁמַע, וַאֲפִלּוּ אִם הָיָה קוֹרֵא וּבָא, צָרִיךְ לְהַפְסִיק כְּשֶׁיַּגִּיעַ לְמָבוֹי הַמְטֻנָּף. וּכְשֶׁיּוֹצֵא מִשָּׁם, אֲפִלּוּ שָׁהָה כְּדֵי לִגְמֹר אֶת כֻּלָּהּ, אֵינוֹ צָרִיךְ לַחֲזֹר אֶלָּא לַמָּקוֹם שֶׁפָּסַק הַגָּה: וְיֵשׁ אוֹמְרִים שֶׁחוֹזֵר לְרֹאשׁ, וְכֵן עִקָּר. וְעַיֵּן לְעֵיל סי' ס"ה.
In Which Places is it Forbidden to Recite the Recitation of the Sh'ma, containing 2 s'ifim A person should not go into filthy alleyways and place their hand over their mouth [to prevent them from hearing themselves] and recite the Sh'ma. And even if one was [already] reciting and came [to the alleyway], they must pause when they arrive at the filthy alleyway. And when they come out from there, even if they delayed as long as it would have taken to complete all of it, they do not need to go back [and repeat], except to the place that they paused. Rem"a: And there are some who say that they go back to the beginning, and this is correct ruling (see above Siman 65)
Se’if 2ב׳
אֲפִלּוּ לְהַרְהֵר בְּדִבְרֵי תּוֹרָה, אָסוּר בְּבֵית הַכִּסֵא וּבְבֵית הַמֶּרְחָץ וּבִמְקוֹם הַטִּנֹּפֶת, וְהוּא הַמָּקוֹם שֶׁיֵּשׁ בּוֹ צוֹאָה וּמֵי רַגְלַיִם: הַגָּה: וַאֲפִלּוּ הִלְכוֹת הַמֶּרְחָץ אָסוּר לִלְמֹד בְּמֶרְחָץ (רַ"ן פ' כירה וּבֵית יוֹסֵף בְּשֵׁם א"ח): דְּבָרִים שֶׁל חֹל מֻתָּר לְאָמְרָם שָׁם בִּלְשׁוֹן הַקֹּדֶשׁ, וְכֵן הַכִּנּוּיִים כְּגוֹן רַחוּם, נֶאֱמָן וְכַיּוֹצֵא בּוֹ, מֻתָּר לְאָמְרָם שָׁם. אֲבָל הַשֵּׁמוֹת שֶׁאֵינָם נִמְחָקִין, אָסוּר לְהַזְכִּירָם שָׁם. וְאִם נִזְדַּמֵּן לוֹ שָׁם לְהַפְרִישׁ מִדָּבָר הָאָסוּר, מַפְרִישׁ, וַאֲפִלּוּ בִּלְשׁוֹן הַקֹּדֶשׁ וּבְעִנְיְנֵי קֹדֶשׁ: הַגָּה: וּבְמָקוֹם שֶׁמֻּתָּר לְהַרְהֵר בְּדִבְרֵי תּוֹרָה מֻתָּר לִפְסֹק דִּין, וּבִלְבַד שֶׁלֹּא יֹאמַר טַעֲמוֹ שֶׁל דָּבָר (רַ"ן פ"ק דְּשַׁבָּת וּפֶרֶק כָּל הַצְלָמִים):
Even to consider matters of Torah, is forbidden in the bathroom, and in the bathhouse, and in a filthy place - and this is in a place in which there is excrement or urine. Rem"a: and it is even forbidden to study the laws of the bathhouse in the bathhouse (Ran: Perek "Kirah" and Nimukei Yosef in the name of Orchot Chaim). It is permitted to speak of secular matters in the holy tongue there. And similarly, nicknames [for God] such as Merciful One, Faithful One, and similar, it is permitted to say them there. But the names that may not be erased - it is forbidden to mention them there. And if one happened upon someone there [who is doing something that is prohibited, and they are required] to restrain them from that prohibited matter, they may restrain them, and even using the holy tongue and even regarding holy matters. Rem"a: And in a place that it is permitted to contemplate matters of Torah [but not discuss them], it is permitted to rule in a matter of law as long as one does not say the rationale regarding the matter (Ran Perek 1 of Shabbat and Perek "Kol haTzlamim").
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0