Dioxygenase that catalyzes the conversion of the modified genomic base 5-methylcytosine (5mC) into 5-hydroxymethylcytosine (5hmC) and plays a key role in active DNA demethylation. Has a preference for 5-hydroxymethylcytosine in CpG motifs. Also mediates subsequent conversion of 5hmC into 5-formylcytosine (5fC), and conversion of 5fC to 5-carboxylcytosine (5caC). Conversion of 5mC into 5hmC, 5fC and 5caC probably constitutes the first step in cytosine demethylation. Methylation at the C5 position of cytosine bases is an epigenetic modification of the mammalian genome which plays an important role in transcriptional regulation. In addition to its role in DNA demethylation, also involved in the recruitment of the O-GlcNAc transferase OGT to CpG-rich transcription start sites of active genes, thereby promoting histone H2B GlcNAcylation by OGT. {ECO:0000269|PubMed:19483684, ECO:0000269|PubMed:21057493, ECO:0000269|PubMed:21817016, ECO:0000269|PubMed:23222540, ECO:0000269|PubMed:23353889, ECO:0000269|PubMed:24315485, ECO:0000269|PubMed:32518946}. This is the function of TET2 (tet methylcytosine dioxygenase 2, ENSG00000168769).