Early life events play a crucial role in the development of irritable bowel syndrome (IBS). Some evidence suggests the phenomenon of cross-organ sensitization between bladder and colon. Whether urinary tract infection (UTI) during infancy is a risk factor of childhood IBS remains to be elucidated. In this retrospective cohort study, we selected 31 788 infants who had UTI between 2000 and 2011 as a UTI cohort and selected 127 152 infants without UTI as a comparison cohort, matched by age, sex and level of urbanization of living area. Incidence density and HRs with CIs of IBS between UTI and non-UTI cohorts were calculated by the end of 2012. The incidence density of IBS during the study period was 1.52-fold higher in the UTI cohort (95% CI 1.38 to 1.67) compared with the non-UTI cohort (2.05 vs 1.32 per 10 000 person-years). The HR of IBS was slightly higher for boys (1.53; 95% CI 1.34 to 1.73) than for girls (1.50; 95% CI 1.29 to 1.73). The HRs for IBS in children with UTI were greater for those with more UTI-related medical visits/per year (>5 visits, HR 61.3; 95% CI 51.8 to 72.6), with longer length of stay of hospitalization (>7 days, HR 1.75; 95% CI 1.36 to 2.24) and with vesicoureteral reflux (VUR) (HR 1.73; 95% CI 1.35 to 2.22) (p<0.0001, the trend test). Infants with UTI had higher risks of childhood IBS and the risks elevated further with recurrent UTI or UTI with concurrent VUR.