There is a positive commandment to set up a mezuzah on every doorpost.  The details as to which doorways, how the mezuzah should be placed, and the bracha are described below.
- 1 Which doorposts require a mezuzah
- 2 Bathrooms and Bedrooms
- 3 How the mezuzah should be placed
- 4 Having one's Mezuzot checked
- 5 The Bracha on putting up a Mezuzah
- 6 Rentals
- 7 Proper behavior when passing a mezuzah
- 8 Women
- 9 Children
- 10 Links
- 11 Sources
Which doorposts require a mezuzah
- Every doorway of one's house is obligated in mezuzah. Even if a room has several doorways, each one is obligated in having a mezuzah, unless a room has one doorway that is used for entering and exiting and one entrances that isn't used for entering or exiting except that it is used sometimes to put packages down there, then the entrance not used for entering or exiting isn't obligated in having a mezuzah. 
- The doorpost of a cellar that is lying flat on the ground is not obligated in having a mezuzah. 
- It is a dispute whether or not the doorway leading into an elevator requires a mezuzah. 
- A doorway is only obligated in a mezuzah if the room has 4 by 4 amot of space. If there's not 4 by 4 square amot but there is the same amount of area, such as 2 by 8 amot, there is a dispute whether the doorway is obligated in a mezuzah. In such a case one should put up a mezuzah without a bracha, or recite a bracha when putting up a mezuzah in a doorway that is obligated and then put up this mezuzah. 
- A doorway is usually obligated in a mezuzah if it has two doorposts that are 10 Tefachim tall and a lintel on top.  Here an exception:
- A roofed porch that has 4 amot by 4 amot of space leading up to a house is obligated in a mezuzah with a bracha. (If the area it surrounds is 16 square amah, one should put up a mezuzah without a bracha.)
- If a doorway only has one doorpost, such as if the lintel is connected to a wall, then if the standing doorpost is on the right, one should put up a mezuzah without a bracha or recite a bracha when putting up a mezuzah in a doorway that is obligated and then put up this mezuzah. If the standing doorpost is on the left, that doorway isn't obligated in a mezuzah.
Bathrooms and Bedrooms
- A mezuzah should not be put up by the doorway to a bathroom, mikveh room, or a room people wash in and stand there undressed.
- A bedroom should have a mezuzah. However, when a couple is together if the mezuzah is on the inside of the door it should be covered.
Shul and Bet Midrash
- A shul doesn't need a mezuzah unless people live in the shul building.
- A bet midrash doesn't need a mezuzah but because some rishonim hold that it should have a mezuzah it is proper to put up a mezuzah on a bet midrash without a bracha. The reason that the bet midrash is different than a shul is since talmidei chachamim use it day and night they consider it like their home.
Offices and Stores
- According to many poskim an office or store is obligated in a mezuzah even if it is only opened by day. However, since some poskim hold that it doesn't require a mezuzah if it isn't used by night in such a case a mezuzah should be put up without a bracha.
- A factory is the same as a store for the purposes of mezuzah.
- Some say that a school requires a mezuzah just as a store does.
Doorways to Courtyards and Cities
- The doorway to a courtyard or city is obligated in having a mezuzah on the right side as one enters.  In a city that has some non-Jews the city gate does not need a mezuzah.
- The electrical posts used for an eruv do not need a mezuzah even though they function as a doorway.
How the mezuzah should be placed
- The mezuzah should be put up on the doorpost which is to one's right upon one's entering the room.  This is true for a left handed person as well. 
- While Sephardim place the mezuzah straight up, Ashkenazim place it on a slant, with the top leaning towards the inside and the bottom towards the outside. 
- The mezuzah should be placed on the outer tefach of the doorpost. 
- One may put up a mezuzah at night.
- If a door is commonly used for both entry and exit then there is a doubt as to which side the mezuzah should be placed upon, but if one side is used for entry more than the other direction, the mezuza should be placed on the right relative to that side. 
- The mezuzah should be placed at the beginning of the upper third of the height of the doorway but it should be placed at least a Tefach from the top of the doorway.  If it is not in the top third it isn't kosher. 
- If a doorway is very tall, according to Ashkenazim, one should put up the mezuzah at shoulder height.  However, according to Sephardim, one should place it in the upper third in all circumstances.
- If the doorway is arched there is a dispute whether the height of the doorposts includes the arched section where the doorway has a width of 4 tefachim. Therefore, if there is a small area which is arched and the doorway has a width of greater than 4 tefachim, it is possible to satisfy both opinions by placing it on the vertical section of the door but still within the top third of the doorway. (For example, if a doorway is 90 inches and the top 12 inches are arched and still has a width of tefachim, one should place the mezuzah in the vertical section above 60 inches.)
Having one's Mezuzot checked
- One should have one's Mezuzot checked by a sofer twice in seven years, or once in every three and a half years, and it is a pious practice to check them every year during Elul.
- If one's mezuzah became wet one should check it immediately.
- The mezuzah's of a publically owned building only need to be checked twice in fifty years.
The Bracha on putting up a Mezuzah
- In general, before putting up a Mezuzah in a doorway that is obligated in a mezuzah, one should recite the bracha. However, if one is putting up a mezuzah on a doorway that doesn't have a door or a doorway that leads into an area that doesn't have 4 by 4 amot square, no bracha is recited.
- Before putting up a mezuzah one should recite the bracha of "Asher Kideshanu Bemizvotav vetzivanu likboah Mezuzah" - " אשר קדשנו במצותיו וצונו לקבוע מזוזה" .  If one puts up several mezuzot at one time one bracha suffices for all of them.  In a situation like this one should be careful not to make a hefsek (pause) between mezuzot by talking.  If one did speak some poskim would require you to say a new beracha. 
- A shehecheyanu isn't recited when putting up a mezuzah on the doorpost. 
- If a mezuzah fell down and one is putting it up again one must recite a bracha before putting it up again if the doorway has a door and the room is at least 4 by 4 amot in size. 
- If one took down one's Mezuzot in order to have them checked by the sofer and they were found to be kosher, according to Ashkenazim one should put them back up without a Bracha of Lekvoh Mezuzah. According to Sephardim, one should make a bracha upon putting them back up after being checked by the sofer. If one checks the mezuzah by himself, he need not say a new beracha.  If a mezuzah was found to be not kosher, then a beracha is recited when it is replaced with a kosher one.  Please note that a bracha is only said when replacing the mezuzah if the doorway has a door and the room is at least 4 by 4 amot in size. (See above #The Bracha on putting up a Mezuzah).
- However, if one took down one's Mezuzah just to put it in a nicer case, one doesn't need to make a new Bracha when putting it up unless it was taken down for several hours so that one stopped thinking about the Mezuzah.
- When replacing the mezuzot, a new beracha is recited. 
- If someone is renting a house in Israel he is obligated to put up a mezuzah with a bracha immediately.  However, if one is renting outside Israel for less than 30 days isn't obligated to put up a mezuzah and if he wishes to be strict to put a mezuzah he should do so without a bracha. If he stays for more than 30 days and he put up a mezuzah previously he should make a bracha upon the mezuzot. Some say that one has to take down the mezuzah and put them up again and some say that one doesn't have to take it down to make a bracha upon it. It is proper to take it down check them and put them back up with a bracha.
- If someone is renting a house for more than 30 days, he is obligated to put up a mezuzah immediately. He does not recite a bracha if he puts it up within 30 days.
Proper behavior when passing a mezuzah
- When one leaves one's house should kiss the mezuzah to remind one of the unity of Hashem, as discussed below. There are different opinions as to how exactly one should behave when passing a mezuzah. 
- When one enters or exits a room one should think about the unity of Hashem, our love for Hashem, and be awakened from the slumber of the vanities of the world. One should think that there's nothing that last forever except knowledge of Hashem, and immediately this will help a person follow the proper path. 
- One should be very careful with the mitzvah of mezuzah because it is a mitzvah that applies to everyone always. 
- Women are obligated in mezuzah. 
- There is a discussion among the poskim if women can ideally place the mezuzot. Many poskim write that it is even ideal for women to put up the mezuzot. 
- Ideally, a child should not place the mezuzah on a doorpost.  Sephardim hold that the child should put up the mezuzah for his doorway and when he becomes bar mitzvah'ed it should be taken down, checked, and put up again with a bracha.
- The doorway to a child's room should have a mezuzah for chinuch.
- In a room where the baby is changed if the mezuzah is on the inside of the door it should be covered.
- Even though it is technically permitted to have a child potty in a room with a mezuzah since the mezuzah is covered and above 10 tefachim it isn't proper to do so.
- Mezuzah on aish.com
- Rambam Sefer HaMitzvot Positive Commandment 15, Sefer HaChinuch Mitzvah 423, Kitzur Shulchan Aruch 11:1 from Devarim 6:9 and 11:20. Shulchan Aruch YD 285:1, Chayei Adam 5:13, Aruch Hashulchan 285:2 say that one should be very meticulous with this mitzva. Tur YD 285 writes based on the pasuk that follows in Parashat Ekev, 11:21, that one who is meticulous in this mitzva merits long life. Bach YD 285 and Aruch Hashulchan YD 285:3 write that a house with a mezuzah has extra protection.
- Maharil (responsa 94) bemoans the fact that many people think that it is sufficient to have one mezuzah per house when in fact every doorway requires its own mezuzah. The Darkei Moshe 286:4 cites the Maharil. Kitzur Shulchan Aruch 11:1 concurs.
- Chaye Adam 15:15 writes that a cellar door on the floor is exempt from mezuzah based on Kiddushin 22b that states that a doorpost lying on the ground isn't considered a doorpost. Kitzur Shulchan Aruch 11:20 concurs.
- Rav Zilberstein (Tuvcha Yabiu - Hilchot Shecheinim 34) says that even if the elevator itself is not 4 by 4 amos- the doorpost from the hallway that leads into the elevator requires a mezuzah. However, Rav Moshe Stern (Be'er Moshe 2:88) says that no matter what an elevator will never require a mezuzah.
- Kitzur Shulchan Aruch 11:10 records a dispute between the Rambam and Rosh on this matter. Shulchan Aruch YD 296:13 writes the opinion of the Rambam that if the room has an area of 4 by 4 amot even if it isn't a square it is obligated in a mezuzah. The Shach 296:23 notes that the opinion of the Rosh is that the doorway isn't obligated unless there is a 4 by 4 amot square area. Due to this dispute, the Shach concludes that one should put up the mezuzah without a bracha or recite a bracha when putting up a mezuzah in a doorway that is obligated and then put up this mezuzah.
- Shulchan Aruch YD 287:1, Kitzur Shulchan Aruch 11:11
- Pitchei Mezuzot 19:10-1 (p. 257), Minchat Yitzchak 3:103, 4:92:3
- HaMezuzah VeHilchoteha 3:10
- Kitzur Shulchan Aruch 11:11, HaMezuzah VeHilchoteha 10:4
- Yoma 11b, Shulchan Aruch YD 286:4, Aruch HaShulchan YD 286:5, Yalkut Yosef 285:43
- Shulchan Aruch YD 285:5
- Yalkut Yosef YD 285:41
- The Gemara Yoma 11a establishes that a shul that no one lives in doesn't need a mezuzah. The Gemara 11b implies that the reason for this is that only a house that belongs to clearly designated owners needs a mezuzah excluding a shul that belongs to the community or public. Tosfot 11b s.v. shein accepts this understanding and says that a privately owned shul would require a mezuzah. He uses this idea to explain the Yerushalmi Megillah which speaks about a mezuzah on a shul unlike the Gemara Yoma and Brachot 47a that assumed that a shul doesn't need a mezuzah. The Rif (Hilchot Mezuzah 6b), Rosh (Mezuzah 6b), and Rambam (Mezuzah 6:6) distinguish between a shul in a city is exempt but in a village it is obligated because most likely people live in the shul building. The Shulchan Aruch YD 286:3 concludes that a shul does not require a mezuzah.
- The Rambam Mezuzah 6:6 writes that a shul doesn't need a mezuzah since it is an area of kedusha. There is a difficulty regarding the Rambam's opinion regarding its source from the Gemara Yoma 11b which seems only to apply this reason to the bet hamikdash. The Chatom Sofer YD 291 however explains that the Rambam means that even though the shechina dwells in the shul it isn't considered as though it is a house used for dwelling since it needs to be used for human dwelling to be obligated in mezuzah.
- The Gemara Yoma 11b treats a shul and bet midrash equally regarding mezuzah. Tosfot Yoma 11b writes that based on Yoma it sounds like there is no obligation to have a mezuzah for a bet midash, but Menachot 33a implies otherwise. Tosfot concludes that if it is privately owned or if it has a door from the bet midrash that opens into someone's private house then that door is obligated in a mezuzah. The Rosh (Mezuzah no. 10) writes that the Maharam Rotenberg learned from the Yerushalmi that a bet midrash should have a mezuzah. He added that a evil spirit bothered him when he slept in the bet midrash during the day until put up a mezuzah. Shulchan Aruch YD 286:10 concludes that a bet midrash does not need a mezuzah but since some say it should have one it is proper to put up one without a bracha. The Shach 286:19 explains that the reason to distinguish between a shul and bet midrash is that the talmidei chachamim live in the bet midrash day and night.
- The Gemara Yoma 10a establishes that according to the rabbis a sukkah does not require a mezuzah since it is a temporary dwelling. The Tur YD 286:11 extends this to a boat and store that are also considered a temporary dwelling which doesn't require a mezuzah. The Shulchan Aruch 286:11 concurs. The Taz 286:10 explains that even if the store is used every day it is exempt since no one lives in it at night. He adds obviously that if someone has a store in their house they require a mezuzah. However, the Perisha 286:22 wonders if store nowadays are exempt since they are permanent. In fact, the Pitchei Teshuva 286:14 cites the Yad Ketana who argues that a store that is set up for a temporary marketplace for a week or so is exempt from a mezuzah, but an established store requires a mezuzah. Yalkut Yosef YD 285:36 agrees. See further Yabia Omer 10 p. 350 and Halichot Olam v. 8 p. 302. Yalkut Yosef writes that a mezuzah should be put up without a bracha because of the dispute but if someone recites a bracha they have what to rely upon.
- Yalkut Yosef YD 285:37
- Yalkut Yosef YD 285:38
- Yoma 12a, Shulchan Aruch YD 286:1, Kitzur Shulchan Aruch 11:2-3
- Yoma 11a. Rama YD 286:1 quoting the Aguda that even if some non-Jews live in the city they are exempt from mezuzah on the city gate. The Taz 286:3 explains that the exemption is based on a danger.
- Chazon Ish YD 172:3 writes that even though the electrical posts with the wires on top can serve as doorways to enclose an eruv for Shabbat (under certain conditions) they do not need a mezuzah since the mezuzah won't be guarded and also some non-Jews might live in the city.
- Gemara Menachot 33b, Rambam Hilchot Mezuzah 6:12, Shulchan Aruch 289:2, Aruch Hashulchan 289:5, Taz 289:3, Levush 289:2, Aruch Hashulchan 289:5, Kitzur Shulchan Aruch 11:3, Kitzur Shulchan Aruch of Rav Mordechai Eliyahu 11:3.
- Mordechai Halachot Ketanot 962, Bach 289:5, Shach 289:5, Levush 289:2, Chayei Adam 15:17, Kitzur Shulchan Aruch 11:3, Aruch Hashulchan 289:5, Kuntres Hamezuzah (page 102, note 22).
- Rashi Menachot 33a s.v. pesula, Shulchan Aruch 289:6, Ben Ish Chai Ki Tavo Year 2 Halacha 7. This was also the minhag of the Gr"a (Biurei Hagra 289:14. Also see Orchos Rabbeinu 1:page 378:27)
- Rabbenu Tam cited by Tosfot Menachot 33a s.v. ha, Rama 289:6, Levush 289:6, Chayei Adam 15:19, Minchas Elazar 1:36:1, Pitchei Mezuzahs 289:57, Chovat Hadar 9:footnote 20. Chovat Hadar 9:footnote 20 explains that the reason for this is that the opinion of Rashi says if you place it sideways it is not kosher, while Rabbenu Tam Menachot 33a s.v. ha holds that if it is straight up it is not kosher, so Ashkenazim try to fulfill the mitzvah according to both opinions.
- Gemara Menachot 32b, Tur 289, Shulchan Aruch 289:2, Levush 289:2, Chayei Adam 15:17, Aruch Hashulchan 289:9. Taz 289:3 writes that the mezuzah is still kosher if the mezuzah isn't on the outer tefach.
- Rav Mordechai Eliyahu (comment on Kitzur Shulchan Aruch 11:10), Ben Ish Chai Parashat Ki Tavo Year 2: Halacha 4, Shevet Hakehati 1:277, Mezuzat Baitecha 289:6, Rivevot Ephraim 7:369.
- Kitzur Shulchan Aruch of Rav Mordechai Eliyahu 11:4
- Kitzur Shulchan Aruch 11:5, Rashi Menachot 33a s.v. “bitechila,” Rambam Hilchot Mezuzah 6:12, Tur 289, Prisha 289:6, Shulchan Aruch 289:2, Levush 289:2, Chayei Adam 15:17, Pitchei Mezuzahs 289:24, Chovat Hadar 8:2:4, Teshuvot Vihanhagot 2:539. See Yabia Omer YD 2:21 where Chacham Ovadia Yosef quotes poskim who say that if it was placed higher than the beginning of the top third it should be moved without a beracha to there, but himself disagrees.
- Tur 289, Shulchan Aruch 289:2, Levush 289:2, Kitzur Shulchan Aruch 11:5
- Beit Yosef 289, Shach 289:4, Taz 289:3.
- Yerushalmi Megillah 4:12, Tosfot Yoma 11b s.v. shein, Shach 289:4
- Yalkut Yosef YD 285:77
- Chovat Hadar (p. 59, n. 35)
- According to the opinion that the arched section is included the mezuzah should be placed at 60 inches (2/3 of 90) and above and according to the opinion that the arched section isn't included the mezuzah should be placed at 52 inches (2/3 of 78) and above. To satisfy both opinions one can place it at 60 inches where the doorpost is still vertical.
- Yoma 11a, Shulchan Aruch YD 291:1, Kitzur Shulchan Aruch 11:25, Yalkut Yosef YD 285:92
- Rav Mordechai Eliyahu (comment on Kitzur Shulchan Aruch 11:22)
- Yoma 11a, Shulchan Aruch YD 291:1
- Shulchan Aruch YD 296:15 writes that a doorway that doesn't have a door is obligated in a mezuzah, however, some disagree. The Shach YD 296:25 writes that because of this dispute one should put up the mezuzah without a bracha, or recite a bracha when putting up a mezuzah in another doorway that is obligated, and afterwards put up this mezuzah as well. Similarly, Shulchan Aruch YD 296:13 writes the opinion of the Rambam that if the room has an area of 4 by 4 amot even if it isn't a square it is obligated in a mezuzah. The Shach 296:23 notes that the opinion of the Rosh is that the doorway isn't obligated unless there is a 4 by 4 amot square area. Due to this dispute, the Shach concludes that one should put up the mezuzah without a bracha or recite a bracha when putting up a mezuzah in a doorway that is obligated and then put up this mezuzah.
- Gemara Menachot 42b, Rambam Hilchot Mezuzah 5:7, Kitzur Shulchan Aruch 11:7, Aruch Hashulchan 289:3
- Kitzur Shulchan Aruch 11:7, Aruch Hashulchan YD 289:4, Shevet Ha’Levi 6:160, Rivevot Ephraim 3:508, Az Nidberu 3:61
- Mezuzat Baitecha 289:6, Rivevot Ephraim 2:29:21, Pitchei Mezuzat 289:10, Kuntres Hamezuzah 289:8
- Chovat Hadar 11:9, Kuntres Hamezuzah 289:8. Mikdash Miat 289:6 and Birchot Habayis 59:1 disagree.
- Chovat Hadar 11:2, Mezuzat Baitecha 289:3
- Kitzur Shulchan Aruch 11:7, Beer Moshe 6:6, Chovat Hadar (11:15:footnote 29), Kuntres Hamezuzah 289:7, Avnei Yashfei 1:207:3-4, Rivevos Ephraim 2:28:5. Orchos Rabbeinu (v. 3, p. 178 #38) however, disagrees.
- Kitzur Shulchan Aruch 11:7 writes that there's a doubt if one should make a bracha if a mezuzah was taken down to check it.
- Yalkut Yosef YD 285:93 writes that one should recite a bracha if they were taken down to be checked by a sofer.
- Ben Ish Chai Parashat Ki Tavo Year 2 Halacha 8, Pitchei Teshuva 289:1, Aruch Hashulchan 289:4, Chovat Hadar 11:14
- Kitzur Shulchan Aruch 11:3,5, Rivevot Ephraim 1:19, Beer Moshe 2:92:13, Kuntres Hamezuzah 289:6, Chovat Hador 11:11:footnote 20, Yabia Omer YD 3:17
- Yalkut Yosef YD 285:94
- Maharam Shik YD 285, Rivevot Ephraim 7:239, Beer Moshe 2:92, Avnei Yashfei 1:207:1, Doleh Umashke (p. 275, footnote 69) quoting Rav Elyashiv and Rav Nissim Karelitz.
- Yalkut Yosef YD 285:114
- Yalkut Yosef YD 285:115
- Yalkut Yosef YD 285:114
- Kitzur Shulchan Aruch 11:24 writes that one should kiss the mezuzah in order to remind oneself of Hashem's unity. Kav HaYashar (ch. 1) writes that touching the mezuzah and offering a short prayer when one leaves one's house affords oneself protection from spiritual dangers. Orchos Rabbeinu (v. 3, p. 164) writes that the Chazon Ish looked at the mezuzah without kissing it when he passed by one.
- Kitzur Shulchan Aruch 11:23
- Kitzur Shulchan Aruch 11:23
- The Gemara Kiddushin 34a explains that since women can also use the reward of long life, written next to the parsha of mezuzah, the mitzvah of mezuzah also applies to them. The same appears in Yoma 11b. This is codified by the Rambam Hilchot Mezuzah 5:10, Shulchan Aruch YD 291:3, and Shach 291:4.
- Shevet Halevi 2:158:3, Kinyan Torah 2:58 and Chovat Hadar 9:3 write that women can put them up even ideally. Rav Hershel Schachter (Be'ikvei HaTzon p. 9) writes that the halacha follows the opinion that says women may put up mezuzot. Beer Moshe 2:100 and 6:79:5 as well as Teshuvot Vihanhagot 4:238:6 write that it is ideal for a man to put up the mezuzot, however, if a women did put them up, it need not be removed.
- Tzitz Eliezer 14:75, Chanoch Lanaar 35:4
- Yalkut Yosef YD 285:15
- Shulchan Aruch YD 291:3
- Yalkut Yosef (Sovah Semachot v. 1 ch. Mekomot Hachayvim Bmezuzah no. 39)
- Yalkut Yosef YD 285:7