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.