The transcription factor cyclic AMP-response element binding protein (CREB) is a key regulator of many neuronal processes, including brain development, circadian rhythm and long-term memory. Studies of CREB have focused on its phosphorylation, although the diversity of CREB functions in the brain suggests additional forms of regulation. Here we expand on a chemoenzymatic strategy for quantifying glycosylation stoichiometries to characterize the functional roles of CREB glycosylation in neurons. We show that CREB is dynamically modified with an O-linked β-N-acetyl-D-glucosamine sugar in response to neuronal activity and that glycosylation represses CREB-dependent transcription by impairing its association with CREB-regulated transcription coactivator (CRTC; also known as transducer of regulated CREB activity). Blocking glycosylation of CREB alters cellular function and behavioral plasticity, enhancing both axonal and dendritic growth and long-term memory consolidation. Our findings demonstrate a new role for O-glycosylation in memory formation and provide a mechanistic understanding of how glycosylation contributes to critical neuronal functions. Moreover, we identify a previously unknown mechanism for the regulation of activity-dependent gene expression, neural development and memory.