BackgroundHuman cystic and alveolar echinococcosis are neglected tropical diseases that WHO has prioritized for control in recent years. Both diseases impose substantial burdens on public health and the socio-economy in China. In this study, which is based on the national echinococcosis survey from 2012 to 2016, we aim to describe the spatial prevalence and demographic characteristics of cystic and alveolar echinococcosis infections in humans and assess the impact of environmental, biological and social factors on both types of the disease.MethodsWe computed the sex-, age group-, occupation- and education level-specific prevalences of cystic and alveolar echinococcosis at national and sub-national levels. We mapped the geographical distribution of echinococcosis prevalence at the province, city and county levels. Finally, by analyzing the county-level echinococcosis cases combined with a range of associated environmental, biological and social factors, we identified and quantified the potential risk factors for echinococcosis using a generalized linear model.ResultsA total of 1,150,723 residents were selected and included in the national echinococcosis survey between 2012 and 2016, of whom 4161 and 1055 tested positive for cystic and alveolar echinococcosis, respectively. Female gender, older age, occupation at herdsman, occupation as religious worker and illiteracy were identified as risk factors for both types of echinococcosis. The prevalence of echinococcosis was found to vary geographically, with areas of high endemicity observed in the Tibetan Plateau region. Cystic echinococcosis prevalence was positively correlated with cattle density, cattle prevalence, dog density, dog prevalence, number of livestock slaughtered, elevation and grass area, and negatively associated with temperature and gross domestic product (GDP). Alveolar echinococcosis prevalence was positively correlated with precipitation, level of awareness, elevation, rodent density and rodent prevalence, and negatively correlated with forest area, temperature and GDP. Our results also implied that drinking water sources are significantly associated with both diseases.ConclusionsThe results of this study provide a comprehensive understanding of geographical patterns, demographic characteristics and risk factors of cystic and alveolar echinococcosis in China. This important information will contribute towards developing targeted prevention measures and controlling diseases from the public health perspective.Graphical AbstractSupplementary InformationThe online version contains supplementary material available at 10.1186/s13071-023-05788-z.