Exhibit 5.1

Brent B. Siler T: +1 703 456 8058 F: +1 703 456 8100 bsiler@cooley.com | VIA EDGAR

March 17, 2014

2U, Inc.

8201 Corporate Drive, Suite 900

Landover, MD 20785

Ladies and Gentlemen:

We have represented 2U, Inc., a Delaware corporation (the “Company”), in connection with the filing by the Company of a Registration Statement (No. 333-194079) on Form S-1 (the “Registration Statement”) with the Securities and Exchange Commission, including a related prospectus filed with the Registration Statement (the “Prospectus”), covering an underwritten public offering of up to 10,551,250 shares of common stock, which includes (i) up to 8,941,175 shares to be sold by the Company (the “Company Shares”), including 941,175 Company Shares for which the underwriters have been granted an option to purchase, and (ii) up to 1,610,075 shares to be sold by certain selling stockholders (the “Selling Stockholder Shares”), including 435,075 Selling Stockholder Shares for which the underwriters have been granted an option to purchase.

In connection with this opinion, we have examined and relied upon (a) the Registration Statement and related Prospectus, (b) the Company’s Sixth Amended and Restated Certificate of Incorporation, as amended to date and as currently in effect, filed as Exhibit 3.1 to the Registration Statement, (c) the Company’s Second Amended and Restated Bylaws, as currently in effect, filed as Exhibit 3.3 to the Registration Statement, (d) the Company’s Seventh Amended and Restated Certificate of Incorporation, filed as Exhibit 3.2 to the Registration Statement, which will be in effect upon the closing of the offering contemplated by the Registration Statement, (e) the Company’s Third Amended and Restated Bylaws, filed as Exhibit 3.4 to the Registration Statement, which will be in effect upon the closing of the offering contemplated by the Registration Statement, (f) a certificate executed by an officer of the Company to the effect that the consideration for the Selling Stockholder Shares that are issued and outstanding was in fact received by the Company in accordance with the provisions of the applicable resolutions of the Company’s Board of Directors and any plan or agreement relating to the issuance of such shares and (g) the originals or copies certified to our satisfaction of such records, documents, certificates, memoranda and other instruments as in our judgment are necessary or appropriate to enable us to render the opinion expressed below. We have assumed the genuineness and authenticity of all documents submitted to us as originals and the conformity to originals of all documents submitted to us as copies thereof. As to certain factual matters, we have relied upon a certificate of officers of the Company and have not sought to independently verify such matters. Our opinion is expressed only with respect to the General Corporation Law of the State of Delaware.

On the basis of the foregoing, and in reliance thereon, we are of the opinion that the Company Shares and the Selling Stockholder Shares have been duly authorized by the Company; the Company Shares, when sold and issued in accordance with the Registration Statement and the related Prospectus, will be validly issued, fully paid and non-assessable; and the Selling Stockholder Shares are validly issued, duly paid and non-assessable.

We consent to the reference to our firm under the caption “Legal Matters” in the Prospectus included in the Registration Statement and to the filing of this opinion as an exhibit to the Registration Statement.

One Freedom Square, Reston Town Center, 11951 Freedom Drive, Reston, VA 20190-5656 T: (703) 456-8000 F: (703) 456-8100 www.cooley.com

Sincerely, |
COOLEY LLP |
By: | /s/ Brent B. Siler |
| Brent B. Siler |

2