Objectives To analyse the relation between selective serotonin reuptake inhibitor (SSRI) use and major congenital malformations, with focus on malformations of the heart. Design Register-based retrospective nationwide cohort study, using the Danish Medical Birth Registry. Setting Denmark. Participants Pregnant women in Denmark between 1997 and 2009 and their offspring. Primary outcome measures For each SSRI, ORs for major congenital malformations were estimated using multivariable logistic regression models for women exposed to an SSRI during the first trimester and for women with paused exposure during pregnancy. Results The authors identified 848 786 pregnancies; 4183 were exposed to an SSRI throughout the first trimester and 806 pregnancies paused exposure during pregnancy. Risks of congenital malformations of the heart were similar for pregnancies exposed to an SSRI throughout the first trimester, adjusted OR 2.01 (95% CI 1.60 to 2.53), and for pregnancies with paused SSRI treatment during pregnancy, adjusted OR 1.85 (95% CI 1.07 to 3.20), p value for difference: 0.94. The authors found similar increased risks of specific congenital malformations of the heart for the individual SSRIs. Furthermore, the authors found no association with dosage. Conclusions The apparent association between SSRI use and congenital malformations of the heart may be confounded by indications. The moderate absolute risk increase combined with uncertainty for causality still requires the risk versus benefit to be evaluated in each individual case.