There is evidence that IQ tends to be higher in those who were heavier at birth or who grew taller in childhood and adolescence. Although these findings imply that growth in both foetal and postnatal life influences cognitive performance, little is known about the relative importance of brain growth during different periods of development. We investigated the relationship between brain growth in different periods of pre- and postnatal life and cognitive function in 221 9-year-old children whose mothers had taken part in a study of nutrition in pregnancy and whose head circumference had been measured at 18 weeks gestation, birth and 9 months of age. Cognitive function of the children and their mothers was assessed with the Wechsler Abbreviated Scale of Intelligence. Full-scale IQ at age 9 years rose by 1.98 points [95% confidence interval (CI) 0.34 to 3.62] for each SD increase in head circumference at 9 months and by 2.87 points (95% CI 1.05 to 4.69) for each SD increase in head circumference at 9 years of age, after adjustment for sex, number of older siblings, maternal IQ, age, education, social class, duration of breastfeeding and history of low mood in the post-partum period. Postnatal head growth was significantly greater in children whose mothers were educated to degree level or of higher socio-economic status. There was no relation between IQ and measurements of head size at 18 weeks gestation or at birth. These results suggest that brain growth during infancy and early childhood is more important than growth during foetal life in determining cognitive function.