Intracellular palmitoylation dynamics are regulated by a family of 24 DHHC (aspartate-histidine-histidine-cysteine) palmitoyltransferases, which are localized in a compartment-specific manner. The majority of DHHC proteins localize to endoplasmic reticulum (ER) and Golgi membranes, and a small number target to post-Golgi membranes. To date, there are no reports of the fine mapping of sorting signals in mammalian DHHC proteins; thus, it is unclear how spatial distribution of the DHHC family is achieved. Here, we have identified and characterized lysine-based sorting signals that determine the restricted localization of DHHC4 and DHHC6 to ER membranes. The ER targeting signal in DHHC6 conforms to a KKXX motif, whereas the signal in DHHC4 is a distinct KXX motif. The identified dilysine signals are sufficient to specify ER localization as adding the C-terminal pentapeptide sequences from DHHC4 or DHHC6, which contain these KXX and KKXX motifs, to the C terminus of DHHC3, redistributes this palmitoyltransferase from Golgi to ER membranes. Recent work proposed that palmitoylation of newly synthesized peripheral membrane proteins occurs predominantly at the Golgi. Indeed, previous analyses of the peripheral membrane proteins, SNAP25 and cysteine string protein, are fully consistent with their initial palmitoylation being mediated by Golgi-localized DHHC proteins. Interestingly, ER-localized DHHC3 is able to palmitoylate SNAP25 and cysteine string protein to a similar level as wild-type Golgi-localized DHHC3 in co-expression studies. These results suggest that targeting of intrinsically active DHHC proteins to defined membrane compartments is an important factor contributing to spatially restricted patterns of substrate palmitoylation.