1How is a mezuzah written?1 The two portions, Shema and V'hayah im shamo'a, are written on one piece of parchment in a single column.2 Approximately half a fingernail of space3 should be left above and below [the writing].4 Should one write [a mezuzah] in two or three columns, it is acceptable,5 as long as it not written tail-shaped,6 in a circle,7 or tent-shaped.8 If it was written using any of these forms, it is not acceptable.9 If it was not written in order10 - e.g., one wrote the passage [V'hayah im shamo'a] before the passage [Shema] - it is not acceptable. If one writes a mezuzah on two different parchments, it is not acceptable even if they were sewn together [later].11 A mezuzah should not be made from a Torah scroll12 or tefillin that have become worn,13 nor should a mezuzah be written on the empty parchment from a Torah scroll,14 because one should not lower an article from a higher level of holiness15 to a lesser one.16
2It is a mitzvah to leave a space between the passage Shema and the passage V'hayah im shamo'a, as if it were s'tumah.17 If space were left as if it were p'tuchah,18 it is acceptable, since these passages do not follow each other in the Torah.19 One must take care regarding the crowns20 [on the letters] in a mezuzah. The following letters should have crowns.21
3In the first passage, there are seven letters which should each have three zeiynin upon it. They are: The shin and the ayin of [the word] Shema,22 the nun of [the word] nafsh'cha, the two zeiynin of [the word] mezuzot, and the two tettin of the word totafot. In the second passage, there are six letters each of which should have three zeiynin upon it. They are: The gimmel of [the word] d'ganecha, the two zeiynin of [the word] mezuzot, the two tettin of the word totafot, and the tzadi of [the word] ha'aretz. If no crowns were made, or one increased or decreased their number, [the mezuzah] is not invalidated.23 If the mezuzah was not written on ruled [parchment],24 if [the scribe] was not exact with regard to the use of the full or short form [of the words,25 or if [the scribe] added even a single letter inside26 [the mezuzah], it is invalidated.27
4It is a common custom to write [God's name,] Shaddai,28 on the outside of a mezuzah opposite the empty space left between the two passages.29 There is no difficulty in this, since [the addition is made] outside.30 Those, however, who write the names of angels, other sacred names, verses, or forms, on the inside [of a mezuzah] are among those who do not have a portion in the world to come.31 Not only do these fools nullify the mitzvah,32 but furthermore, they make from a great mitzvah [which reflects] the unity of the name of the Holy One, blessed be He, the love of Him, and the service of Him,33 a talisman for their own benefit. They, in their foolish conception, think that this will help them regarding the vanities of the world.34
5It is a mitzvah to write al ha'aretz on the final line [of a mezuzah], either at the beginning or in the middle of the line. It has become universally accepted custom for scribes to write [mezuzot] with 22 lines, with al ha'aretz at the beginning of the final line. These are the letters that appear at the beginning of each line in order: shema, י-ה-ו-ה, hadevarim, l'vanecha, uv'shochbicha, beyn, v'hayah, m'tzaveh, b'chol, yoreh, esev, pen, v'hishtachavitem, hashamayim, va'avad'tem, v'samtem, otam, otam, baderech, uvish'arecha, asher, al ha'aretz.
6When [a mezuzah] is folded,35 it should be rolled from the end of the line to its beginning36 so that when a reader rolls it open, he will be able to read from the beginning of the line to the end.37 After rolling it, one should place it in a tube made of reed, wood, or any other substance and affix it to the doorpost of one's entrance with a nail.38 Alternatively, one should hollow out the doorpost and place the mezuzah within.39
7Before affixing it on the doorpost of the entrance, one should recite the blessing:40 "Blessed are You, God, our Lord, King of the universe, who has sanctified us with His commandments and commanded us to affix a mezuzah." One41 should not recite a blessing when writing [the mezuzah], because affixing it fulfills the mitzvah.42
8If one suspends [a mezuzah] within a pole,43 it is unacceptable, because it has not been affixed.44 If one positions it behind the door, it is as if one has done nothing.45 Should one hollow out the doorpost and place a mezuzah within it horizontally, as the rods were put through the rings [in the Sanctuary],46 it is unacceptable.47 Should one place it deeper than a handbreadth [within the doorpost], it is unacceptable.48 Should one cut a reed in half and insert a mezuzah within, and afterwards connect this reed with other reeds, making a doorpost for the house from them,49 it is unacceptable, because the affixing of the mezuzah preceded the making of the doorpost of the entrance.50
9A mezuzah [placed] on private [property] should be checked51 twice in seven years, and a mezuzah [placed] on public [property]52 should be checked twice in fifty years,53 lest a letter have become torn or faded.54 Since it is affixed within a wall,55 there is the possibility that it will decay.56
10Everyone is obligated [to fulfill the mitzvah of] mezuzah, even women and slaves.57 Minors58 should be educated to affix a mezuzah to [the doors of] their homes.59 A person who rents a dwelling in the diaspora, and a person who rents60 a room in a hotel in Eretz Yisrael, are exempt from the obligation [to affix a] mezuzah for thirty days.61 One who rents a house in Eretz Yisrael, however, is obligated [to affix a] mezuzah immediately.62
11When a person rents a dwelling to a colleague, the tenant is obligated to obtain a mezuzah and affix it.63 [This applies] even if he64 would pay to have it affixed.65 [The rationale is] that a mezuzah is an obligation incumbent on the person dwelling [in the house], and is not incumbent on the house.66 When [the tenant] leaves [the dwelling, however], he should not take it with him67 unless the dwelling belongs to a gentile.68 In that instance, he should remove it when he leaves.69
Sefaria: Mishneh Torah, trans. by Eliyahu Touger. Jerusalem, Moznaim Pub. c1986-c2007 · CC BY-NC · sefaria.org
אהזהיר האדם מהחזיר את גרושתו אחר שנשאת לזולתו. והוא אמרו לא יוכל בעלה הראשון אשר שלחה לשוב לקחתה אחרי אשר הטמאה. והעובר על לאו זה לוקה. והתבארו משפטי מצוה זו במקומות מיבמות. (שם, נשים הלכות גירושין פ"ט):
Sefaria: Sefer HaMitzvot, Warsaw 1883 · Public domain · sefaria.org
אהיא שצונו להיות היבם נושא את אשת אחיו כשמת ולא הניח זרע. והוא אמרו יתעלה יבמה יבא עליה. וכבר התבארו דיני מצוה זו במסכת יבמות. (כי תצא, נשים הלכות יבום וחליצה):
Sefaria: Sefer HaMitzvot, Warsaw 1883 · Public domain · sefaria.org