<?xml version="1.0" encoding="utf-8"?>
<!--Generated by DFIN XBRL Instance Document - http://www.dfinsolutions.com/ - Version R3.0 - on 27-April-2019 [01:03:11] {AM}-->
<linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd">
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#ConsolidatedStatementsOfComprehensiveIncome" roleURI="http://www.trex.com/role/ConsolidatedStatementsOfComprehensiveIncome" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#ConsolidatedBalanceSheets" roleURI="http://www.trex.com/role/ConsolidatedBalanceSheets" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#ConsolidatedStatementsOfCashFlows" roleURI="http://www.trex.com/role/ConsolidatedStatementsOfCashFlows" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#InventoriesSummaryOfInventoriesDetail" roleURI="http://www.trex.com/role/InventoriesSummaryOfInventoriesDetail" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail" roleURI="http://www.trex.com/role/PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#GoodwillAndOtherIntangibleAssetsDetailsOfIntangibleAssetsDetail" roleURI="http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsDetailsOfIntangibleAssetsDetail" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail" roleURI="http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#LeasesSupplementalCashFlowInformationToOperatingLeasesDetails" roleURI="http://www.trex.com/role/LeasesSupplementalCashFlowInformationToOperatingLeasesDetails" />
<roleRef xlink:type="simple" xlink:href="trex-20190331.xsd#LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails" roleURI="http://www.trex.com/role/LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails" />
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/ConsolidatedStatementsOfComprehensiveIncome">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ComprehensiveIncomeNetOfTax" xlink:label="loc_us-gaap_ComprehensiveIncomeNetOfTax" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_NetIncomeLoss" xlink:label="loc_us-gaap_NetIncomeLoss" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_ComprehensiveIncomeNetOfTax" xlink:to="loc_us-gaap_NetIncomeLoss" use="optional" order="109000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" xlink:label="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetIncomeLoss" xlink:to="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" use="optional" order="107000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingIncomeLoss" xlink:label="loc_us-gaap_OperatingIncomeLoss" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" xlink:to="loc_us-gaap_OperatingIncomeLoss" use="optional" order="105000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_GrossProfit" xlink:label="loc_us-gaap_GrossProfit" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingIncomeLoss" xlink:to="loc_us-gaap_GrossProfit" use="optional" order="103000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_GrossProfit" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax" use="optional" order="101000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_CostOfGoodsAndServicesSold" xlink:label="loc_us-gaap_CostOfGoodsAndServicesSold" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_GrossProfit" xlink:to="loc_us-gaap_CostOfGoodsAndServicesSold" use="optional" order="102000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_SellingGeneralAndAdministrativeExpense" xlink:label="loc_us-gaap_SellingGeneralAndAdministrativeExpense" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingIncomeLoss" xlink:to="loc_us-gaap_SellingGeneralAndAdministrativeExpense" use="optional" order="104000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InterestIncomeExpenseNet" xlink:label="loc_us-gaap_InterestIncomeExpenseNet" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" xlink:to="loc_us-gaap_InterestIncomeExpenseNet" use="optional" order="106000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncomeTaxExpenseBenefit" xlink:label="loc_us-gaap_IncomeTaxExpenseBenefit" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetIncomeLoss" xlink:to="loc_us-gaap_IncomeTaxExpenseBenefit" use="optional" order="108000" weight="-1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/ConsolidatedBalanceSheets">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LiabilitiesAndStockholdersEquity" xlink:label="loc_us-gaap_LiabilitiesAndStockholdersEquity" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_StockholdersEquity" xlink:label="loc_us-gaap_StockholdersEquity" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesAndStockholdersEquity" xlink:to="loc_us-gaap_StockholdersEquity" use="optional" order="114000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PreferredStockValue" xlink:label="loc_us-gaap_PreferredStockValue" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_StockholdersEquity" xlink:to="loc_us-gaap_PreferredStockValue" use="optional" order="109000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_CommonStockValue" xlink:label="loc_us-gaap_CommonStockValue" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_StockholdersEquity" xlink:to="loc_us-gaap_CommonStockValue" use="optional" order="110000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AdditionalPaidInCapitalCommonStock" xlink:label="loc_us-gaap_AdditionalPaidInCapitalCommonStock" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_StockholdersEquity" xlink:to="loc_us-gaap_AdditionalPaidInCapitalCommonStock" use="optional" order="111000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_RetainedEarningsAccumulatedDeficit" xlink:label="loc_us-gaap_RetainedEarningsAccumulatedDeficit" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_StockholdersEquity" xlink:to="loc_us-gaap_RetainedEarningsAccumulatedDeficit" use="optional" order="112000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_TreasuryStockValue" xlink:label="loc_us-gaap_TreasuryStockValue" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_StockholdersEquity" xlink:to="loc_us-gaap_TreasuryStockValue" use="optional" order="113000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_Liabilities" xlink:label="loc_us-gaap_Liabilities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesAndStockholdersEquity" xlink:to="loc_us-gaap_Liabilities" use="optional" order="106000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LiabilitiesCurrent" xlink:label="loc_us-gaap_LiabilitiesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Liabilities" xlink:to="loc_us-gaap_LiabilitiesCurrent" use="optional" order="3779430" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AccountsPayableCurrent" xlink:label="loc_us-gaap_AccountsPayableCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent" xlink:to="loc_us-gaap_AccountsPayableCurrent" use="optional" order="127000" weight="1" />
<loc xlink:type="locator" xlink:href="trex-20190331.xsd#trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:label="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent" xlink:to="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" use="optional" order="128000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_StandardProductWarrantyAccrualCurrent" xlink:label="loc_us-gaap_StandardProductWarrantyAccrualCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent" xlink:to="loc_us-gaap_StandardProductWarrantyAccrualCurrent" use="optional" order="129000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LinesOfCreditCurrent" xlink:label="loc_us-gaap_LinesOfCreditCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LiabilitiesCurrent" xlink:to="loc_us-gaap_LinesOfCreditCurrent" use="optional" order="130000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_DeferredTaxLiabilitiesNoncurrent" xlink:label="loc_us-gaap_DeferredTaxLiabilitiesNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Liabilities" xlink:to="loc_us-gaap_DeferredTaxLiabilitiesNoncurrent" use="optional" order="103000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_StandardProductWarrantyAccrualNoncurrent" xlink:label="loc_us-gaap_StandardProductWarrantyAccrualNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Liabilities" xlink:to="loc_us-gaap_StandardProductWarrantyAccrualNoncurrent" use="optional" order="104000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OtherLiabilitiesNoncurrent" xlink:label="loc_us-gaap_OtherLiabilitiesNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Liabilities" xlink:to="loc_us-gaap_OtherLiabilitiesNoncurrent" use="optional" order="105000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingLeaseLiabilityNoncurrent" xlink:label="loc_us-gaap_OperatingLeaseLiabilityNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Liabilities" xlink:to="loc_us-gaap_OperatingLeaseLiabilityNoncurrent" use="optional" order="102000" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/ConsolidatedBalanceSheets">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_Assets" xlink:label="loc_us-gaap_Assets" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AssetsCurrent" xlink:label="loc_us-gaap_AssetsCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets" xlink:to="loc_us-gaap_AssetsCurrent" use="optional" order="126000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_CashAndCashEquivalentsAtCarryingValue" xlink:label="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent" xlink:to="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue" use="optional" order="122000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AccountsReceivableNetCurrent" xlink:label="loc_us-gaap_AccountsReceivableNetCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent" xlink:to="loc_us-gaap_AccountsReceivableNetCurrent" use="optional" order="123000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InventoryNet" xlink:label="loc_us-gaap_InventoryNet" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent" xlink:to="loc_us-gaap_InventoryNet" use="optional" order="124000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:label="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_AssetsCurrent" xlink:to="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" use="optional" order="125000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PropertyPlantAndEquipmentNet" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentNet" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentNet" use="optional" order="118000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IntangibleAssetsNetIncludingGoodwill" xlink:label="loc_us-gaap_IntangibleAssetsNetIncludingGoodwill" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets" xlink:to="loc_us-gaap_IntangibleAssetsNetIncludingGoodwill" use="optional" order="119000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OtherAssetsNoncurrent" xlink:label="loc_us-gaap_OtherAssetsNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets" xlink:to="loc_us-gaap_OtherAssetsNoncurrent" use="optional" order="121000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingLeaseRightOfUseAsset" xlink:label="loc_us-gaap_OperatingLeaseRightOfUseAsset" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_Assets" xlink:to="loc_us-gaap_OperatingLeaseRightOfUseAsset" use="optional" order="120000" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/ConsolidatedStatementsOfCashFlows">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect" xlink:label="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:label="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect" xlink:to="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" use="optional" order="109000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInAccountsReceivable" xlink:label="loc_us-gaap_IncreaseDecreaseInAccountsReceivable" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInAccountsReceivable" use="optional" order="120000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInInventories" xlink:label="loc_us-gaap_IncreaseDecreaseInInventories" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInInventories" use="optional" order="121000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets" xlink:label="loc_us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets" use="optional" order="122000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInAccountsPayable" xlink:label="loc_us-gaap_IncreaseDecreaseInAccountsPayable" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInAccountsPayable" use="optional" order="123000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInAccruedLiabilitiesAndOtherOperatingLiabilities" xlink:label="loc_us-gaap_IncreaseDecreaseInAccruedLiabilitiesAndOtherOperatingLiabilities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInAccruedLiabilitiesAndOtherOperatingLiabilities" use="optional" order="124000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncreaseDecreaseInIncomeTaxesPayableNetOfIncomeTaxesReceivable" xlink:label="loc_us-gaap_IncreaseDecreaseInIncomeTaxesPayableNetOfIncomeTaxesReceivable" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_IncreaseDecreaseInIncomeTaxesPayableNetOfIncomeTaxesReceivable" use="optional" order="125000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_DepreciationDepletionAndAmortization" xlink:label="loc_us-gaap_DepreciationDepletionAndAmortization" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_DepreciationDepletionAndAmortization" use="optional" order="101000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ShareBasedCompensation" xlink:label="loc_us-gaap_ShareBasedCompensation" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_ShareBasedCompensation" use="optional" order="103000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_GainLossOnSaleOfPropertyPlantEquipment" xlink:label="loc_us-gaap_GainLossOnSaleOfPropertyPlantEquipment" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_GainLossOnSaleOfPropertyPlantEquipment" use="optional" order="104000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ProfitLoss" xlink:label="loc_us-gaap_ProfitLoss" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInOperatingActivities" xlink:to="loc_us-gaap_ProfitLoss" use="optional" order="106000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_NetCashProvidedByUsedInInvestingActivities" xlink:label="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect" xlink:to="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities" use="optional" order="113000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PaymentsToAcquirePropertyPlantAndEquipment" xlink:label="loc_us-gaap_PaymentsToAcquirePropertyPlantAndEquipment" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities" xlink:to="loc_us-gaap_PaymentsToAcquirePropertyPlantAndEquipment" use="optional" order="110000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ProceedsFromSaleOfPropertyPlantAndEquipment" xlink:label="loc_us-gaap_ProceedsFromSaleOfPropertyPlantAndEquipment" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInInvestingActivities" xlink:to="loc_us-gaap_ProceedsFromSaleOfPropertyPlantAndEquipment" use="optional" order="111000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_NetCashProvidedByUsedInFinancingActivities" xlink:label="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsPeriodIncreaseDecreaseIncludingExchangeRateEffect" xlink:to="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" use="optional" order="119000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ProceedsFromLinesOfCredit" xlink:label="loc_us-gaap_ProceedsFromLinesOfCredit" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" xlink:to="loc_us-gaap_ProceedsFromLinesOfCredit" use="optional" order="115000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_RepaymentsOfLinesOfCredit" xlink:label="loc_us-gaap_RepaymentsOfLinesOfCredit" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" xlink:to="loc_us-gaap_RepaymentsOfLinesOfCredit" use="optional" order="116000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PaymentsForRepurchaseOfCommonStock" xlink:label="loc_us-gaap_PaymentsForRepurchaseOfCommonStock" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" xlink:to="loc_us-gaap_PaymentsForRepurchaseOfCommonStock" use="optional" order="117000" weight="-1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions" xlink:label="loc_us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_NetCashProvidedByUsedInFinancingActivities" xlink:to="loc_us-gaap_ProceedsFromIssuanceOfSharesUnderIncentiveAndShareBasedCompensationPlansIncludingStockOptions" use="optional" order="118000" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/InventoriesSummaryOfInventoriesDetail">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LIFOInventoryAmount" xlink:label="loc_us-gaap_LIFOInventoryAmount" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InventoryGross" xlink:label="loc_us-gaap_InventoryGross" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LIFOInventoryAmount" xlink:to="loc_us-gaap_InventoryGross" use="optional" order="103000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InventoryFinishedGoods" xlink:label="loc_us-gaap_InventoryFinishedGoods" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_InventoryGross" xlink:to="loc_us-gaap_InventoryFinishedGoods" use="optional" order="101000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InventoryRawMaterials" xlink:label="loc_us-gaap_InventoryRawMaterials" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_InventoryGross" xlink:to="loc_us-gaap_InventoryRawMaterials" use="optional" order="102000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_InventoryLIFOReserve" xlink:label="loc_us-gaap_InventoryLIFOReserve" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LIFOInventoryAmount" xlink:to="loc_us-gaap_InventoryLIFOReserve" use="optional" order="104000" weight="-1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/PrepaidExpensesAndOtherAssetsSummaryOfPrepaidExpensesAndOtherAssetsDetail">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:label="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ContractWithCustomerAssetNetCurrent" xlink:label="loc_us-gaap_ContractWithCustomerAssetNetCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:to="loc_us-gaap_ContractWithCustomerAssetNetCurrent" use="optional" order="101000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_PrepaidExpenseCurrent" xlink:label="loc_us-gaap_PrepaidExpenseCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:to="loc_us-gaap_PrepaidExpenseCurrent" use="optional" order="102000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ContractReceivableRetainageDueOneYearOrLess" xlink:label="loc_us-gaap_ContractReceivableRetainageDueOneYearOrLess" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:to="loc_us-gaap_ContractReceivableRetainageDueOneYearOrLess" use="optional" order="103000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IncomeTaxesReceivable" xlink:label="loc_us-gaap_IncomeTaxesReceivable" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:to="loc_us-gaap_IncomeTaxesReceivable" use="optional" order="104000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OtherAssetsCurrent" xlink:label="loc_us-gaap_OtherAssetsCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_PrepaidExpenseAndOtherAssetsCurrent" xlink:to="loc_us-gaap_OtherAssetsCurrent" use="optional" order="105000" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/LeasesMaturitiesOfOperatingLeaseLiabilitiesDetails">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsRemainderOfFiscalYear" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsRemainderOfFiscalYear" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsRemainderOfFiscalYear" use="optional" order="3784420" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo" use="optional" order="3784430" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree" use="optional" order="3784440" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour" use="optional" order="3784460" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive" use="optional" order="3784470" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive" use="optional" order="3784480" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/AccruedExpensesAndOtherLiabilitiesSummaryOfAccruedExpensesAndOtherLiabilitiesDetail">
<loc xlink:type="locator" xlink:href="trex-20190331.xsd#trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:label="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AccruedMarketingCostsCurrent" xlink:label="loc_us-gaap_AccruedMarketingCostsCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_AccruedMarketingCostsCurrent" use="optional" order="101000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_EmployeeRelatedLiabilitiesCurrent" xlink:label="loc_us-gaap_EmployeeRelatedLiabilitiesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_EmployeeRelatedLiabilitiesCurrent" use="optional" order="102000" weight="1" />
<loc xlink:type="locator" xlink:href="trex-20190331.xsd#trex_AccruedManufacturingExpensesCurrent" xlink:label="loc_trex_AccruedManufacturingExpensesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_trex_AccruedManufacturingExpensesCurrent" use="optional" order="106000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_ContractWithCustomerLiabilityCurrent" xlink:label="loc_us-gaap_ContractWithCustomerLiabilityCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_ContractWithCustomerLiabilityCurrent" use="optional" order="105000" weight="1" />
<loc xlink:type="locator" xlink:href="trex-20190331.xsd#trex_BillingsInExcessOfRevenuesCurrent" xlink:label="loc_trex_BillingsInExcessOfRevenuesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_trex_BillingsInExcessOfRevenuesCurrent" use="optional" order="107000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OtherAccruedLiabilitiesCurrent" xlink:label="loc_us-gaap_OtherAccruedLiabilitiesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_OtherAccruedLiabilitiesCurrent" use="optional" order="3782770" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_AccruedIncomeTaxesCurrent" xlink:label="loc_us-gaap_AccruedIncomeTaxesCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_AccruedIncomeTaxesCurrent" use="optional" order="104000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingLeaseLiabilityCurrent" xlink:label="loc_us-gaap_OperatingLeaseLiabilityCurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_trex_AccruedLiabilitiesAndOtherLiabilitiesCurrentExcludingWarranty" xlink:to="loc_us-gaap_OperatingLeaseLiabilityCurrent" use="optional" order="103000" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/LeasesSupplementalCashFlowInformationToOperatingLeasesDetails">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingLeaseLiability" xlink:label="loc_us-gaap_OperatingLeaseLiability" />
<loc xlink:type="locator" xlink:href="trex-20190331.xsd#trex_LesseeOperatingLeasesAccruedExpensesAndOtherCurrentLiabilities" xlink:label="loc_TREX_LesseeOperatingLeasesAccruedExpensesAndOtherCurrentLiabilities" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingLeaseLiability" xlink:to="loc_TREX_LesseeOperatingLeasesAccruedExpensesAndOtherCurrentLiabilities" use="optional" order="3784220" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_OperatingLeaseLiabilityNoncurrent" xlink:label="loc_us-gaap_OperatingLeaseLiabilityNoncurrent" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_OperatingLeaseLiability" xlink:to="loc_us-gaap_OperatingLeaseLiabilityNoncurrent" use="optional" order="3784230" weight="1" />
</calculationLink>
<calculationLink xlink:type="extended" xlink:role="http://www.trex.com/role/GoodwillAndOtherIntangibleAssetsDetailsOfIntangibleAssetsDetail">
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IntangibleAssetsNetExcludingGoodwill" xlink:label="loc_us-gaap_IntangibleAssetsNetExcludingGoodwill" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_IntangibleAssetsGrossExcludingGoodwill" xlink:label="loc_us-gaap_IntangibleAssetsGrossExcludingGoodwill" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IntangibleAssetsNetExcludingGoodwill" xlink:to="loc_us-gaap_IntangibleAssetsGrossExcludingGoodwill" use="optional" order="104000" weight="1" />
<loc xlink:type="locator" xlink:href="http://xbrl.fasb.org/us-gaap/2018/elts/us-gaap-2018-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization" />
<calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="loc_us-gaap_IntangibleAssetsNetExcludingGoodwill" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization" use="optional" order="105000" weight="-1" />
</calculationLink>
</linkbase>
