Please wait




picture1.jpg    
                                            EXHIBIT 5.1
September 10, 2025

X4 Pharmaceuticals, Inc.
61 North Beacon Street, 4th Floor
Boston, MA 02134

Re:    X4 Pharmaceuticals, Inc.
Registration Statement on Form S-3

Ladies and Gentlemen:

We have acted as counsel to X4 Pharmaceuticals, Inc., a Delaware corporation (the “Company”), in connection with the preparation and filing with the Securities and Exchange Commission (the “Commission”) of a Registration Statement on Form S-3 (the “Registration Statement”) pursuant to the Securities Act of 1933, as amended (the “Securities Act”), relating to the resale from time to time by the selling stockholders named therein of (i) up to 11,040,776 shares (the “Shares”) of the Company’s common stock, par value $0.001 per share (“Common Stock”), and (ii) 48,852,772 shares of Common Stock (the “Pre-Funded Warrant Shares”) issuable upon the exercise of pre-funded warrants (the “Pre-Funded Warrants”).

In arriving at the opinion expressed below, we have examined originals, or copies certified or otherwise identified to our satisfaction as being true and complete copies of the originals, of the specimen common stock certificates, form of Pre-Funded Warrant and such other documents, corporate records, certificates of officers of the Company and of public officials and other instruments as we have deemed necessary or advisable to enable us to render the opinions set forth below. In our examination, we have assumed without independent investigation the genuineness of all signatures, the legal capacity and competency of all natural persons, the authenticity of all documents submitted to us as originals and the conformity to original documents of all documents submitted to us as copies.

Based upon the foregoing, and subject to the assumptions, exceptions, qualifications and limitations set forth herein, we are of the opinion that (i) the Shares are validly issued, fully paid and non-assessable, and (ii) the Pre-Funded Warrant Shares, when issued upon a valid exercise of the Pre-Funded Warrants in accordance with their terms, will have been duly authorized and validly issued and will be fully paid and non-assessable.

We consent to the filing of this opinion as an exhibit to the Registration Statement, and we further consent to the use of our name under the caption “Legal Matters” in the Registration Statement and the prospectus that forms a part thereof. In giving these consents, 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 Commission.








Very truly yours,

/s/ Gibson, Dunn & Crutcher LLP