The aim of the study was to identify determinants of exclusive breastfeeding (EBF) at the individual, family, community, and organizational level. This study was a secondary analysis of data from a multilevel promotion of EBF program in two rural public health centers (PHCs) in the Demak district, Central Java, Indonesia. The program was a quasi-experimental study with a pretest-posttest control group. A total of 599 participants were enrolled, consisting of 163 mother infant pairs, 163 fathers, 163 grandmothers, 82 community leaders, and 28 midwives. EBF duration and its determinants were measured and analyzed using Cox proportional-hazard model. Mothers with a high level of breastfeeding knowledge had the greatest EBF duration. Mothers who had a knowledge score >80 had a 73 % (HR 0.27, 95 % CI 0.15, 0.48) greater chance of EBF compared to mothers who had a knowledge score of <60. Factors which shortened EBF duration were grandmother's lack of support for EBF (HR 2.04, 95 % CI 1.33, 3.14), received formula samples at discharge (HR 1.99, 95 % CI 1.25, 3.16), and maternal experience of breast engorgement (HR 1.97, 95 % CI 1.32, 2.94). High maternal breastfeeding knowledge was the only factor associated with longer duration of EBF. Barriers to EBF were breast engorgement, receiving formula samples at discharge, and a grandmother's lack of support for EBF.