Background Malar melasma has a chronic and recurrent character that may be related to epigenetic changes. Objective To recognize the expression and DNA methylation of DNA methyltransferases (DNMTs) in malar melasma and perilesional skin, as well as the changes in DNMTs after their treatment with sunscreen in combination with 4% niacinamide, 0.05% retinoic acid, or placebo. Methods Thirty female patients were clinically evaluated for the expression of DNMT1 and DNMT3b using real-time PCR and immunofluorescence. These initial results were compared to results after eight weeks of treatment with sunscreen in combination with niacinamide, retinoic acid, or placebo. Results The relative expression of DNMT1 was significantly elevated in melasma compared with unaffected skin in all subjects, indicating DNA hypermethylation. After treatment, it was decreased in all groups: niacinamide (7 versus 1; p<0.01), retinoic acid (7 versus 2; p<0.05), and placebo (7 versus 3; p<0.05), which correlates with clinical improvement. DNMT3b was not overexpressed in lesional skin but reduced in all groups. Conclusions We found DNA hypermethylation in melasma lesions. Environmental factors such as solar radiation may induce cellular changes that trigger hyperpigmentation through the activation of pathways regulated by epigenetic modifications. However, limiting or decreasing DNA methylation through sunscreen, niacinamide, and retinoic acid treatments that provide photoprotection and genetic transcription can counteract this.