PurposeThis paper aims to investigate the direct and indirect relationship between CEO compensation and earnings management using corporate social responsibility (CSR) as a mediating variable.Design/methodology/approachThis study examines 159 French firms listed on the SBF 250 index, encompassing 1,908 firm-year observations from 2011 to 2022, to investigate the relationship between CEO compensation, CSR and earnings management. We used discretionary accruals as the earnings management measure, under the Kothariet al. model (2005). The direct and indirect effects between CEO compensation and earnings management were tested using structural equation model analysis.FindingsThe results reveal that CEO compensation positively influences earnings management. Higher CEO compensation is associated with a greater likelihood of engaging in earnings management practices. CSR was found to partially mediate the relationship between CEO compensation and corporate earnings management. Further analysis indicates that the social and environmental dimensions of CSR contribute significantly to this mediating effect.Research limitations/implicationsThe study's focus on the French institutional context may limit the generalizability of the findings to other regions. In addition, the relatively small sample size, given the limited number of publicly listed firms in France, suggests that extending the study to include other European countries could enhance the robustness of the results.Practical implicationsThe findings have practical implications for companies, policymakers and regulators seeking to curb opportunistic managerial behavior. Regulators can develop policies that promote transparency and ethical financial reporting, leveraging CSR as a governance tool to curb earnings manipulation.Social implicationsThis study highlights the ethical concerns of excessive CEO compensation, which may incentivize earnings management and undermine financial transparency. It emphasizes the need for strong CSR practices, particularly in the social and environmental dimensions, to mitigate these issues and align corporate behavior with societal and sustainability goals.Originality/valueThe originality of this paper lies in its exploration of both direct and indirect relationships between CEO compensation and earnings management, with CSR acting as a mediating variable. Unlike previous studies that have primarily focused on the direct link between CEO compensation and earnings management, this research investigates the potential mediating role of CSR in this relationship. In addition, this study distinguishes itself by examining the impact of the structure of CEO compensation on earnings management. While the existing literature has concentrated on total CEO compensation, the effects of its individual components such as fixed and variable compensation remain underexplored.