EX-23 4 d222230dex23.htm EX-23

Exhibit 23

Consent of Independent Registered Public Accounting Firm

We consent to the incorporation by reference in the following Registration Statements:

| • |  | Registration Statements (Form S-8, No. 333-76847, 333-83998, 333-124685, and 333-150690) pertaining to the amended and restated 1999 Stock Option and Incentive Plan (now 2005 Stock Incentive Plan) of Trex Company, Inc., and

| • |  | Registration Statement (Form S-3, No. 333-161732) of Trex Company, Inc.;

of our reports dated February 28, 2022, with respect to the consolidated financial statements and schedule of Trex Company, Inc. and the effectiveness of internal control over financial reporting of Trex Company, Inc. included in this Annual Report (Form 10-K) of Trex Company, Inc. for the year ended December 31, 2021.

/s/ Ernst & Young LLP

Richmond, Virginia

February 28, 2022