BackgroundIntegrating programming in K‐12 curriculum has become a global consensus. Teachers are central figures in programming instruction. But the majority of current research focuses on teachers' external teaching behaviours and less on teachers' attitudes towards programming.ObjectivesThe purpose of this study is to validate the K‐12 in‐service Teacher Programming Attitudes Scale (TPAS), to analyse teachers' programming attitudes and their differences in personal, teaching, and environmental factors, and further explore the predictive relationship.MethodsThe sample is 888 K‐12 teachers from China. First, exploratory factor analysis (EFA) and confirmatory factor analysis (CFA) were adopted to validate the availability and reliability of TPAS; Second, independent sample t‐test and one‐way Analysis of Variance (ANOVA) were adopted to explain the differences. Finally, correlation analysis and linear regression analysis were adopted to verify the correlation and prediction relationship.Results and ConclusionTPAS possess good reliability and validity (χ2/df = 2.488, RMSEA = 0.055, CFI = 0.943, TLI = 0.935, and IFI = 0.943). Further analysis found that, first of all, male teachers possess more positive programming attitudes than female teachers; second, young teachers who are under 30 and the length of teaching under 5 years possess more positive programming attitudes; thirdly, in addition to Information and Communication Technology teachers, primary science teachers also possess high programming attitudes, followed by teachers of Humanities and Arts, reflecting the potential of teaching programming in integrated subjects and the humanities. Finally, primary school teachers possess the best programming attitudes. With the growth of grade, teachers' enthusiasm for programming has gradually decreased. Additionally, discipline, grade and gender factors were considered to predict K‐12 teachers' programming attitudes.ImplicationsThe results of this study contribute to integrating programming teaching of teachers and promoting programming education in K‐12 classrooms.