Despite the rapid development of the digital economy, its impact on corporate environmental responsibility remains unclear. Drawing on stakeholder theory, we suggest that city digitalization enhances regulatory and social stakeholder governance and, in turn, facilitates local firms’ corporate environmental investment (CEI). Utilizing data from 2,358 Chinese listed firms operating in environmentally sensitive industries from 2014 through 2019, our findings indicate that city digitalization positively affects CEI. Moreover, such positive impact is more pronounced in regions where environmental regulatory or social salience is high, and for firms with high levels of state share or top management team ownership. Our study sheds light on the governance function of digital development and provides valuable insights into how city digitalization helps address environmental challenges in emerging markets.