Abstract With the rapid advancement of the “dual carbon” goals, the impact of green credit is receiving increasing attention. This study investigates the influence of green credit on the performance of commercial banks, using panel data from 42 Chinese commercial banks (2007–2022). The empirical results show that green credit significantly enhances the performance of commercial banks, with this effect being more pronounced in non-state-owned banks or under higher regulatory pressure. Furthermore, mechanism testing reveals that the debt-to-assets ratio (DAR) and cost-income ratio (CIR) play a positive moderating role in the impact of green credit on the commercial banks’ performance. This study enhances the understanding of the relationship between green credit and commercial banks’ efficiency by providing new insights into ownership structures, regulatory pressures and some financial indicators like DAR and CIR. Besides, this study provides empirical evidence for how commercial banks can utilize green credit to improve their performance and offers valuable policy references regarding green credit and the performance of commercial banks for policymakers, such as introducing supportive policies for green credit targeted at commercial banks and establishing a sound financial monitoring system.