We are commanded to write out the verses in Deut. 6:4-9 and 11:13-21 and to attach them to our doorposts (285:1;291:3); this attachment is called a MEZUZAH. The verses must be written on a single sheet (288:1,4), preferably in a single column (288:1-2) and in lines of equal length (288:9). The material and the ink must be the same as those used for a Torah scroll (288:5-7) and the sheet must be ruled (288:8). Small margins must be left on the top and bottom (see 288:1,14). The text must be written in order (288:3) and with the right hand (288:12). It is customary to use 22 lines (288:11) with the last two words at the beginning of the last line (288:10) and with the second passage beginning (after a space) on the last line of the first passage (288:13) and to write the Divine Name Sh-D-Y on the reverse of the sheet opposite this space (see 288:15). A MEZUZAH should be inspected every few years (see 291:1).
The sheet is rolled up from its end and inserted into a tube (with a gap in it to allow the Divine Name to be seen) and the tube is attached to the upright post of the door (289:5), preferably in its outer handsbreadth (285:2;289:2) and at the bottom of its upper third (but at least a handsbreadth below the lintel; see 289:2-3); it must be on the side to the right of a person who is entering (289:2). It is attached to the surface of the doorpost or inserted into a hole less than a handsbreadth deep (289:4). The tube is placed diagonally with the beginning of the text highest and closest to the inside of the doorway (289:6). The person who attaches it first recites the blessing “…Who commanded us to affix a MEZUZAH” (289:1).
Every doorway or gateway must have a MEZUZAH provided it has a lintel and two doorposts that are at least 10 handsbreadths high (287:1-2) and provided it is the entrance to a Jewish-owned space which is used for purposes of dignified living (see 286:1-7,10-12). The space should have an area of at least 16 square cubits (see 286:13) and should be roofed (286:14); opinions differ as to whether it must have a door (286:15). If a space has more than one door each of them requires a MEZUZAH (see 286:8-9,16-18,20-21); on a trapdoor see 286:19. A person who rents a house is required to affix a MEZUZAH (outside the land of Israel: after 30 days; 286:22) and should not take it with him when he leaves unless the house belongs to a non-Jew or the next resident will be a non-Jew; see 286:23 and 291:2.
Shulchan Aruch, Copyright (c) 2000 ProjectGenesis, Inc.