Where Is It Permissible to Recite Brachot?
Chazal learn from the pasuk "והיה מחניך קדוש" "Your camp should be holy" that when Hashem's presence is with us, such as when one is involved with a dvar shebekedusha, such as kriyat shema, tefillah, or learning Torah, one must make sure that one's area is clean, meaning, that there isn't any unclad area of a person or revealed feces where one is. The details of what is considered an unclad area of the body and what is considered feces are described below.
Learning or Thinking Torah in Unclean Areas
In a Bathroom or Bathroom
- It is forbidden to learn Torah or recite Brachot in a bathroom. The poskim say that this is also true with modern bathrooms.
- It is permitted to recite a bracha outside a bathroom even if the door is open.
- One may speak Hebrew in the bathroom, but it is a pious practice not to. 
- It is forbidden to learn or think Torah in a bathhouse. Even in the changing room next to the bathing room one may not learn Torah but one may think Torah. If there's no one unclothed in the changing room at the time there is a dispute if one may recite brachot there.
In Front of Feces or Urine
- It is forbidden to recite or even think words of Kedusha in an area where there is uncovered urine, human feces, or something that stinks.  One may not learn in front of human feces as far as one can see it and if it is on the side or behind oneself it is permitted to recite words of Kedusha if one is 4 amot from where it doesn't smell.
- If urine was absorbed into the ground or clothing, if there still is a moisture to the urine, one may not learn next to it unless it was diluted with a Reviyit of water.
- If there is feces on one's body, one may not involve oneself in Divrei Kedusha even if it is covered.
- If a baby soiled a diaper but they are still wearing it if you don't smell it the feces are considered covered and it is permitted to learn or make brachot nearby.
- It is permitted to daven in front of a urine catheter though the tube through which the urine goes through should be covered and preferably the bag of urine should be covered as well.
In Another Room
- If feces are in a small room it is permitted to learn Torah in the large room attached to the small room even if one is within 4 amot. Even if one can see the feces it is permitted to learn Torah but it is preferable to be strict to turn away. Even if the feces are in another room it is an issue if one can still smell the feces.
- If there are feces in a large room then it is forbidden to learn Torah even in the small room attached to it until one distances oneself as though it was in the same room.
- If feces are outside it is permitted to learn Torah inside the house as long as one can't smell them.
- Unlike human feces where it is forbidden to learn Torah as long as one can see the feces unless it is behind oneself when one can learn Torah if one is 4 amot from where it smells, for animal feces it is permitted to learn Torah as long as one is 4 amot from where it smells even if one can see it.
- It is permitted to recite brachot in front of dog or pig feces as long as where one is standing 4 amot from where the smell stops. # Feces of cats are like human feces in that it is forbidden to recite a bracha in front of oneself as far as one can see and behind oneself 4 amot.
- One can't say any dvar shebekedusha near a bad smelling garbage even if there isn't any feces in it if the smell is a result of anything that is a result of decay or decomposition.
In Front of an Unclad Person
- If an area of one Tefach on a part of a woman's body that is usually covered is exposed, including a married woman's hair, it is considered nakedness regarding which it is forbidden to involve oneself in Divrei Kedusha. Areas that may be exposed (unless there is a local custom to be more strict) are the face, hands, and legs up to the knee.
- If one is facing such a woman, according to Sephardim, he may close his eyes or turn his head, in order to recite a bracha. According to some Ashkenazim, he must turn all the way around. Other Ashkenazic poskim hold that turning around is only necessary when one is facing the actual Ervah (unlike areas which are only covered because of local practice, such as forearms and forelegs) of a woman, but in the case of a Tefach of skin or hair, closing one's eyes or turning his head is sufficient.  Regarding learning Torah, Ashkenazim are lenient to allow learning if one closes one's eyes or turns away one's face.
- If one sees an image of an improperly dressed woman on television, even though she herself is not physically present, he may not make a bracha while looking at her and must follow the above protocol.
If One is Improperly Dressed
- If someone is wearing an undergarment that covers one's private area even if he isn't wearing other garments, strictly speaking one may recite kriyat shema, brachot, or Torah but he can't daven Shemona Esrei. However, unless it is an extenuating circumstance one should wear respectful clothing for kriyat shema, brachot or Torah.
- If there's no separation between one's heart and one's nakedness one may not recite a bracha or learn Torah. For example, if someone is wearing a loose robe or another piece of clothing that doesn't separate between one's heart and one's private area one may not recite a bracha or learn Torah.
- If a person is standing in water unclothed with his head out of the water he needs to create a separation between his heart and his nakedness in order to recite a bracha. This can be accomplished by covering one's private area with a towel. Alternatively, if one wraps one's arms around one's chest and heart that can serve as a barrier between one's private area and one's heart. Yet merely using one's hand to cover one's chest doesn't serve as a barrier between one's heart and one's nakedness. Lastly, kicking up the water is effective only if the floor is a dirt floor but if it is tiled and the water is clear kicking up the water doesn't suffice.
- Some say that there's no issue for a woman regarding the issue of her heart seeing her nakedness. Therefore, a woman would be allowed to recite a bracha while in the mikveh with their private area underwater and head out of the water. Additionally, a woman can recite a bracha while wearing a loose robe.
- If someone is standing with just their private part in the water while their heart and head are out of the water one can recite a bracha. One should be careful that one's eyes don't see one's erveh while one is reciting the bracha.
- It doesn't matter if any other part of one's body besides the heart and eyes are in view of one's private area, but if any part of the body is touching the private area one may not recite a bracha or learn Torah.
For a man if his organ is touching his legs he shouldn't say brachot but after the fact the bracha counts.
Definition of Divrei Kedusha
- For the purposes of learning or reciting anything of Kedusha before Ervah, in a bathroom or near feces, this includes Kriyat Shema, Tefillah, learning Torah, brachot, or anything of kedusha.
- It is equally forbidden whether it is in Hebrew or any other language.
- One should avoid performing mitzvot in a bathroom as doing so would be disgraceful, however, if there's no other option, such as giving someone who asks for tzedaka, it is permitted.
- Devarim 23:15
- Shabbat 150a, Brachot 25a, Kitzur Shulchan Aruch 5:1
- Gemara Brachot 26a, Shulchan Aruch 83:4
- Igrot Moshe EH 1:114
- Igrot Moshe EH 1:114
- Shulchan Aruch 85:2, Mishna Brurah 85:9
- In the days of chazal there were three chambers of a bathhouse; the outermost room was used for rinsing and sweating, the middle one for changing and lounging, and the inner one for bathing. The gemara Shabbat 10a explains that it is forbidden to learn Torah in either the middle or inner rooms. That is codified in Shulchan Aruch 84:1. Rama adds that thinking Torah is permitted in the middle room and not the inner one.
- Is learning in the middle room permitted if no one unclothed there? Bet Yosef 45:2 implies it is permitted and Bach 84:1 says forbidden. The Mishna Brurah 84:3 cites the dispute between the Bach and Bet Yosef. Perisha 45:2, Taz 84:2 (as understood by Mishna Brurah 84:3), Shulchan Aruch Harav 84:1, and Magen Giborim S”G 84:2 are strict. Magen Avraham 45:2, Eliya Rabba 84:1, Birkei Yosef 85:10, Maharsham in Daat Torah 84:1, and Bet Yehuda OC 10 are lenient. Taharat Habayit v. 3 p. 232-3 is lenient. He writes that it seems to be a dispute between Rashi who is lenient and the Meiri.
- Shulchan Aruch 85:2, Kitzur Shulchan Aruch 5:2
- Rav Chisda in brachot 25a holds that one needsd to distance from feces 4 amot from where the smell stopped. The Rosh (Brachot 3:46) and Rif Brachot 16b hold like Rav Chisda while the Rambam (Kriyat Shema 3:12) held like Rav Huna that as long as one can't smell it is permitted to learn Torah. Shulchan Aruch 79:1 holds like the Rosh and Rif.
- Rava in Brachot 25a states that if the feces is in front of oneself one can't say Shema even if it is far away. The Rambam (Kriyat Shema 3:8) writes that having the feces on one's side is the equivalent to having it behind oneself. Shulchan Aruch 79:1 accepts the Rambam.
- Rosh Brachot 3:46, Tur and Shulchan Aruch 79:1
- Yerushalmi Brachot 3:5, Rosh Brachot 3:46, Tur and Shulchan Aruch 79:1
- Kitzur Shulchan Aruch 5:2
- Kitzur Shulchan Aruch 5:3
- Rav Hershel Schachter (Brachot Shiur 56 around min 85)
- The Gemara Eruvin 92a establishes that if there's feces in a small room attached to a big room it is permitted to learn Torah in the big room. The reason is that the larger room which isn't completely open to the small room is a separate domain and one doesn't have to be concerned with the feces. This is codified by the Rosh Brachot 3:46, Tur and Shulchan Aruch 79:3.
- The Rosh Brachot 3:46 understands that since the feces are in another domain it is permitted to learn Torah even if one can see them. However, the Rashba Brachot 25a argues that even one can see the feces it is always forbidden to learn. Bet Yosef 79:2 rules that the halacha follows the Rosh but it is preferable to be strict for the Rashba.
- Rambam Kriyat Shema 3:9 writes that even if feces are in another domain it is still an issue if one can smell them. The Rabbenu Yonah 16b s.v. vim writes that some disagree with the Rambam since it is in another domain. Shulchan Aruch 79:2 holds like the Rambam.
- Eruvin 92a, Rosh Brachot 3:46, Tur and Shulchan Aruch 79:3
- Shulchan Aruch 79:2
- The Gemara Brachot 25a establishes that it is permitted to say Kriyat Shema next to dog or pig feces unless they are mixed with hides. Additionally, the Yerushalmi Brachot 3:5 concludes that the only animal feces are only an issue for Kriyat Shema in a few cases including a donkey, pig, and chicken. Tur and Shulchan Aruch 79:4 conclude that in general one can say Kriyat Shema next to animal feces. Nonetheless, the Tur adds that one can't say Kriyat Shema if one can still smell it. Bet Yosef explains that the Tur is based on the halacha of nevelah and if so it really means you need to distance yourself 4 amot from the smell stops. The Maharalbach (Chidushei Hagahot 79:1) argues that animal feces are like passing gas and as long as it doesn't smell where one is it is permitted even if it is within 4 amot. Olot Tamid 79:8 agrees with Bet Yosef as Shulchan Aruch rules.
- Brachot 25a establishes that dog and pig feces are only an issue if they are mixed with hides when it smell profusely. Tur 79:4 adds that one should still distance oneself to a place where it doesn't smell. Bet Yosef 79:4 explains that the Tur compared it to a rotting carcass where one needs to distance oneself 4 amot from where the smell stops. Shulchan Aruch 79:4 codifies this halacha.
- Rosh Brachot 3:46 writes that one needs to distance oneself from cat feces since it is smelly like human feces.
- Mishna Brurah 79:29 citing Levush. Rav Schachter (Brachot Shiur 56 beginning) commented that you need to distance from rotting food and vomit but not from a naturally occurring bad smelling chemical like sulfur.
- Shulchan Aruch 75:1
- Mishna Brurah 75:2
- Shulchan Aruch 75:6, Mishna Brurah 75:29, Yechave Daat 2:5
- Mishna Brurah 75:29
- Mishna Brurah 75:1
- Rav Shlomo Zalman Auerbach (Byitzchak Yikra 84:1 cited by Dirshu 75:1) explained that learning Torah is less severe than davening and it is permitted to rely on the Rambam that closing one's eyes is sufficient.
- Yechave Daat 4:7 writes that she does not physically have to be present, because the whole prohibition is in place to prevent one from having inappropriate thoughts, which are all too possible when watching an improperly dressed woman on TV. Of course, one must be wary, as to bringing TV into ones home in the first place, which exposes one's children to a great variety of inappropriate content and inhibits their ability to grow as good wholesome Jewish children.
- Gemara Brachot 25a, Shulchan Aruch 74:6
- Mishna Brurah 74:22
- The Gemara Brachot 25b cites a dispute if a person's heart "sees" his nakedness whether he may recite Kriyat Shema. Tosfot s.v. vehari writes the while Rabbenu Shemaya held that it was permitted the Ri disagreed. Rif Brachot 16b, Rambam Kriyat Shema 2:7, and Rosh 3:50 hold like the Ri that it is forbidden to say Kriyat Shema in such a state. Shulchan Aruch 74:1 codifies that opinion.
- Rabbenu Yonah 16b s.v. aval explains that there are two issues with making a bracha unclothed; one is that one's eyes can't be in view of ervah and the second is that one's heart can't be in view of one's ervah. However, since one's nakedness is underwater and one's eyes aren't, the ervah is considered in a different domain from one's eyes. Yet, the issue of his heart seeing the ervah continues to exist. That is solved by kicking up the water so that the water is murky, by covering one's ervah with a towel, or by pressing one's a arms against one's chest to create a barrier between the heart and ervah. Shulchan Aruch 74:2-3 holds that holding one's hands against one's chest isn't a solution for creating one's heart seeing one's ervah, but wrapping one's arms around one's chest is sufficient. Mishna Brurah 73:13 explains that one's hands can cover one's heart because one's own body doesn't count as a covering but wrapping one's arms around one's chest which is an abnormal way to hold oneself it is a sufficient barrier. Mishna Brurah 74:11 quotes the Magen Avraham who holds that kicking up the water is a solution as the Gemara Brachot 25b describes only if there is dirt on the floor and kicking up the water and dirt will make the water unclear but if the water is clear and floor is tiled then kicking up water doesn't help. However, the Mishna Brurah concludes by citing the Or Zaruah that it is effective to kick up the water even if the water is clear and the floor is tiled. Aruch Hashulchan 74:12 holds like the Magen Avraham.
- Shulchan Aruch 74:4 citing the Orchot Chaim. Shach YD 200:1 writes that the minhag follows this opinion.
- Rama 74:2 writes that since the water serves as a barrier between one's private area and one's heart or eyes if one only has one's private area in the water with one's heart and head out one could recite a bracha even if the water is clear. Pri Chadash 74:2 argues vehemently that this isn't a solution if the water is clear. Mishna Brurah 74:13 and Aruch Hashulchan 74:12 accept the Rama. Mishna Brurah just adds that obviously one may not look at one's ervah while reciting the bracha.
- Gemara Brachot 25b, Shulchan Aruch 74:5
- Mishna Brurah 74:20
- Mishna Brurah 76:2 writes that it is obvious that for all purposes of saying Torah in a place of Ervah, bathroom, or feces it is equally applicable whether it is learning Torah, reciting Shema, Tefillah, or anything of Kedusha. Aruch Hashulchan 76:1 adds brachot as another example. Regarding not saying Torah in a bathroom, the Rambam (Kriyat Shema 3:4) writes that Kriyat Shema is the same as any other divrei kedusha and even thinking Torah in a bathroom is forbidden. He says the same for a place that is unclean because of feces or urine.
- However, the Tosfot (Eruvin 64a s.v. shikor) and Rosh Eruvin 6:5 have a doubt whether reciting Brachot are treated like davening Tefillah near feces after the fact. The Ramban (Brachot 22b) clarifies that Tosfot never even considered if it is permitted to recite a bracha near feces. That is obviously forbidden. In fact, any Torah, bracha, tefillah, shema, or concept of Torah ("Inyan Shel Torah") is forbidden Biblically as the Torah says "והיה מחניך קדש" and doesn't specify Shema or Tefillah, so obviously it also applies to brachot. Rather Tosfot was in doubt regarding after the fact if the bracha in a dirty counts or needs to be said again. Even on that point, the Ramban writes that it is clear that one doesn't fulfill one's obligation even after the fact and there's no distinction between brachot and any other Torah. The only distinction that is relevant is that it is forbidden to recite shema near someone who passed gas but permitted to learn Torah. The Ramban writes that this is only because learning near passed gas is only rabbinic and chazal didn't want their enactment to cause people not to learn Torah but it would be forbidden to recite brachot or say shema near the gas. He concludes with the Yerushalmi Trumot 6:1 that it is forbidden to recite brachot near ervah. The Shulchan Aruch 185:5 cites the Tosfot but the Mishna Brurah 185:7 cites the Ramban.
- Mishna Brurah 76:2
- Biur Halacha 588:2 s.v. shema quotes the Mateh Efraim that one shouldn't do any mitzvot in a disgraceful place such as a bathroom or in front of feces. He explains that either it is because since one needs kavnaa for a mitzvah that is similar to think of Torah. Also, he says it is disgraceful to do mitzvot in a dirty a place. Dirshu 76:1 quotes Halichot Shlomo (Tefillah Dvar Halacha 2:36) who writes that this is only initially that one shouldn't do mitzvot in such a place but if one is going to miss the opportunity otherwise one can do the mitzvot there. Also, they quote Rav Chaim Kanievsky (Derech Emunah Maaser 9:51) that it only applies to a obligatory mitzvah but a mitzvah that is optional can be done in a bathroom. Rav Nevinsal (on Biur Halacha 1:1) writes that shouldn't think about the six mitzvot temidiyot in the bathroom since it is disgraceful. (See also Bikkurei Yakov 644:1 who writes that performing any mitzvah requires Birchat Hatorah which is similar to the first explanation of the Biur Halacha.)