Protein palmitoylation is the most common posttranslational lipid modification; its reversibility mediates protein shuttling between intracellular compartments. A large family of DHHC (Asp-His-His-Cys) proteins has emerged as protein palmitoyl acyltransferases (PATs). However, mechanisms that regulate these PATs in a physiological context remain unknown. In this study, we efficiently monitored the dynamic palmitate cycling on synaptic scaffold PSD-95. We found that blocking synaptic activity rapidly induces PSD-95 palmitoylation and mediates synaptic clustering of PSD-95 and associated AMPA (alpha-amino-3-hydroxy-5-methyl-4-isoxazole propionic acid)-type glutamate receptors. A dendritically localized DHHC2 but not the Golgi-resident DHHC3 mediates this activity-sensitive palmitoylation. Upon activity blockade, DHHC2 translocates to the postsynaptic density to transduce this effect. These data demonstrate that individual DHHC members are differentially regulated and that dynamic recruitment of protein palmitoylation machinery enables compartmentalized regulation of protein trafficking in response to extracellular signals.