<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.21.2</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>353</ContextCount>
  <ElementCount>343</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>90</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>9</UnitCount>
  <MyReports>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>0001001 - Document - Cover Page</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CoverPage</Role>
      <ShortName>Cover Page</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>1001002 - Statement - Condensed Consolidated Balance Sheets (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CondensedConsolidatedBalanceSheetsUnaudited</Role>
      <ShortName>Condensed Consolidated Balance Sheets (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>1002003 - Statement - Condensed Consolidated Balance Sheets (Unaudited) (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CondensedConsolidatedBalanceSheetsUnauditedParenthetical</Role>
      <ShortName>Condensed Consolidated Balance Sheets (Unaudited) (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>1003004 - Statement - Condensed Consolidated Statements of Operations (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CondensedConsolidatedStatementsofOperationsUnaudited</Role>
      <ShortName>Condensed Consolidated Statements of Operations (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>1004005 - Statement - Condensed Consolidated Statements of Stockholders' Equity (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CondensedConsolidatedStatementsofStockholdersEquityUnaudited</Role>
      <ShortName>Condensed Consolidated Statements of Stockholders' Equity (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>1005006 - Statement - Condensed Consolidated Statements of Cash Flows (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CondensedConsolidatedStatementsofCashFlowsUnaudited</Role>
      <ShortName>Condensed Consolidated Statements of Cash Flows (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>2101101 - Disclosure - Description of Business</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/DescriptionofBusiness</Role>
      <ShortName>Description of Business</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>2103102 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BasisofPresentationandSummaryofSignificantAccountingPolicies</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>2105103 - Disclosure - Revenue Recognition</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognition</Role>
      <ShortName>Revenue Recognition</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>2112104 - Disclosure - Net Income (loss) per Share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/NetIncomelossperShare</Role>
      <ShortName>Net Income (loss) per Share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>2116105 - Disclosure - Investments in Non-Marketable Securities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/InvestmentsinNonMarketableSecurities</Role>
      <ShortName>Investments in Non-Marketable Securities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>2120106 - Disclosure - Fair Value Measurements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/FairValueMeasurements</Role>
      <ShortName>Fair Value Measurements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>2123107 - Disclosure - Balance Sheets Details</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetails</Role>
      <ShortName>Balance Sheets Details</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>2130108 - Disclosure - Stock-based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensation</Role>
      <ShortName>Stock-based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>2137109 - Disclosure - Capital Stock</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CapitalStock</Role>
      <ShortName>Capital Stock</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>2139110 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>2148111 - Disclosure - Related Party Transactions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RelatedPartyTransactions</Role>
      <ShortName>Related Party Transactions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>2151112 - Disclosure - Segment, Geographical and Other Revenue Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformation</Role>
      <ShortName>Segment, Geographical and Other Revenue Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>2159113 - Disclosure - Allowance for Credit Losses</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/AllowanceforCreditLosses</Role>
      <ShortName>Allowance for Credit Losses</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>2204201 - Disclosure - Basis of Presentation and Summary of Significant Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BasisofPresentationandSummaryofSignificantAccountingPoliciesPolicies</Role>
      <ShortName>Basis of Presentation and Summary of Significant Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://www.codexis.com/role/BasisofPresentationandSummaryofSignificantAccountingPolicies</ParentRole>
      <Position>20</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>2306301 - Disclosure - Revenue Recognition (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionTables</Role>
      <ShortName>Revenue Recognition (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/RevenueRecognition</ParentRole>
      <Position>21</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>2313302 - Disclosure - Net Income (loss) per Share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/NetIncomelossperShareTables</Role>
      <ShortName>Net Income (loss) per Share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/NetIncomelossperShare</ParentRole>
      <Position>22</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>2317303 - Disclosure - Investments in Non-Marketable Securities (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/InvestmentsinNonMarketableSecuritiesTables</Role>
      <ShortName>Investments in Non-Marketable Securities (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/InvestmentsinNonMarketableSecurities</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>2321304 - Disclosure - Fair Value Measurements (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/FairValueMeasurementsTables</Role>
      <ShortName>Fair Value Measurements (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/FairValueMeasurements</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>2324305 - Disclosure - Balance Sheets Details (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsTables</Role>
      <ShortName>Balance Sheets Details (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/BalanceSheetsDetails</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>2331306 - Disclosure - Stock-based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationTables</Role>
      <ShortName>Stock-based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/StockbasedCompensation</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>2340307 - Disclosure - Commitments and Contingencies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesTables</Role>
      <ShortName>Commitments and Contingencies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/CommitmentsandContingencies</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>2352308 - Disclosure - Segment, Geographical and Other Revenue Information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationTables</Role>
      <ShortName>Segment, Geographical and Other Revenue Information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformation</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>2360309 - Disclosure - Allowance for Credit Losses (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/AllowanceforCreditLossesTables</Role>
      <ShortName>Allowance for Credit Losses (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.codexis.com/role/AllowanceforCreditLosses</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>2402401 - Disclosure - Description of Business (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/DescriptionofBusinessDetails</Role>
      <ShortName>Description of Business (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/DescriptionofBusiness</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>2407402 - Disclosure - Revenue Recognition - Disaggregation of Revenue (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionDisaggregationofRevenueDetails</Role>
      <ShortName>Revenue Recognition - Disaggregation of Revenue (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>2408403 - Disclosure - Revenue Recognition - Contracts with Customer (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionContractswithCustomerDetails</Role>
      <ShortName>Revenue Recognition - Contracts with Customer (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>2409404 - Disclosure - Revenue Recognition - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionNarrativeDetails</Role>
      <ShortName>Revenue Recognition - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>2410405 - Disclosure - Revenue Recognition - Revenue Recognized During Period (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionRevenueRecognizedDuringPeriodDetails</Role>
      <ShortName>Revenue Recognition - Revenue Recognized During Period (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>2411406 - Disclosure - Revenue Recognition - Performance Obligation (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RevenueRecognitionPerformanceObligationDetails</Role>
      <ShortName>Revenue Recognition - Performance Obligation (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>2414407 - Disclosure - Net Income (loss) per Share - Earnings Per Share (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/NetIncomelossperShareEarningsPerShareDetails</Role>
      <ShortName>Net Income (loss) per Share - Earnings Per Share (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/NetIncomelossperShareTables</ParentRole>
      <Position>36</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>2415408 - Disclosure - Net Income (loss) per Share - Shares Not Included in Computation of Diluted Net Income (Loss) Per Share (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/NetIncomelossperShareSharesNotIncludedinComputationofDilutedNetIncomeLossPerShareDetails</Role>
      <ShortName>Net Income (loss) per Share - Shares Not Included in Computation of Diluted Net Income (Loss) Per Share (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/NetIncomelossperShareTables</ParentRole>
      <Position>37</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>2418409 - Disclosure - Investments in Non-Marketable Securities - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/InvestmentsinNonMarketableSecuritiesNarrativeDetails</Role>
      <ShortName>Investments in Non-Marketable Securities - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>2419410 - Disclosure - Investments in Non-Marketable Securities - Carrying Value and Fair Value of Securities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/InvestmentsinNonMarketableSecuritiesCarryingValueandFairValueofSecuritiesDetails</Role>
      <ShortName>Investments in Non-Marketable Securities - Carrying Value and Fair Value of Securities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>2422411 - Disclosure - Fair Value Measurements (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/FairValueMeasurementsDetails</Role>
      <ShortName>Fair Value Measurements (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/FairValueMeasurementsTables</ParentRole>
      <Position>40</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>2425412 - Disclosure - Balance Sheets Details - Cash and Cash Equivalents (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsCashandCashEquivalentsDetails</Role>
      <ShortName>Balance Sheets Details - Cash and Cash Equivalents (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>2426413 - Disclosure - Balance Sheets Details - Inventories (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsInventoriesDetails</Role>
      <ShortName>Balance Sheets Details - Inventories (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>2427414 - Disclosure - Balance Sheets Details - Property and Equipment, net (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsPropertyandEquipmentnetDetails</Role>
      <ShortName>Balance Sheets Details - Property and Equipment, net (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>2428415 - Disclosure - Balance Sheets Details - Goodwill (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsGoodwillDetails</Role>
      <ShortName>Balance Sheets Details - Goodwill (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>2429416 - Disclosure - Balance Sheets Details - Other Accrued Liabilities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/BalanceSheetsDetailsOtherAccruedLiabilitiesDetails</Role>
      <ShortName>Balance Sheets Details - Other Accrued Liabilities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>2432417 - Disclosure - Stock-based Compensation - Equity Incentive Plans (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationEquityIncentivePlansDetails</Role>
      <ShortName>Stock-based Compensation - Equity Incentive Plans (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>2433418 - Disclosure - Stock-based Compensation - Stock Options (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationStockOptionsDetails</Role>
      <ShortName>Stock-based Compensation - Stock Options (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>2434419 - Disclosure - Stock-based Compensation - Restricted Stock Units (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationRestrictedStockUnitsDetails</Role>
      <ShortName>Stock-based Compensation - Restricted Stock Units (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>2435420 - Disclosure - Stock-based Compensation - PSUs and PBOs (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationPSUsandPBOsDetails</Role>
      <ShortName>Stock-based Compensation - PSUs and PBOs (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>2436421 - Disclosure - Stock-based Compensation - Stock-based Compensation Expense (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/StockbasedCompensationStockbasedCompensationExpenseDetails</Role>
      <ShortName>Stock-based Compensation - Stock-based Compensation Expense (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>2438422 - Disclosure - Capital Stock (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CapitalStockDetails</Role>
      <ShortName>Capital Stock (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/CapitalStock</ParentRole>
      <Position>51</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>2441423 - Disclosure - Commitments and Contingencies - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesNarrativeDetails</Role>
      <ShortName>Commitments and Contingencies - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>2442424 - Disclosure - Commitments and Contingencies - Lease Cost (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesLeaseCostDetails</Role>
      <ShortName>Commitments and Contingencies - Lease Cost (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>2443425 - Disclosure - Commitments and Contingencies - Other Lease Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesOtherLeaseInformationDetails</Role>
      <ShortName>Commitments and Contingencies - Other Lease Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>2444426 - Disclosure - Commitments and Contingencies - Cash Paid for Lease Obligations (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesCashPaidforLeaseObligationsDetails</Role>
      <ShortName>Commitments and Contingencies - Cash Paid for Lease Obligations (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>2445427 - Disclosure - Commitments and Contingencies - Maturity Analysis of Operating Lease (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesMaturityAnalysisofOperatingLeaseDetails</Role>
      <ShortName>Commitments and Contingencies - Maturity Analysis of Operating Lease (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>2446428 - Disclosure - Commitments and Contingencies - Estimated Maturity Analysis (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesEstimatedMaturityAnalysisDetails</Role>
      <ShortName>Commitments and Contingencies - Estimated Maturity Analysis (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>2447429 - Disclosure - Commitments and Contingencies - Other Commitments (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/CommitmentsandContingenciesOtherCommitmentsDetails</Role>
      <ShortName>Commitments and Contingencies - Other Commitments (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>2449430 - Disclosure - Related Party Transactions - Molecular Assemblies, Inc. (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RelatedPartyTransactionsMolecularAssembliesIncDetails</Role>
      <ShortName>Related Party Transactions - Molecular Assemblies, Inc. (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>2450431 - Disclosure - Related Party Transactions - AstraZeneca PLC (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/RelatedPartyTransactionsAstraZenecaPLCDetails</Role>
      <ShortName>Related Party Transactions - AstraZeneca PLC (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>2453432 - Disclosure - Segment, Geographical and Other Revenue Information - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationNarrativeDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationTables</ParentRole>
      <Position>61</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>2454433 - Disclosure - Segment, Geographical and Other Revenue Information - Segment Reporting (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationSegmentReportingDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Segment Reporting (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>62</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>2455434 - Disclosure - Segment, Geographical and Other Revenue Information - Concentration Risk (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationConcentrationRiskDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Concentration Risk (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>63</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R64.htm</HtmlFileName>
      <LongName>2456435 - Disclosure - Segment, Geographical and Other Revenue Information - Revenues by Geographic Area (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationRevenuesbyGeographicAreaDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Revenues by Geographic Area (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>64</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R65.htm</HtmlFileName>
      <LongName>2457436 - Disclosure - Segment, Geographical and Other Revenue Information - Long-Lived Assets by Geographic Area (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationLongLivedAssetsbyGeographicAreaDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Long-Lived Assets by Geographic Area (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>65</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R66.htm</HtmlFileName>
      <LongName>2458437 - Disclosure - Segment, Geographical and Other Revenue Information - Goodwill (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationGoodwillDetails</Role>
      <ShortName>Segment, Geographical and Other Revenue Information - Goodwill (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.codexis.com/role/SegmentGeographicalandOtherRevenueInformationTables</ParentRole>
      <Position>66</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R67.htm</HtmlFileName>
      <LongName>2461438 - Disclosure - Allowance for Credit Losses - Analysis of Allowance for Credit Losses (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/AllowanceforCreditLossesAnalysisofAllowanceforCreditLossesDetails</Role>
      <ShortName>Allowance for Credit Losses - Analysis of Allowance for Credit Losses (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>67</Position>
    </Report>
    <Report instance="cdxs-20210930.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R68.htm</HtmlFileName>
      <LongName>2462439 - Disclosure - Allowance for Credit Losses - Summary of Finance Receivables by Aging Category (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.codexis.com/role/AllowanceforCreditLossesSummaryofFinanceReceivablesbyAgingCategoryDetails</Role>
      <ShortName>Allowance for Credit Losses - Summary of Finance Receivables by Aging Category (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>68</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" original="cdxs-20210930.htm">cdxs-20210930.htm</File>
    <File>amendment5tositagliptinsup.htm</File>
    <File>cdxs-20210930.xsd</File>
    <File>cdxs-20210930_cal.xml</File>
    <File>cdxs-20210930_def.xml</File>
    <File>cdxs-20210930_lab.xml</File>
    <File>cdxs-20210930_pre.xml</File>
    <File>cdxs_20210930xex311.htm</File>
    <File>cdxs_20210930xex312.htm</File>
    <File>cdxs_20210930xex321.htm</File>
    <File>ninthamendmenttolsaex102.htm</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy>http://fasb.org/us-gaap/2021-01-31</BaseTaxonomy>
    <BaseTaxonomy>http://xbrl.sec.gov/dei/2021</BaseTaxonomy>
    <BaseTaxonomy>http://xbrl.sec.gov/country/2021</BaseTaxonomy>
    <BaseTaxonomy>http://fasb.org/srt/2021-01-31</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
