Background Poor growth during infancy and childhood is a characteristic feature of cystic fibrosis (CF). However, the impact of CF on intrauterine growth is unclear. We studied the effect of CF on birth weight in Denmark and Wales, and assessed whether any associations are due to differences in gestational age at birth. Methods We conducted national registry linkage studies in two countries, using data for 2.2 million singletons born in Denmark (between 1980 and 2010) and Wales (between 1998 and 2015). We used hospital inpatient and outpatient data to identify 852 children with CF. Using causal mediation methods, we estimated the direct and indirect (via gestational age) effect of CF on birth weight after adjustment for sex, parity and socioeconomic background. We tested the robustness of our results by adjusting for additional factors such as maternal smoking during pregnancy in subpopulations where these data were available. Results Babies with CF were more likely to be born preterm and with low birth weight than babies with no CF (12.7% vs 5% and 9.4% vs 5.8% preterm; 11.9% vs 4.2% and 11% vs 5.4% low birth weight in Denmark and Wales, respectively). Using causal mediation methods, the total effect of CF on birth weight was estimated to be ?178.8 g (95% CI ?225.43 to ?134.47 g) in the Danish population and ?210.08 g (95% CI ?281.97 to ?141.5 g) in the Welsh population. About 40% of this effect of CF on birth weight was mediated through gestational age. Conclusions CF significantly impacts on intrauterine growth and leads to lower birth weight in babies with CF, which is only partially explained by shorter gestation.