The implementation of Environmental, Social, and Governance (ESG) is increasingly becoming a critical concern for energy companies in Indonesia due to demands for sustainability and social legitimacy from various stakeholders. ESG implementation is expected to impact a company's capital structure and liquidity, given the need for external funding to support costly sustainability programs. Furthermore, company size has the potential to moderate the relationship between ESG and capital structure and liquidity, as large companies have higher funding capacity and public exposure than smaller companies. This study employed quantitative methods with secondary data in the form of annual reports of energy companies downloaded from the official website of the Indonesia Stock Exchange. Based on established criteria, 18 energy companies were selected as research samples. The collected data were then analyzed using the classical assumption test, Moderated Regression Analysis (MRA), coefficient of determination (R²), simultaneous significance test (F test), and partial significance test (t test) to determine the influence of independent, moderating, and dependent variables. The results showed that ESG has a positive effect on DER and cash ratio, where its implementation encourages companies to utilize external debt for sustainability activities while strengthening social legitimacy and creditor trust. Firm size has been shown to moderate this relationship, as larger firms have greater funding capacity and exposure, enabling them to manage leverage and liquidity more optimally. This finding is consistent with agency, stakeholder, and legitimacy theories, which emphasize the importance of transparency, accountability, and stakeholder relationships in supporting a company's financial performance.