BACKGROUND: Maternal mood disorders and their treatment during pregnancy may have effects on the offspring epigenome. We aim to evaluate associations of maternal prenatal antidepressant use, anxiety, and depression with cord blood DNA methylation across the genome at birth and test for persistence of associations in early and mid-childhood blood DNA. METHODS: A discovery phase was conducted in Project Viva, a prospective pre-birth cohort study with external replication in an independent cohort, the Generation R Study. In Project Viva, pregnant women were recruited between 1999 and 2002 in Eastern Massachusetts, USA. In the Generation R Study, pregnant women were recruited between 2002 and 2006 in Rotterdam, the Netherlands. In Project Viva, 479 infants had data on maternal antidepressant use, anxiety, depression, and cord blood DNA methylation, 120 children had DNA methylation measured in early childhood (~ 3 years), and 460 in mid-childhood (~ 7 years). In the Generation R Study, 999 infants had data on maternal antidepressants and cord blood DNA methylation. The prenatal antidepressant prescription was obtained from medical records. At-mid pregnancy, symptoms of anxiety and depression were assessed with the Pregnancy-Related Anxiety Scale and the Edinburgh Postnatal Depression Scale in Project Viva and with the Brief Symptom Inventory in the Generation R Study. Genome-wide DNA methylation was measured using the Infinium HumanMethylation450 BeadChip in both cohorts. RESULTS: In Project Viva, 2.9% (14/479) pregnant women were prescribed antidepressants, 9.0% (40/445) experienced high pregnancy-related anxiety, and 8.2% (33/402) reported symptoms consistent with depression. Newborns exposed to antidepressants in pregnancy had 7.2% lower DNA methylation (95% CI, - 10.4, - 4.1; P = 1.03 × 10-8) at cg22159528 located in the gene body of ZNF575, and this association replicated in the Generation R Study (β = - 2.5%; 95% CI - 4.2, - 0.7; P = 0.006). In Project Viva, the association persisted in early (β = - 6.2%; 95% CI - 10.7, - 1.6) but not mid-childhood. We observed cohort-specific associations for maternal anxiety and depression in Project Viva that did not replicate. CONCLUSIONS: The ZNF575 gene is involved in transcriptional regulation but specific functions are largely unknown. Given the widespread use of antidepressants in pregnancy, as well as the effects of exposure to anxiety and depression, implications of potential fetal epigenetic programming by these risk factors and their impacts on development merit further investigation.