Cuckoos (family Cuculidae) show the highest diversity of breeding strategies within one bird family (parental care, facultative and obligate brood parasites). We used independent contrasts from two phylogenies to examine how this variation was related to 13 ecological and life-history variables. The ancestral state was probably tropical, resident, forest cuckoos with parental care. The evolution of brood parasitism was correlated with a shift to more open habitats, a change in diet, increases in species breeding-range size and migration, and a decrease in egg size. Once parasitism had evolved, more elaborate parasitic strategies (more harmful to host fitness) were correlated with decreased egg size, a change in diet, increased breeding-range size and migration, a shortened breeding season and a decrease in local abundance. Establishing the most probable evolutionary pathways, using the method of Pagel, shows that changes in ecological variables (such as migration, range size and diet type) preceded the evolution of brood parasitism, which is likely to be a later adaptation to reduce the cost of reproduction. By contrast, brood parasitism evolved before changes in egg size occurred, indicating that egg size is an adaptive trait in host--parasite coevolution. Our results suggest that the evolution of cuckoo brood parasitism reflects selection from both ecological pressures and host defences.