QuickLinks -- Click here to rapidly navigate through this document

EXHIBIT 23.1

Consent of Independent Registered Public Accounting Firm

The Board of Directors
2U, Inc.:

We consent to the incorporation by reference in the registration statement (No. 333-207088) on Form S-3 and (Nos. 333-194943 and 333-221964) on Form S-8 of 2U, Inc. of our reports dated February 27, 2018, with respect to the consolidated balance sheets of 2U, Inc. and subsidiaries as of December 31, 2017 and 2016, and the related consolidated statements of operations and comprehensive loss, changes in stockholders' equity, and cash flows for each of the years in the three-year period ended December 31, 2017, and the related notes (collectively, the consolidated financial statements), and the effectiveness of internal control over financial reporting as of December 31, 2017, which reports appear in the December 31, 2017 annual report on Form 10-K of 2U, Inc.

Our report dated February 27, 2018, on the effectiveness of internal control over financial reporting as of December 31, 2017, contains an explanatory paragraph that states that management has excluded from its assessment of the effectiveness of internal control over financial reporting the internal control over financial reporting of Get Educated International Proprietary Limited ("GetSmarter"), which was acquired during the year, and our audit of internal control over financial reporting also excludes an evaluation of the internal control over financial reporting of GetSmarter.

|  | /s/ KPMG LLP

McLean, Virginia
February 27, 2018

QuickLinks

EXHIBIT 23.1

Consent of Independent Registered Public Accounting Firm