This study investigated the impact of China’s new environmental protection law on the greenwashing of A-share listed companies. By employing the difference-in-differences (DID) method, this study reveals that the EPL exerts a significant inhibitory effect on corporate greenwashing behavior. To ensure the robustness of the results, several tests are conducted, including parallel trend tests, placebo tests, and propensity score matching DID (PSM-DID), all of which confirm the reliability of the findings. This paper explores the influence mechanism of the EPL through constructing the institutional deterrence mechanism, cost effect mechanism, and financing constraint mechanism. It is found that the EPL has a more significant inhibitory effect on economically developed regions, non-high-tech industries, and non-state-owned enterprises. Finally, specific policy recommendations are put forward from macro and micro perspectives.