To assess the impact of breast feeding on the risk of obesity and risk of being overweight in children at the time of entry to school. Cross sectional survey Bavaria, southern Germany. Routine data were collected on the height and weight of 134 577 children participating in the obligatory health examination at the time of school entry in Bavaria. In a subsample of 13 345 children, early feeding, diet, and lifestyle factors were assessed using responses to a questionnaire completed by parents. 9357 children aged 5 and 6 who had German nationality. Being overweight was defined as having a body mass index above the 90th centile and obesity was defined as body mass index above the 97th centile of all enrolled German children. Exclusive breast feeding was defined as the child being fed no food other than breast milk. The prevalence of obesity in children who had never been breast fed was 4.5% as compared with 2.8% in breastfed children. A clear dose-response effect was identified for the duration of breast feeding on the prevalence of obesity: the prevalence was 3.8% for 2 months of exclusive breast feeding, 2.3% for 3-5 months, 1.7% for 6-12 months, and 0.8% for more than 12 months. Similar relations were found with the prevalence of being overweight. The protective effect of breast feeding was not attributable to differences in social class or lifestyle. After adjusting for potential confounding factors, breast feeding remained a significant protective factor against the development of obesity (odds ratio 0.75, 95% CI 0.57 to 0.98) and being overweight (0.79, 0.68 to 0.93). In industrialised countries promoting prolonged breast feeding may help decrease the prevalence of obesity in childhood. Since obese children have a high risk of becoming obese adults, such preventive measures may eventually result in a reduction in the prevalence of cardiovascular diseases and other diseases related to obesity.