China ranks 53rd in the list of 81 countries included in the Quality of Death and Dying Index 2021. Cancer is one of the leading causes of death in China. Although the country is highly burdened with cancer, with 4·5 million new diagnoses and more than 3 million cancer deaths in 2020 alone, palliative care services in mainland China are extremely scarce. The aim of this study was to investigate the attitudes of people towards palliative and hospice care, and to analyse the associations between attitudes and potential explanatory variables. A survey was done between July 10, 2021, and Sept 15, 2021. We used a multistage sampling strategy to recruit participants from 120 cities across mainland China. The questionnaire aimed to assess the willingness of respondents to receive palliative care. Survey data were analysed by multiple stepwise linear regression to establish the factors associated with willingness to receive palliative care. Sex, education level, possession of a house, perceived anxiety on the Generalised Anxiety Disorder Assessment scale, perceived pressure, social support (evaluated through the Perceived Social Support Scale), family health (evaluated through the Short-Form Family Health Scale), health literacy (evaluated through the Short-Form Health Literacy Questionnaire), personal sense of health (evaluated through the EuroQol Visual Analogue Scale), self-reported quality of life and sense of health (evaluated trough the EuroQol Five Dimensions Questionnaire), and access to medical insurance were analysed as potential explanatory variables affecting acceptance of palliative care. Standardised regression coefficients (β) were used in multiple stepwise linear regression to reflect the effect of variables on the results. 11 031 respondents completed the survey. The average willingness to accept palliative care was scored at 65·02 points in a visual analogue scale of 0-100 points. Men (β=-0·02) were more likely than women to decline having palliative care. Respondents holding a bachelor's degree or higher (β=0·04), owning more residential properties (two: β=0·02; three or more houses: β=0·01), self-reporting mild perceived anxiety (β=0·03), higher perceived pressure (moderate pressure: β=0·05; severe pressure: β=0·06), or higher scores on the Perceived Social Support Scale (β=0·10), the Short-Form Family Health Scale (β=0·12), the Short-Form Health Literacy Questionnaire (β=0·16), the EuroQol Visual Analogue Scale (β=0·21), the EuroQol Five Dimensions Questionnaire (β=0·05), or with access to medical insurance providing higher reimbursement (employee health insurance and commercial health insurance: β=0·03; government insurance: β=0·04) were more willing to accept palliative care. Sex, house ownership, perceived anxiety, perceived pressure, social support on the Perceived Social Support Scale, and health literacy were the main affecting factors on Chinese residents' acceptance level and attitudes towards palliative care identified by this study, in which we discuss the public acceptance of palliative care on the basis of a nationwide sample from China. Despite some substantial reported outcomes in palliative care, the study is limited by reporting bias and selection bias. The scientific research project of Shaanxi Provincial Education Department, 2021 (grant 21JZ017), and Youth Project of Key Research Bases of Philosophy and Social Sciences in the Sichuan Province (grant YF22-Q13).