v3.8.0.1
Document and Entity Information - USD ($)
$ in Billions
12 Months Ended
Dec. 31, 2017
Feb. 06, 2018
Jun. 30, 2017
Document And Entity Information [Abstract]      
Document Type 10-K    
Amendment Flag false    
Document Period End Date Dec. 31, 2017    
Document Fiscal Year Focus 2017    
Document Fiscal Period Focus FY    
Trading Symbol TREX    
Entity Registrant Name TREX CO INC    
Entity Central Index Key 0001069878    
Current Fiscal Year End Date --12-31    
Entity Well-known Seasoned Issuer No    
Entity Current Reporting Status Yes    
Entity Voluntary Filers No    
Entity Filer Category Large Accelerated Filer    
Entity Common Stock, Shares Outstanding   29,428,555  
Entity Public Float     $ 2.0