Heparan sulfate (HS) is a linear polysaccharide that plays a key role in cellular signaling networks. HS functions are regulated by its 6-O-sulfation, which is catalyzed by three HS 6-O-sulfotransferases (HS6STs). Notably, HS6ST2 is mainly expressed in the brain and HS6ST2 mutations are linked to brain disorders, but the underlying mechanisms remain poorly understood. To determine the role of Hs6st2 in the brain, we carried out a series of molecular and behavioral assessments on Hs6st2 knockout mice. We first carried out strong anion exchange-high performance liquid chromatography and found that knockout of Hs6st2 moderately decreases HS 6-O-sulfation levels in the brain. We then assessed body weights and found that Hs6st2 knockout mice exhibit increased body weight, which is associated with abnormal metabolic pathways. We also performed behavioral tests and found that Hs6st2 knockout mice showed memory deficits, which recapitulate patient clinical symptoms. To determine the molecular mechanisms underlying the memory deficits, we used RNA sequencing to examine transcriptomes in two memory-related brain regions, the hippocampus and cerebral cortex. We found that knockout of Hs6st2 impairs transcriptome in the hippocampus, but only mildly in the cerebral cortex. Furthermore, the transcriptome changes in the hippocampus are enriched in dendrite and synapse pathways. We also found that knockout of Hs6st2 decreases HS levels and impairs dendritic spines in hippocampal CA1 pyramidal neurons. Taken together, our study provides novel molecular and behavioral insights into the role of Hs6st2 in the brain, which facilitates a better understanding of HS6ST2 and HS-linked brain disorders.