Exhibit 5.1

June 14, 2022

Hannon Armstrong Sustainable Infrastructure Capital, Inc.

One Park Place, Suite 200

Annapolis, MD 21401

Ladies and Gentlemen:

We have acted as counsel to Hannon Armstrong Sustainable Infrastructure Capital, Inc. (the “Company”) in connection with a registration statement on Form S-3 (the “Registration Statement”) under the Securities Act of 1933, as amended (the “Securities Act”), relating to the sale from time to time by certain selling stockholders of shares (the “Shares”) of common stock, par value $0.01 per share, of the Company (the “Common Stock”) issuable from time to time upon exchange of up to $200 million aggregate principal amount of 0.00% Green Exchangeable Senior Notes due 2025 (the “Notes”) that were issued on April 13, 2022 by HAT Holdings I LLC, a Maryland limited liability company (“HAT I”), and HAT Holdings II LLC, a Maryland limited liability company (“HAT II”, and together with HAT I, the “Issuers”), pursuant to an indenture, dated as of April 13, 2022 (the “Base Indenture”), between the Issuers and the Company, Hannon Armstrong Sustainable Infrastructure, L.P., a Delaware limited partnership (the “Operating Partnership”) and Hannon Armstrong Capital, LLC, a Maryland limited liability company (“HAC,” and collectively with the Company and the Operating Partnership, the “Guarantors”), as guarantors, and U.S. Bank Trust Company, National Association, as trustee (the “Trustee”), as supplemented by a supplemental indenture, dated as of April 13, 2022, between the Issuers, the Guarantors and the Trustee (the “Supplemental Indenture” and, together with the Base Indenture, the “Indenture”).

In rendering the opinion expressed below, we have examined and relied upon originals or copies, certified or otherwise identified to our satisfaction, of such corporate records, documents, certificates and other instruments as in our judgment are necessary or appropriate. In examining all such documents, we have assumed the genuineness of all signatures, the legal capacity of all natural persons, the authenticity of all documents submitted to us purporting to be originals, and the conformity to the respective originals of all documents submitted to us as certified, telecopied, photostatic or reproduced copies or in portable document format. As to certain factual matters relevant to the opinion set forth below, we have, with your permission, relied upon certificates of officers of the Company and public officials.

Based on the foregoing, and such other examination of law and fact as we have deemed necessary, we are of the opinion that, following the issuance of the Shares upon exchange of the Notes in accordance with the the terms of the Notes and the Indenture, the Shares will be legally issued, fully paid, and nonassessable.

The foregoing opinion is based as to matters of law solely on the applicable provisions of the General Corporation Law of the State of Maryland, as currently in effect. We express no opinion as to other laws, statutes, ordinances, rules or regulations and we assume no responsibility for the applicability or effect of such laws, statutes, ordinances, rules or regulations of any other jurisdiction.

This letter has been prepared for your use in connection with the Registration Statement and is based upon the law as in effect and the facts known to us on the date hereof. We have not undertaken to advise you of any subsequent changes in the law or of any facts that hereafter may come to our attention.

We hereby consent to the filing of this opinion with the Securities and Exchange Commission (the “SEC”) as Exhibit 5.1 to the Registration Statement and to the reference to us under the caption “Legal Matters” in the prospectus which is a part of the Registration Statement. In giving such consent, we do not thereby admit that we are within the category of persons whose consent is required under Section 7 of the Securities Act or the rules and regulations of the SEC thereunder.

Very truly yours,

/s/ Clifford Chance US LLP