To investigate whether the effects of in utero exposure to maternal smoking and environmental tobacco smoke (ETS) exposure on lung function vary by sex or asthma status, we examined medical history and tobacco smoke exposure data for 5,263 participants in the Children's Health Study. At study enrollment, parents or guardians of each subject completed a questionnaire, and lung function was measured spirometrically with maximum forced expiratory flow-volume maneuvers. To assess the in utero effects of maternal smoking and ETS exposure on lung function, we used regression splines that accounted for the nonlinear relationship between pulmonary function, height, and age. In utero exposure to maternal smoking was independently associated with deficits in lung function that were larger for children with asthma. Boys and girls with a history of in utero exposure to maternal smoking showed deficits in maximum midexpiratory flow (MMEF) and a decrease in the FEV(1)/FVC ratio. As compared with children without asthma, boys with asthma had significantly larger deficits from in utero exposure in FVC, MMEF, and FEV(1)/FVC, and girls with asthma had larger decreases in FEV(1)/FVC. The effect of ETS exposure varied by children's gender and asthma status. Deficits in flows associated with current ETS exposure were present in children with and without asthma but were significant only among children without asthma. Past ETS exposure was associated with reduced FEV(1), MMEF, and FEV(1)/FVC among boys with asthma. In contrast, past ETS exposure was associated with decreased flow rates in girls without asthma. In summary, both in utero exposure to maternal smoking and ETS exposure were associated with persistent deficits in lung function. The effects of in utero exposure were greatest among children with asthma.