Exhibit 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We hereby consent to the incorporation by reference in registration statements (Form S-8 No. 333- 205396) pertaining to TopBuild Corp. of our report dated June 27, 2023, relating to the statement of net assets available for benefits of Topbuild Corp. 401(k) Plan as of December 31, 2022, the related statement of changes in net assets available for benefits for the year then ended, and the related  December 31, 2022 supplemental schedule of assets (held at end of year), included in this Annual Report on Form 11-K of TopBuild Corp. 401(k) Plan for the year ended December 31, 2022.

/s/  Rehmann Robson LLC

Orlando, Florida

June 27, 2023