Objective: To investigate the duration of breastfeeding in an urban and a rural community in Costa Rica. Methods: A cross - sectional descriptive study on the onset and duration of breastfeeding in children under 5 years of age was carried out. The sample consisted of 92 mothers, 39 girls and 64 boys. To collect the information, a home visit was carried out, where a feeding questionnaire was completed. Results: 83,5% of the children were breastfed in the first two hours after childbirth, increasing to 94.2% after this time, with the rural area showing the highest proportion of cases. Mothers reported exclusively breastfeeding in 78.6% of cases (77.6% and 80,0% in urban and rural areas, respectively). The average duration of exclusive breastfeeding in the studied children is 4.1 ± 2.4 months with a range that ranges from 0 to 8 months of life. Although there are no statistically significant differences according to place of residence, it is observed that the rural community is where children exclusively receive breast milk (4,4 ± 2,1) compared to the urban community (3, 9 ± 2.6). However, only 42.7% of the children reach six months of age with milk from their mothers, with the urban area having the highest proportion of children fed in this way (43.3%), in comparison with the rural area (42,2%). Conclusion: A low percentage of children reach six months of age fed only with their mothers' milk, with the rural area showing greater duration. However, this difference is not statistically significant.

Keywords: Infant feeding, breastfeeding, exclusive breastfeeding, duration, Costa Rica