Exploring the formation mechanism of farmers' behavioral intention to adopt electricity to replace coal (INT-CE) is important for adjusting energy policies in the context of passive energy transition. Based on the integrated framework of Theory of Planned Behavior (TPB) and Normative Activation Model (NAM), taking farmers in Yulin City, Shaanxi Province as the research sample, the formation mechanism of INT-CE is empirically analyzed using partial least squares structural equation modeling (PLS-SEM). INT-CE was influenced by both self -interested and altruistic motives, with self -interested motives having a greater impact. The results show that: (1) Subjective attitudes and perceived behavior control have significant positive effects on low-income farmers' transformation intention, the influence coefficients are 0.170 and 0.331, respectively. (2) Perceived behavior control has a significant positive impact on the transition intention of middle - income farmers, the coefficient is 0.155. (3) Subjective norms have significant positive impacts on the energy transition intention of high -in- come farmers, the coefficient is 0.261. Attitude has the greatest influence on INT-CE. The effect of past habits on INT-CE was not significant, but was controlled by attitudes and perceptual behaviors. Outcome awareness and responsibility attribution indirectly enhance INT-CE through personal norms. The government should consider farmers' self-interest and altruistic motives when motivating INT-CE. On the one hand, positive concepts of energy conservation should be fostered and farmers' knowledge of energy conservation should be enhanced. On the other hand, the education of farmers should be strengthened to make them realize the ecological damage caused by non -clean energy. At the same time, the influence of relevant groups on INT-CE should be further emphasized to play the role of demonstration and leadership, to enhance farmers' environmental awareness and to cultivate a sense of social responsibility to protect the ecological environment.