v3.19.2
Document and Entity Information - shares
6 Months Ended
Jun. 30, 2019
Jul. 11, 2019
Document and Entity Information [Abstract]    
Amendment Flag false  
Document Fiscal Year Focus 2019  
Document Type 10-Q  
Document Quarterly Report true  
Document Fiscal Period Focus Q2  
Entity Central Index Key 0001069878  
Current Fiscal Year End Date --12-31  
Document Transition Report false  
Entity Registrant Name TREX CO INC  
Document Period End Date Jun. 30, 2019  
Entity Current Reporting Status Yes  
Entity Interactive Data Current Yes  
Trading Symbol TREX  
Entity Shell Company false  
Entity Filer Category Large Accelerated Filer  
Entity Small Business false  
Entity Emerging Growth Company false  
Entity Common Stock, Shares Outstanding   58,424,677
Entity File Number 001-14649  
Entity Incorporation, State or Country Code DE  
Entity Tax Identification Number 54-1910453  
Entity Address, Address Line One 160 Exeter Drive  
Entity Address, City or Town Winchester  
Entity Address, Postal Zip Code 22603-8605  
Entity Address, State or Province VA  
City Area Code 540  
Local Phone Number 542-6300  
Title of 12(b) Security Common stock  
Security Exchange Name NYSE