Exhibit 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We hereby consent to the incorporation by reference in the Registration Statements on Form S-8 (No. 333-205395 and 333-205396) of TopBuild Corp. of our report dated February 23, 2023 relating to the financial statements and the effectiveness of internal control over financial reporting, which appears in this Form 10-K.

/s/ PricewaterhouseCoopers LLP

Tampa, FL

February 23, 2023