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-8

Ladies and Gentlemen:

We have examined the Registration Statement on Form S-8 (the “Registration Statement”) of X4 Pharmaceuticals, Inc., a Delaware corporation (the “Registrant”), to be filed with the Securities and Exchange Commission (the “Commission”) pursuant to the Securities Act of 1933, as amended (the “Securities Act”), in connection with the offering by the Registrant of up to 12,746,450 shares of its common stock, par value $0.001 per share (the “Common Stock”), under the Registrant’s Amended and Restated 2019 Inducement Equity Incentive Plan (as amended, the “Inducement Plan”).

In arriving at the opinions 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 Plan and such other documents, corporate records, certificates of officers of the Registrant and of public officials and other instruments as we have deemed necessary or advisable to enable us to render these opinions. 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. As to any facts material to these opinions, we have relied to the extent we deemed appropriate and without independent investigation upon statements and representations of officers and other representatives of the Registrant and others. We have also assumed without independent investigation that there are no agreements or understandings between or among the Registrant and any participants in the Inducement Plan that would expand, modify or otherwise affect the terms of the Inducement Plan or the respective rights or obligations of the participants thereunder.

Based upon the foregoing examination and in reliance thereon, and subject to the assumptions stated and in reliance on statements of fact contained in the documents that we have examined, we are of the opinion that the shares of Common Stock issuable under the Inducement Plan, when issued and sold in accordance with the terms of the Inducement Plan and against payment therefor, and when the Registration Statement has become effective under the Securities Act, will be validly issued, fully paid and non-assessable.

We render no opinion herein as to matters involving the laws of any jurisdiction other than the Delaware General Corporation Law (the “DGCL”). We are not admitted to practice in the State







of Delaware; however, we are generally familiar with the DGCL as currently in effect and have made such inquiries as we consider necessary to render the opinions above. This opinion is limited to the effect of the current state of the law of the DGCL and the facts as they currently exist. We assume no obligation to revise or supplement this opinion in the event of future changes in such law or the interpretations thereof or such facts.

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 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 promulgated thereunder.

Very truly yours,

/s/ Gibson, Dunn & Crutcher, LLP

Gibson, Dunn & Crutcher, LLP