QuickLinks -- Click here to rapidly navigate through this document

Exhibit 5.1

        September 26, 2018

2U, Inc.
7900 Harkins Road
Lanham, MD 20706

Re:   2U, Inc.
Registration Statement on Form S-3

Ladies and Gentlemen:

        We have acted as special counsel to 2U, Inc., a Delaware corporation (the "Company"), in connection with the registration statement on Form S-3 (the "Registration Statement") to be filed on the date hereof by the Company with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act"). The Registration Statement relates to the issuance and sale by the Company from time to time, pursuant to Rule 415 of the General Rules and Regulations of the Commission promulgated under the Securities Act (the "Rules and Regulations"), of (i) shares of common stock, par value $0.001 per share, of the Company ("Common Stock"), (ii) shares of preferred stock, par value $0.001 per share, of the Company ("Preferred Stock"), which may be issued in one or more series, (iii) debt securities of the Company ("Debt Securities"), which may be issued in one or more series under an indenture (the "Indenture") proposed to be entered into by the Company and the trustee to be named therein, (iv) warrants to purchase shares of Common Stock, shares of Preferred Stock or Debt Securities ("Warrants"), which may be issued pursuant to one or more warrant agreements (each, a "Warrant Agreement") proposed to be entered into by the Company and one or more warrant agents to be named therein, (v) units of the Company ("Units") each consisting of Common Stock, Preferred Stock, Debt Securities or Warrants, or any combination of those securities, which may be issued pursuant to one or more agreements (each, a "Unit Agreement") proposed to be entered into by the Company and one or more unit agents to be named therein, and (vi) such indeterminate number of shares of Common Stock, Preferred Stock and indeterminate amount of Debt Securities as may be issued upon conversion, exchange or exercise, as applicable, of any Preferred Stock, Debt Securities, Warrants or settlement of any Units, including such shares of Common Stock or Preferred Stock as may be issued pursuant to anti-dilution adjustments determined at the time of offering (collectively, "Indeterminate Securities").

        This opinion is being furnished in accordance with the requirements of Item 601(b)(5) of Regulation S-K under the Securities Act.

        In rendering the opinions stated herein, we have examined and relied upon the following:


2U, Inc.
September 26, 2018
Page 2

        We have also examined originals or copies, certified or otherwise identified to our satisfaction, of such records of the Company and such agreements, certificates and receipts of public officials, certificates of officers or other representatives of the Company and others, and such other documents as we have deemed necessary or appropriate as a basis for the opinions stated below.

        In our examination, we have assumed the genuineness of all signatures, including endorsements, the legal capacity and competency of all natural persons, the authenticity of all documents submitted to us as originals, the conformity to original documents of all documents submitted to us as facsimile, electronic, certified or photostatic copies, and the authenticity of the originals of such copies. As to any facts relevant to the opinions stated herein that we did not independently establish or verify, we have relied upon statements and representations of officers and other representatives of the Company and others and of public officials, including those in the General Counsel's Certificate..

        We do not express any opinion with respect to the laws of any jurisdiction other than (i) the laws of the State of New York, and (ii) the General Corporation Law of the State of Delaware (the "DGCL") (all of the foregoing being referred to as "Opined-on Law").

        As used herein, "Transaction Agreements" means the Indenture and the supplemental indentures thereto, the Warrant, the Unit Agreements and any applicable underwriting or purchase agreement.

        The opinions stated in paragraphs 1 through 5 below presume that all of the following (collectively, the "general conditions") shall have occurred prior to the issuance of the Securities referred to therein: (i) the Registration Statement, as finally amended (including all necessary post-effective amendments), has become effective under the Securities Act; (ii) an appropriate prospectus supplement or term sheet with respect to such Securities has been prepared, delivered and filed in compliance with the Securities Act and the applicable Rules and Regulations; (iii) the applicable Transaction Agreements shall have been duly authorized, executed and delivered by the Company and the other parties thereto, including, if such Securities are to be sold or otherwise distributed pursuant to a firm commitment underwritten offering, the underwriting agreement or purchase agreement with respect thereto; (iv) the Board of Directors of the Company, including any duly authorized committee thereof, shall have taken all necessary corporate action to approve the issuance and sale of such Securities and related matters and appropriate officers of the Company have taken all related action as directed by or under the direction of the Board of Directors of the Company; and (v) the terms of the applicable Transaction Agreements and the issuance and sale of such Securities have been duly established in conformity with the certificate of incorporation of the Company so as not to violate any applicable law, the certificate of incorporation of the Company or the bylaws of the Company, or result in a default under or breach of any agreement or instrument binding upon the Company, and so as to comply with any requirement or restriction imposed by any court or governmental body having jurisdiction over the Company.

        Based upon the foregoing and subject to the qualifications and assumptions stated herein, we are of the opinion that:


2U, Inc.
September 26, 2018
Page 3


2U, Inc.
September 26, 2018
Page 4

        The opinions stated herein are subject to the following qualifications:


2U, Inc.
September 26, 2018
Page 5

        In addition, in rendering the foregoing opinions we have assumed that:

        We hereby consent to the reference to our firm under the heading "Legal Matters" in the prospectus forming part of the Registration Statement. We also hereby consent to the filing of this opinion with the Commission as an exhibit to the Registration Statement. In giving this 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. This opinion is expressed as of the date hereof unless otherwise expressly stated, and we disclaim any undertaking to advise you of any subsequent changes in the facts stated or assumed herein or of any subsequent changes in applicable laws.

  Very truly yours,

 

/s/ Skadden, Arps, Slate, Meagher & Flom LLP




QuickLinks