Background The general public may lack adequate cancer health education, resulting in low cancer awareness and insufficient understanding of the importance of cancer screening. If teachers lack essential health literacy, it not only impairs their own capacity for health promotion but may also negatively affect students' healthy development. Therefore, this study aims to investigate the cognitive level of basic education teachers-specifically, kindergarten, primary, and secondary school teachers-regarding cancer warning symptoms and risk factors, and to analyze the interplay among cancer cognition, cancer fear, e-health literacy, and self-efficacy. Methods From January 14 to November 3, 2022, in-service teachers from basic education schools in Yuxi City, Yunnan Province were selected using judgmental sampling and invited to complete electronic questionnaires. Descriptive statistics and one-way analysis of variance were used to examine the current levels of cancer cognition. A multiple linear regression model was employed to identify the main factors influencing teachers' cancer cognition. Pearson's correlation analysis and a structural equation model were used to explore the interactions among cancer cognition, self-efficacy, e-health literacy, and cancer fear. Results A total of 3,375 teachers participated in the survey. Teachers showed the highest awareness of abnormal masses (79.88%) and the lowest of persistent dyspepsia (45.87%) for warning symptoms. For risk factors, awareness was the highest for spoiled/expired food (90.19%) and the lowest for excessive sun exposure (40.68%). Common influencing factors included cancer symptoms discrimination, active learning of cancer-related knowledge, and gender (P < 0.05). Self-efficacy directly impacted cancer cognition, while cancer fear and e-health literacy moderated this relationship (P < 0.05). Conclusion Basic education teachers have gaps in their knowledge about cancer, and the mechanisms underlying these gaps are relatively complex. Enhancing health education for teachers is essential. It helps improve their knowledge of cancer and overall health literacy. Moreover, it equips them to effectively guide students and their communities in understanding cancer and supporting individuals affected by the disease.