Streptococcus pneumoniae(pneumococcus), a major human pathogen, is well known for its adaptation to various host environments. Multiple DNA inversions in the three DNA methyltransferasehsdSgenes (hsdSA,hsdSB, andhsdSC) of the colony opacity determinant (cod) locus generate extensive epigenetic and phenotypic diversity. However, it is unclear whether all threehsdSgenes are functional and how the inversions mechanistically occur. In this work, our transcriptional analysis revealed active expression ofhsdSAbut nothsdSBandhsdSC, indicating thathsdSBandhsdSCdo not produce functional proteins and instead act as sources for altering the sequence ofhsdSAby DNA inversions. Consistent with our previous finding that thehsdSinversions are mediated by three pairs of inverted repeats (IR1, IR2, and IR3), this study showed that the 15-bp IR1 and its upstream sequence are strictly required for the inversion betweenhsdSAandhsdSB. Furthermore, a single tyrosine recombinase PsrA catalyzes the inversions mediated by IR1, IR2, and IR3, based on the dramatic loss of these inversions in thepsrAmutant. Surprisingly, PsrA-independent inversions were also detected in thehsdSsequences flanked by the IR2 (298 bp) and IR3 (85 bp) long inverted repeats, which appear to occur spontaneously in the absence of site-specific or RecA-mediated recombination. Because the HsdS subunit is responsible for the sequence specificity of type I restriction modification DNA methyltransferase, these results have revealed thatS. pneumoniaevaries the methylation patterns of the genome DNA (epigenetic status) by employing multiple mechanisms of DNA inversion in thecodlocus.IMPORTANCEStreptococcus pneumoniaeis a major pathogen of human infections with the capacity for adaptation to host environments, but the molecular mechanisms behind this phenomenon remain unclear. Previous studies reveal that pneumococcus extends epigenetic and phenotypic diversity by DNA inversions in three methyltransferasehsdSgenes of thecodlocus. This work revealed that only thehsdSgene that is in the same orientation ashsdMis actively transcribed, but the other two are silent, serving as DNA sources for inversions. While most of thehsdSinversions are catalyzed by PsrA recombinase, the sequences bound by long inverted repeats also undergo inversions via an unknown mechanism. Our results revealed thatS. pneumoniaeswitches the methylation patterns of the genome (epigenetics) by employing multiple mechanisms of DNA inversion.