<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.22.0.1</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>308</ContextCount>
  <ElementCount>583</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>99</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>18</UnitCount>
  <MyReports>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>000010001 - Document - Cover Page</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CoverPage</Role>
      <ShortName>Cover Page</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>000020002 - Document - Audit Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/AuditInformation</Role>
      <ShortName>Audit Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>100010003 - Statement - CONSOLIDATED STATEMENTS OF OPERATIONS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFOPERATIONS</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF OPERATIONS</ShortName>
      <MenuCategory>Uncategorized</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>100020004 - Statement - CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFCOMPREHENSIVEINCOME</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>100030005 - Statement - CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFCOMPREHENSIVEINCOMEParenthetical</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>100040006 - Statement - CONSOLIDATED BALANCE SHEETS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDBALANCESHEETS</Role>
      <ShortName>CONSOLIDATED BALANCE SHEETS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>100050007 - Statement - CONSOLIDATED BALANCE SHEETS (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDBALANCESHEETSParenthetical</Role>
      <ShortName>CONSOLIDATED BALANCE SHEETS (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>100060008 - Statement - CONSOLIDATED STATEMENTS OF CASH FLOWS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFCASHFLOWS</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF CASH FLOWS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>100070009 - Statement - CONSOLIDATED STATEMENTS OF SHAREHOLDERS' EQUITY</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFSHAREHOLDERSEQUITY</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF SHAREHOLDERS' EQUITY</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>100080010 - Statement - CONSOLIDATED STATEMENTS OF SHAREHOLDERS' EQUITY (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CONSOLIDATEDSTATEMENTSOFSHAREHOLDERSEQUITYParenthetical</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF SHAREHOLDERS' EQUITY (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>210011001 - Disclosure - Summary of Significant Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPolicies</Role>
      <ShortName>Summary of Significant Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>210091002 - Disclosure - New Pronouncements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/NewPronouncements</Role>
      <ShortName>New Pronouncements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>210111003 - Disclosure - Fair Value Measurements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/FairValueMeasurements</Role>
      <ShortName>Fair Value Measurements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>210161004 - Disclosure - Cash, Cash Equivalents, and Investments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestments</Role>
      <ShortName>Cash, Cash Equivalents, and Investments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>210241005 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/Inventories</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>210271006 - Disclosure - Property, Plant, and Equipment</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/PropertyPlantandEquipment</Role>
      <ShortName>Property, Plant, and Equipment</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>210311007 - Disclosure - Leases Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/LeasesLeases</Role>
      <ShortName>Leases Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>210351008 - Disclosure - Goodwill</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/Goodwill</Role>
      <ShortName>Goodwill</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>210391009 - Disclosure - Intangible Assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IntangibleAssets</Role>
      <ShortName>Intangible Assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>210441010 - Disclosure - Accrued Expenses</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/AccruedExpenses</Role>
      <ShortName>Accrued Expenses</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>210481011 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CommitmentsandContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>210501012 - Disclosure - Indemnification Provisions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IndemnificationProvisions</Role>
      <ShortName>Indemnification Provisions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>210511013 - Disclosure - Derivative Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstruments</Role>
      <ShortName>Derivative Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>23</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>210581014 - Disclosure - Revenue Recognition</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognition</Role>
      <ShortName>Revenue Recognition</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>24</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>210641015 - Disclosure - Shareholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/ShareholdersEquity</Role>
      <ShortName>Shareholders' Equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>25</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>210661016 - Disclosure - Stock-Based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensation</Role>
      <ShortName>Stock-Based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>26</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>210731017 - Disclosure - Employee Savings Plan</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/EmployeeSavingsPlan</Role>
      <ShortName>Employee Savings Plan</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>27</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>210751018 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxes</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>28</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>210831019 - Disclosure - Weighted Average Shares</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/WeightedAverageShares</Role>
      <ShortName>Weighted Average Shares</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>29</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>210871020 - Disclosure - Segment and Geographic Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SegmentandGeographicInformation</Role>
      <ShortName>Segment and Geographic Information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>30</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>210911021 - Disclosure - Business Acquisitions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/BusinessAcquisitions</Role>
      <ShortName>Business Acquisitions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>210931022 - Disclosure - Restructuring Charges</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RestructuringCharges</Role>
      <ShortName>Restructuring Charges</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>210981023 - Disclosure - Subsequent Events</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SubsequentEvents</Role>
      <ShortName>Subsequent Events</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>211001024 - Disclosure - Schedule II - Valuation and Qualifying Accounts</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/ScheduleIIValuationandQualifyingAccounts</Role>
      <ShortName>Schedule II - Valuation and Qualifying Accounts</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>220022001 - Disclosure - Summary of Significant Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesPolicies</Role>
      <ShortName>Summary of Significant Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://cognex.com/role/SummaryofSignificantAccountingPolicies</ParentRole>
      <Position>35</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>220102002 - Disclosure - New Pronouncements (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/NewPronouncementsPolicies</Role>
      <ShortName>New Pronouncements (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://cognex.com/role/SummaryofSignificantAccountingPolicies</ParentRole>
      <Position>36</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>230123001 - Disclosure - Fair Value Measurements (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/FairValueMeasurementsTables</Role>
      <ShortName>Fair Value Measurements (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/FairValueMeasurements</ParentRole>
      <Position>37</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>230173002 - Disclosure - Cash, Cash Equivalents, and Investments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsTables</Role>
      <ShortName>Cash, Cash Equivalents, and Investments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/CashCashEquivalentsandInvestments</ParentRole>
      <Position>38</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>230253003 - Disclosure - Inventories (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/InventoriesTables</Role>
      <ShortName>Inventories (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/Inventories</ParentRole>
      <Position>39</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>230283004 - Disclosure - Property, Plant, and Equipment (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/PropertyPlantandEquipmentTables</Role>
      <ShortName>Property, Plant, and Equipment (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/PropertyPlantandEquipment</ParentRole>
      <Position>40</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>230323005 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/LeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/LeasesLeases</ParentRole>
      <Position>41</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>230363006 - Disclosure - Goodwill (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/GoodwillTables</Role>
      <ShortName>Goodwill (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/Goodwill</ParentRole>
      <Position>42</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>230403007 - Disclosure - Intangible Assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IntangibleAssetsTables</Role>
      <ShortName>Intangible Assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/IntangibleAssets</ParentRole>
      <Position>43</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>230453008 - Disclosure - Accrued Expenses (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/AccruedExpensesTables</Role>
      <ShortName>Accrued Expenses (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/AccruedExpenses</ParentRole>
      <Position>44</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>230523009 - Disclosure - Derivative Instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsTables</Role>
      <ShortName>Derivative Instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/DerivativeInstruments</ParentRole>
      <Position>45</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>230593010 - Disclosure - Revenue Recognition (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognitionTables</Role>
      <ShortName>Revenue Recognition (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/RevenueRecognition</ParentRole>
      <Position>46</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>230673011 - Disclosure - Stock-Based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationTables</Role>
      <ShortName>Stock-Based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/StockBasedCompensation</ParentRole>
      <Position>47</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>230763012 - Disclosure - Income Taxes (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesTables</Role>
      <ShortName>Income Taxes (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/IncomeTaxes</ParentRole>
      <Position>48</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>230843013 - Disclosure - Weighted Average Shares (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/WeightedAverageSharesTables</Role>
      <ShortName>Weighted Average Shares (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/WeightedAverageShares</ParentRole>
      <Position>49</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>230883014 - Disclosure - Segment and Geographic Information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SegmentandGeographicInformationTables</Role>
      <ShortName>Segment and Geographic Information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/SegmentandGeographicInformation</ParentRole>
      <Position>50</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>230943015 - Disclosure - Restructuring Charges (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RestructuringChargesTables</Role>
      <ShortName>Restructuring Charges (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://cognex.com/role/RestructuringCharges</ParentRole>
      <Position>51</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>240034001 - Disclosure - Summary of Significant Accounting Policies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesAdditionalInformationDetail</Role>
      <ShortName>Summary of Significant Accounting Policies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>240044002 - Disclosure - Summary of Significant Accounting Policies - Intangible Assets (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesIntangibleAssetsDetails</Role>
      <ShortName>Summary of Significant Accounting Policies - Intangible Assets (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>240054003 - Disclosure - Summary of Significant Accounting Policies - Warranty (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesWarrantyDetails</Role>
      <ShortName>Summary of Significant Accounting Policies - Warranty (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>240064004 - Disclosure - Summary of Significant Accounting Policies Summary of Significant Accounting Policies - Revenue Recognition (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesSummaryofSignificantAccountingPoliciesRevenueRecognitionDetails</Role>
      <ShortName>Summary of Significant Accounting Policies Summary of Significant Accounting Policies - Revenue Recognition (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>240074005 - Disclosure - Summary of Significant Accounting Policies - Advertising Costs (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesAdvertisingCostsDetails</Role>
      <ShortName>Summary of Significant Accounting Policies - Advertising Costs (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>240084006 - Disclosure - Summary of Significant Accounting Policies - Comprehensive Income (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SummaryofSignificantAccountingPoliciesComprehensiveIncomeDetails</Role>
      <ShortName>Summary of Significant Accounting Policies - Comprehensive Income (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>240134007 - Disclosure - Fair Value Measurements - Assets and Liabilities Measured at Fair Value on a Recurring Basis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/FairValueMeasurementsAssetsandLiabilitiesMeasuredatFairValueonaRecurringBasisDetail</Role>
      <ShortName>Fair Value Measurements - Assets and Liabilities Measured at Fair Value on a Recurring Basis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>240144008 - Disclosure - Fair Value Measurements - Liabilities Measured on Recurring Basis, Unobservable Input Reconciliation (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/FairValueMeasurementsLiabilitiesMeasuredonRecurringBasisUnobservableInputReconciliationDetails</Role>
      <ShortName>Fair Value Measurements - Liabilities Measured on Recurring Basis, Unobservable Input Reconciliation (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>240154009 - Disclosure - Fair Value Measurements - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/FairValueMeasurementsAdditionalInformationDetails</Role>
      <ShortName>Fair Value Measurements - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>240184010 - Disclosure - Cash, Cash Equivalents and Investments - Components of Cash, Cash Equivalents and Investments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsComponentsofCashCashEquivalentsandInvestmentsDetail</Role>
      <ShortName>Cash, Cash Equivalents and Investments - Components of Cash, Cash Equivalents and Investments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>61</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>240194011 - Disclosure - Cash, Cash Equivalents and Investments - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsAdditionalInformationDetail</Role>
      <ShortName>Cash, Cash Equivalents and Investments - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>62</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>240204012 - Disclosure - Cash, Cash Equivalents and Investments - Amortized Cost to Fair Value (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsAmortizedCosttoFairValueDetail</Role>
      <ShortName>Cash, Cash Equivalents and Investments - Amortized Cost to Fair Value (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>63</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R64.htm</HtmlFileName>
      <LongName>240214013 - Disclosure - Cash, Cash Equivalents and Investments - Gross Unrealized Losses and Fair Value for Available-for-Sale Investments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsGrossUnrealizedLossesandFairValueforAvailableforSaleInvestmentsDetail</Role>
      <ShortName>Cash, Cash Equivalents and Investments - Gross Unrealized Losses and Fair Value for Available-for-Sale Investments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>64</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R65.htm</HtmlFileName>
      <LongName>240224014 - Disclosure - Cash, Cash Equivalents, and Investments - Allowance for Credit Loss (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsAllowanceforCreditLossDetails</Role>
      <ShortName>Cash, Cash Equivalents, and Investments - Allowance for Credit Loss (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>65</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R66.htm</HtmlFileName>
      <LongName>240234015 - Disclosure - Cash, Cash Equivalents and Investments - Effective Maturity Dates of Available-for-Sale Investments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CashCashEquivalentsandInvestmentsEffectiveMaturityDatesofAvailableforSaleInvestmentsDetail</Role>
      <ShortName>Cash, Cash Equivalents and Investments - Effective Maturity Dates of Available-for-Sale Investments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>66</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R67.htm</HtmlFileName>
      <LongName>240264016 - Disclosure - Inventories - Inventories (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/InventoriesInventoriesDetail</Role>
      <ShortName>Inventories - Inventories (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>67</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R68.htm</HtmlFileName>
      <LongName>240294017 - Disclosure - Property, Plant, and Equipment - Property, Plant, and Equipment (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/PropertyPlantandEquipmentPropertyPlantandEquipmentDetail</Role>
      <ShortName>Property, Plant, and Equipment - Property, Plant, and Equipment (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>68</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R69.htm</HtmlFileName>
      <LongName>240304018 - Disclosure - Property, Plant and Equipment - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/PropertyPlantandEquipmentAdditionalInformationDetails</Role>
      <ShortName>Property, Plant and Equipment - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>69</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R70.htm</HtmlFileName>
      <LongName>240334019 - Disclosure - Leases (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/LeasesDetails</Role>
      <ShortName>Leases (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://cognex.com/role/LeasesTables</ParentRole>
      <Position>70</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R71.htm</HtmlFileName>
      <LongName>240344020 - Disclosure - Leases - Schedule of Payments (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/LeasesScheduleofPaymentsDetails</Role>
      <ShortName>Leases - Schedule of Payments (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>71</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R72.htm</HtmlFileName>
      <LongName>240374021 - Disclosure - Goodwill - Changes in the Carrying Value of Goodwill (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/GoodwillChangesintheCarryingValueofGoodwillDetail</Role>
      <ShortName>Goodwill - Changes in the Carrying Value of Goodwill (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>72</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R73.htm</HtmlFileName>
      <LongName>240414023 - Disclosure - Intangible Assets - Amortized Intangible Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IntangibleAssetsAmortizedIntangibleAssetsDetail</Role>
      <ShortName>Intangible Assets - Amortized Intangible Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>73</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R74.htm</HtmlFileName>
      <LongName>240424024 - Disclosure - Intangible Assets - Estimated Amortization Expense Succeeding Fiscal Years (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IntangibleAssetsEstimatedAmortizationExpenseSucceedingFiscalYearsDetail</Role>
      <ShortName>Intangible Assets - Estimated Amortization Expense Succeeding Fiscal Years (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>74</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R75.htm</HtmlFileName>
      <LongName>240434025 - Disclosure - Intangible Assets - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IntangibleAssetsNarrativeDetails</Role>
      <ShortName>Intangible Assets - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>75</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R76.htm</HtmlFileName>
      <LongName>240464026 - Disclosure - Accrued Expenses - Constituents of Accrued Expenses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/AccruedExpensesConstituentsofAccruedExpensesDetail</Role>
      <ShortName>Accrued Expenses - Constituents of Accrued Expenses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>76</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R77.htm</HtmlFileName>
      <LongName>240474027 - Disclosure - Accrued Expenses - Changes in Warranty Obligations (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/AccruedExpensesChangesinWarrantyObligationsDetail</Role>
      <ShortName>Accrued Expenses - Changes in Warranty Obligations (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>77</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R78.htm</HtmlFileName>
      <LongName>240494028 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/CommitmentsandContingenciesAdditionalInformationDetail</Role>
      <ShortName>Commitments and Contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>78</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R79.htm</HtmlFileName>
      <LongName>240534029 - Disclosure - Derivative Instruments - Additional Details (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsAdditionalDetailsDetails</Role>
      <ShortName>Derivative Instruments - Additional Details (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>79</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R80.htm</HtmlFileName>
      <LongName>240544030 - Disclosure - Derivative Instruments - Outstanding Forward Contracts (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsOutstandingForwardContractsDetails</Role>
      <ShortName>Derivative Instruments - Outstanding Forward Contracts (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>80</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R81.htm</HtmlFileName>
      <LongName>240554031 - Disclosure - Derivative Instruments - Balance Sheet Location (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsBalanceSheetLocationDetails</Role>
      <ShortName>Derivative Instruments - Balance Sheet Location (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>81</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R82.htm</HtmlFileName>
      <LongName>240564032 - Disclosure - Derivative Instruments - Assets and liabilities presented on a net basis due to the right of offset (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsAssetsandliabilitiespresentedonanetbasisduetotherightofoffsetDetails</Role>
      <ShortName>Derivative Instruments - Assets and liabilities presented on a net basis due to the right of offset (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>82</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R83.htm</HtmlFileName>
      <LongName>240574033 - Disclosure - Derivative Instruments - Gain (Loss) Recognized in Other Comprehensive Income (Loss) (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/DerivativeInstrumentsGainLossRecognizedinOtherComprehensiveIncomeLossDetails</Role>
      <ShortName>Derivative Instruments - Gain (Loss) Recognized in Other Comprehensive Income (Loss) (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>83</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R84.htm</HtmlFileName>
      <LongName>240604034 - Disclosure - Revenue Recognition - Narratives (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognitionNarrativesDetails</Role>
      <ShortName>Revenue Recognition - Narratives (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>84</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R85.htm</HtmlFileName>
      <LongName>240614035 - Disclosure - Revenue Recognition - Disaggregation by Geography and Type (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognitionDisaggregationbyGeographyandTypeDetails</Role>
      <ShortName>Revenue Recognition - Disaggregation by Geography and Type (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>85</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R86.htm</HtmlFileName>
      <LongName>240624036 - Disclosure - Revenue Recognition - Allowance for Credit Loss (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognitionAllowanceforCreditLossDetails</Role>
      <ShortName>Revenue Recognition - Allowance for Credit Loss (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>86</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R87.htm</HtmlFileName>
      <LongName>240634037 - Disclosure - Revenue Recognition - Deferred Revenue and Customer Deposits Rollforward (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RevenueRecognitionDeferredRevenueandCustomerDepositsRollforwardDetails</Role>
      <ShortName>Revenue Recognition - Deferred Revenue and Customer Deposits Rollforward (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>87</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R88.htm</HtmlFileName>
      <LongName>240654038 - Disclosure - Shareholders' Equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/ShareholdersEquityAdditionalInformationDetail</Role>
      <ShortName>Shareholders' Equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>88</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R89.htm</HtmlFileName>
      <LongName>240684039 - Disclosure - Stock-Based Compensation Expense - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationExpenseAdditionalInformationDetail</Role>
      <ShortName>Stock-Based Compensation Expense - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>89</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R90.htm</HtmlFileName>
      <LongName>240694040 - Disclosure - Stock-Based Compensation Expense - Summary of Stock Option Activity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationExpenseSummaryofStockOptionActivityDetail</Role>
      <ShortName>Stock-Based Compensation Expense - Summary of Stock Option Activity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>90</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R91.htm</HtmlFileName>
      <LongName>240704041 - Disclosure - Stock-Based Compensation Expense - Weighted-Average Assumptions Used in Estimating Fair Values of Stock Options Granted (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationExpenseWeightedAverageAssumptionsUsedinEstimatingFairValuesofStockOptionsGrantedDetail</Role>
      <ShortName>Stock-Based Compensation Expense - Weighted-Average Assumptions Used in Estimating Fair Values of Stock Options Granted (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>91</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R92.htm</HtmlFileName>
      <LongName>240714042 - Disclosure - Stock-Based Compensation Expense - Summary of Restricted Stock Option Activity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationExpenseSummaryofRestrictedStockOptionActivityDetail</Role>
      <ShortName>Stock-Based Compensation Expense - Summary of Restricted Stock Option Activity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>92</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R93.htm</HtmlFileName>
      <LongName>240724043 - Disclosure - Stock-Based Compensation Expense - Stock-Based Compensation Expense (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/StockBasedCompensationExpenseStockBasedCompensationExpenseDetail</Role>
      <ShortName>Stock-Based Compensation Expense - Stock-Based Compensation Expense (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>93</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R94.htm</HtmlFileName>
      <LongName>240744044 - Disclosure - Employee Savings Plan - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/EmployeeSavingsPlanAdditionalInformationDetail</Role>
      <ShortName>Employee Savings Plan - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>94</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R95.htm</HtmlFileName>
      <LongName>240774045 - Disclosure - Income Taxes - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesAdditionalInformationDetails</Role>
      <ShortName>Income Taxes - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>95</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R96.htm</HtmlFileName>
      <LongName>240784046 - Disclosure - Income Taxes - Constituents of Provision for Income Taxes (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesConstituentsofProvisionforIncomeTaxesDetails</Role>
      <ShortName>Income Taxes - Constituents of Provision for Income Taxes (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>96</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R97.htm</HtmlFileName>
      <LongName>240794047 - Disclosure - Income Taxes - Reconciliation of the United States Federal Statutory Corporate Tax Rate to Company's Effective Tax Rate or Income Tax Provision (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesReconciliationoftheUnitedStatesFederalStatutoryCorporateTaxRatetoCompanysEffectiveTaxRateorIncomeTaxProvisionDetails</Role>
      <ShortName>Income Taxes - Reconciliation of the United States Federal Statutory Corporate Tax Rate to Company's Effective Tax Rate or Income Tax Provision (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>97</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R98.htm</HtmlFileName>
      <LongName>240804048 - Disclosure - Income Taxes - Schedule of Change in Accounting Policy (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesScheduleofChangeinAccountingPolicyDetails</Role>
      <ShortName>Income Taxes - Schedule of Change in Accounting Policy (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>98</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R99.htm</HtmlFileName>
      <LongName>240814049 - Disclosure - Income Taxes - Changes in the Reserve for Income Taxes, Excluding Interest and Penalties (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesChangesintheReserveforIncomeTaxesExcludingInterestandPenaltiesDetails</Role>
      <ShortName>Income Taxes - Changes in the Reserve for Income Taxes, Excluding Interest and Penalties (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>99</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R100.htm</HtmlFileName>
      <LongName>240824050 - Disclosure - Income Taxes - Constituents of Deferred Tax Assets (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/IncomeTaxesConstituentsofDeferredTaxAssetsDetails</Role>
      <ShortName>Income Taxes - Constituents of Deferred Tax Assets (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>100</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R101.htm</HtmlFileName>
      <LongName>240854051 - Disclosure - Weighted Average Shares - Calculation of Weighted Average Shares (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/WeightedAverageSharesCalculationofWeightedAverageSharesDetail</Role>
      <ShortName>Weighted Average Shares - Calculation of Weighted Average Shares (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>101</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R102.htm</HtmlFileName>
      <LongName>240864052 - Disclosure - Weighted Average Shares - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/WeightedAverageSharesAdditionalInformationDetail</Role>
      <ShortName>Weighted Average Shares - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>102</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R103.htm</HtmlFileName>
      <LongName>240894053 - Disclosure - Segment and Geographic Information - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SegmentandGeographicInformationAdditionalInformationDetail</Role>
      <ShortName>Segment and Geographic Information - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>103</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R104.htm</HtmlFileName>
      <LongName>240904054 - Disclosure - Segment and Geographic Information - Schedule of Revenue from External Customers and Long-Lived Assets, by Geographical Areas (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SegmentandGeographicInformationScheduleofRevenuefromExternalCustomersandLongLivedAssetsbyGeographicalAreasDetail</Role>
      <ShortName>Segment and Geographic Information - Schedule of Revenue from External Customers and Long-Lived Assets, by Geographical Areas (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>104</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R105.htm</HtmlFileName>
      <LongName>240924055 - Disclosure - Business Acquisitions - Sualab Co., Ltd. Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/BusinessAcquisitionsSualabCoLtdNarrativeDetails</Role>
      <ShortName>Business Acquisitions - Sualab Co., Ltd. Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>105</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R106.htm</HtmlFileName>
      <LongName>240954056 - Disclosure - Restructuring Charges - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RestructuringChargesAdditionalInformationDetails</Role>
      <ShortName>Restructuring Charges - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>106</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R107.htm</HtmlFileName>
      <LongName>240964057 - Disclosure - Restructuring Charges - Schedule of Restructuring and Related Costs (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RestructuringChargesScheduleofRestructuringandRelatedCostsDetails</Role>
      <ShortName>Restructuring Charges - Schedule of Restructuring and Related Costs (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>107</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R108.htm</HtmlFileName>
      <LongName>240974058 - Disclosure - Restructuring Charges - Schedule of Restructuring Reserve by Type of Cost (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/RestructuringChargesScheduleofRestructuringReservebyTypeofCostDetails</Role>
      <ShortName>Restructuring Charges - Schedule of Restructuring Reserve by Type of Cost (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>108</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R109.htm</HtmlFileName>
      <LongName>240994059 - Disclosure - Subsequent Events - (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/SubsequentEventsDetails</Role>
      <ShortName>Subsequent Events - (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://cognex.com/role/SubsequentEvents</ParentRole>
      <Position>109</Position>
    </Report>
    <Report instance="cgnx-20211231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R110.htm</HtmlFileName>
      <LongName>241014060 - Disclosure - Schedule II -Valuation and Qualifying Accounts (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://cognex.com/role/ScheduleIIValuationandQualifyingAccountsDetail</Role>
      <ShortName>Schedule II -Valuation and Qualifying Accounts (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>110</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-K" original="cgnx-20211231.htm">cgnx-20211231.htm</File>
    <File>cgnx-20211231.xsd</File>
    <File>cgnx-20211231_cal.xml</File>
    <File>cgnx-20211231_def.xml</File>
    <File>cgnx-20211231_lab.xml</File>
    <File>cgnx-20211231_pre.xml</File>
    <File>cgnx-20211231xexhibit10l.htm</File>
    <File>cgnx-20211231xexhibit21.htm</File>
    <File>cgnx-20211231xexhibit231.htm</File>
    <File>cgnx-20211231xexhibit311.htm</File>
    <File>cgnx-20211231xexhibit312.htm</File>
    <File>cgnx-20211231xexhibit321.htm</File>
    <File>cgnx-20211231xexhibit322.htm</File>
  </InputFiles>
  <SupplementalFiles>
    <File>cgnx-20211231_g1.jpg</File>
  </SupplementalFiles>
  <BaseTaxonomies>
    <BaseTaxonomy items="1">http://fasb.org/srt/2021-01-31</BaseTaxonomy>
    <BaseTaxonomy items="1329">http://fasb.org/us-gaap/2021-01-31</BaseTaxonomy>
    <BaseTaxonomy items="38">http://xbrl.sec.gov/dei/2021q4</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
