<?xml version="1.0" encoding="UTF-8"?>

<!--XBRL Document Created with Wdesk from Workiva-->
<!--Copyright 2021 Workiva-->
<!--r:a87039c4-2fcc-45c9-b365-4bab5f3d8573,g:1b6fd14f-8b43-42ad-82c9-d667f6dff3d6-->
<link:linkbase xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd">
  <link:arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/all" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#all"/>
  <link:arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#hypercube-dimension"/>
  <link:arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#dimension-default"/>
  <link:arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#dimension-domain"/>
  <link:arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/domain-member" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#domain-member"/>
  <link:roleRef roleURI="http://www.cognex.com/role/CoverPage" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CoverPage"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CoverPage" xlink:type="extended" id="i78d99e39bef947fb96ec0319a9849e66_CoverPage"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementsofOperations" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementsofOperations"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementsofOperations" xlink:type="extended" id="i2c5e0a77281741dd8e2fab946c160fac_ConsolidatedStatementsofOperations"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementsofComprehensiveIncome" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementsofComprehensiveIncome"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementsofComprehensiveIncome" xlink:type="extended" id="if6d8c45f89e345209f12eebeba8c69ab_ConsolidatedStatementsofComprehensiveIncome"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementsofComprehensiveIncomeParenthetical" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementsofComprehensiveIncomeParenthetical"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementsofComprehensiveIncomeParenthetical" xlink:type="extended" id="i9630535b442c4ad78dcb64667535b9b9_ConsolidatedStatementsofComprehensiveIncomeParenthetical"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedBalanceSheets" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedBalanceSheets"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedBalanceSheets" xlink:type="extended" id="ie95de9af3af04dc3af60bee7cf7fe2a3_ConsolidatedBalanceSheets"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedBalanceSheetsParenthetical" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedBalanceSheetsParenthetical"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedBalanceSheetsParenthetical" xlink:type="extended" id="i4704cf4f36e44f308d529c0059bb2f9a_ConsolidatedBalanceSheetsParenthetical"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementsofCashFlows" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementsofCashFlows"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementsofCashFlows" xlink:type="extended" id="i86348014bf0c42ed884b793cf200e478_ConsolidatedStatementsofCashFlows"/>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementofShareholdersEquity" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementofShareholdersEquity"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementofShareholdersEquity" xlink:type="extended" id="i2a71a15cf7d645499d96d763e21b3d10_ConsolidatedStatementofShareholdersEquity">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StatementLineItems_3c1ddf67-0a5a-4e3f-ba16-25c8c51cd929" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StatementLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncreaseDecreaseInStockholdersEquityRollForward"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_3c1ddf67-0a5a-4e3f-ba16-25c8c51cd929" xlink:to="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockholdersEquity_635fece9-472e-46af-a61b-cfc06db14082" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockholdersEquity"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_StockholdersEquity_635fece9-472e-46af-a61b-cfc06db14082" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CommonStockSharesIssued_b4dbdb83-2798-4449-b3be-df9c97398b76" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CommonStockSharesIssued"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_CommonStockSharesIssued_b4dbdb83-2798-4449-b3be-df9c97398b76" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised_adf58ad3-b9fa-4c4e-bff6-80b14408224a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised_adf58ad3-b9fa-4c4e-bff6-80b14408224a" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod_165f8d7f-550f-4af3-b602-7dfdbcae7b91" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod_165f8d7f-550f-4af3-b602-7dfdbcae7b91" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchasedDuringPeriodValue_ef809c77-42e6-4532-b7db-95f02b2ed6b5" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchasedDuringPeriodValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_StockRepurchasedDuringPeriodValue_ef809c77-42e6-4532-b7db-95f02b2ed6b5" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchasedDuringPeriodShares_55c41c3c-48f5-4ab0-959d-be0f8736f7b5" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchasedDuringPeriodShares"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_StockRepurchasedDuringPeriodShares_55c41c3c-48f5-4ab0-959d-be0f8736f7b5" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue_e0909020-2abf-469f-be97-c71ccec5e070" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue_e0909020-2abf-469f-be97-c71ccec5e070" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DividendsCash_54f64eb4-78ef-48c0-a1cf-65066a6dfe3d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DividendsCash"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_DividendsCash_54f64eb4-78ef-48c0-a1cf-65066a6dfe3d" xlink:type="arc" order="8"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NetIncomeLoss_027cd83d-ab6c-46b2-b456-25595cdabfbb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_NetIncomeLoss"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_NetIncomeLoss_027cd83d-ab6c-46b2-b456-25595cdabfbb" xlink:type="arc" order="9"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeUnrealizedHoldingGainLossOnSecuritiesArisingDuringPeriodNetOfTax_87317573-cae0-45ee-95a8-04efb208e568" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherComprehensiveIncomeUnrealizedHoldingGainLossOnSecuritiesArisingDuringPeriodNetOfTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_OtherComprehensiveIncomeUnrealizedHoldingGainLossOnSecuritiesArisingDuringPeriodNetOfTax_87317573-cae0-45ee-95a8-04efb208e568" xlink:type="arc" order="10"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ReclassificationFromAccumulatedOtherComprehensiveIncomeCurrentPeriodNetOfTax_8b8d19bf-e107-4aaa-bfa1-fbab51ecddb0" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ReclassificationFromAccumulatedOtherComprehensiveIncomeCurrentPeriodNetOfTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_ReclassificationFromAccumulatedOtherComprehensiveIncomeCurrentPeriodNetOfTax_8b8d19bf-e107-4aaa-bfa1-fbab51ecddb0" xlink:type="arc" order="11"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIForSaleOfSecuritiesNetOfTax_2d983bc2-d343-4630-812f-d10c8a16da29" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIForSaleOfSecuritiesNetOfTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossReclassificationAdjustmentFromAOCIForSaleOfSecuritiesNetOfTax_2d983bc2-d343-4630-812f-d10c8a16da29" xlink:type="arc" order="12"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax_6c3528d2-28f8-4a79-bb99-e05ce0722751" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncreaseDecreaseInStockholdersEquityRollForward_239a4831-957f-4c83-b7c8-f207d27b12bf" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentNetOfTax_6c3528d2-28f8-4a79-bb99-e05ce0722751" xlink:type="arc" order="13"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CommonStockSharesIssued_ba40d640-df86-4362-91e8-c56860adf9ed" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CommonStockSharesIssued"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockholdersEquity_0c5baa4f-b0c3-40c2-bcfe-a0c2bcb73ae5" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockholdersEquity"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StatementTable_71b9befb-241a-4fba-a0cb-cdec89129705" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StatementTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_3c1ddf67-0a5a-4e3f-ba16-25c8c51cd929" xlink:to="loc_us-gaap_StatementTable_71b9befb-241a-4fba-a0cb-cdec89129705" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_7763121e-ce5e-4f8d-a8dd-ad7c8094254d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StatementEquityComponentsAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_71b9befb-241a-4fba-a0cb-cdec89129705" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_7763121e-ce5e-4f8d-a8dd-ad7c8094254d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EquityComponentDomain_7763121e-ce5e-4f8d-a8dd-ad7c8094254d_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EquityComponentDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_7763121e-ce5e-4f8d-a8dd-ad7c8094254d" xlink:to="loc_us-gaap_EquityComponentDomain_7763121e-ce5e-4f8d-a8dd-ad7c8094254d_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EquityComponentDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_7763121e-ce5e-4f8d-a8dd-ad7c8094254d" xlink:to="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CommonStockMember_534514d6-97fb-4fb0-af06-a70fd583a2cc" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CommonStockMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:to="loc_us-gaap_CommonStockMember_534514d6-97fb-4fb0-af06-a70fd583a2cc" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AdditionalPaidInCapitalMember_ad39c247-50e5-4110-b1e8-9f8ebdd5641f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AdditionalPaidInCapitalMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:to="loc_us-gaap_AdditionalPaidInCapitalMember_ad39c247-50e5-4110-b1e8-9f8ebdd5641f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RetainedEarningsMember_c800bc75-9737-49d8-b20b-6d2a1684eaf2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RetainedEarningsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:to="loc_us-gaap_RetainedEarningsMember_c800bc75-9737-49d8-b20b-6d2a1684eaf2" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeMember_dc9a44bc-4d8c-481d-995e-3631bfe2fd89" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_d1cbc41d-d8f6-4185-bbd8-fb7ee397ab50" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeMember_dc9a44bc-4d8c-481d-995e-3631bfe2fd89" xlink:type="arc" order="3"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/ConsolidatedStatementofShareholdersEquityParenthetical" xlink:type="simple" xlink:href="cgnx-20210404.xsd#ConsolidatedStatementofShareholdersEquityParenthetical"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/ConsolidatedStatementofShareholdersEquityParenthetical" xlink:type="extended" id="ibddbb9e5fbc64ed1868a6487ea3b4a6c_ConsolidatedStatementofShareholdersEquityParenthetical"/>
  <link:roleRef roleURI="http://www.cognex.com/role/SummaryofSignificantAccountingPolicies" xlink:type="simple" xlink:href="cgnx-20210404.xsd#SummaryofSignificantAccountingPolicies"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/SummaryofSignificantAccountingPolicies" xlink:type="extended" id="i88ba9e5d67aa4c66bc56eed02749d478_SummaryofSignificantAccountingPolicies"/>
  <link:roleRef roleURI="http://www.cognex.com/role/SummaryofSignificantAccountingPoliciesPolicies" xlink:type="simple" xlink:href="cgnx-20210404.xsd#SummaryofSignificantAccountingPoliciesPolicies"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/SummaryofSignificantAccountingPoliciesPolicies" xlink:type="extended" id="i30e19779c2b14e2e816feeb631f22d4b_SummaryofSignificantAccountingPoliciesPolicies"/>
  <link:roleRef roleURI="http://www.cognex.com/role/NewPronouncements" xlink:type="simple" xlink:href="cgnx-20210404.xsd#NewPronouncements"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/NewPronouncements" xlink:type="extended" id="ie637805e2ab947e88db688808247613c_NewPronouncements"/>
  <link:roleRef roleURI="http://www.cognex.com/role/FairValueMeasurements" xlink:type="simple" xlink:href="cgnx-20210404.xsd#FairValueMeasurements"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/FairValueMeasurements" xlink:type="extended" id="ia11c2a2e34944da7a881fb26507fb708_FairValueMeasurements"/>
  <link:roleRef roleURI="http://www.cognex.com/role/FairValueMeasurementsTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#FairValueMeasurementsTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/FairValueMeasurementsTables" xlink:type="extended" id="i105a4afb69704bffa44f3925d522cc23_FairValueMeasurementsTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/FairValueMeasurementsAssetsandLiabilitiesMeasuredatFairValueonaRecurringBasisDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#FairValueMeasurementsAssetsandLiabilitiesMeasuredatFairValueonaRecurringBasisDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/FairValueMeasurementsAssetsandLiabilitiesMeasuredatFairValueonaRecurringBasisDetails" xlink:type="extended" id="iad284dc4779b4397a82d2f426fe7c26b_FairValueMeasurementsAssetsandLiabilitiesMeasuredatFairValueonaRecurringBasisDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_3046db14-b533-4ae1-8f12-772cad450114" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetsFairValueDisclosureAbstract_7b4fb520-eff8-414d-8058-d30268ce884a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetsFairValueDisclosureAbstract"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_3046db14-b533-4ae1-8f12-772cad450114" xlink:to="loc_us-gaap_AssetsFairValueDisclosureAbstract_7b4fb520-eff8-414d-8058-d30268ce884a" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MoneyMarketFundsAtCarryingValue_f6b41954-3112-4058-834e-eea3c0fb9409" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MoneyMarketFundsAtCarryingValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AssetsFairValueDisclosureAbstract_7b4fb520-eff8-414d-8058-d30268ce884a" xlink:to="loc_us-gaap_MoneyMarketFundsAtCarryingValue_f6b41954-3112-4058-834e-eea3c0fb9409" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_fdf62930-1dbd-4c16-affc-425a9ff02908" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtSecurities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AssetsFairValueDisclosureAbstract_7b4fb520-eff8-414d-8058-d30268ce884a" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_fdf62930-1dbd-4c16-affc-425a9ff02908" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ForeignCurrencyContractAssetFairValueDisclosure_7d35ea37-a965-4f1b-933c-b16198610ff6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ForeignCurrencyContractAssetFairValueDisclosure"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AssetsFairValueDisclosureAbstract_7b4fb520-eff8-414d-8058-d30268ce884a" xlink:to="loc_us-gaap_ForeignCurrencyContractAssetFairValueDisclosure_7d35ea37-a965-4f1b-933c-b16198610ff6" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilitiesFairValueDisclosureAbstract_f4c28b7d-7a4b-41bf-9427-83e54d3ef25f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LiabilitiesFairValueDisclosureAbstract"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_3046db14-b533-4ae1-8f12-772cad450114" xlink:to="loc_us-gaap_LiabilitiesFairValueDisclosureAbstract_f4c28b7d-7a4b-41bf-9427-83e54d3ef25f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure_f6ec620a-6ce8-4ad7-8d4c-35ef2371575f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LiabilitiesFairValueDisclosureAbstract_f4c28b7d-7a4b-41bf-9427-83e54d3ef25f" xlink:to="loc_us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure_f6ec620a-6ce8-4ad7-8d4c-35ef2371575f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_3e20c22f-1ec7-4fba-9f8f-827addbcf667" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_3046db14-b533-4ae1-8f12-772cad450114" xlink:to="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_3e20c22f-1ec7-4fba-9f8f-827addbcf667" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueByFairValueHierarchyLevelAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_3e20c22f-1ec7-4fba-9f8f-827addbcf667" xlink:to="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementsFairValueHierarchyDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f" xlink:to="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_ba6e52d4-8174-4702-8fd3-9c209a0a205e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementsFairValueHierarchyDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_f8243ebf-0c3c-44fe-b2b8-d5efa1ccff5f" xlink:to="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_ba6e52d4-8174-4702-8fd3-9c209a0a205e" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueInputsLevel1Member_1698684c-47fc-4dcf-a7e6-5af3c6b69fe8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueInputsLevel1Member"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_ba6e52d4-8174-4702-8fd3-9c209a0a205e" xlink:to="loc_us-gaap_FairValueInputsLevel1Member_1698684c-47fc-4dcf-a7e6-5af3c6b69fe8" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueInputsLevel2Member_a46cd3c2-b651-4045-8d59-b166de684c3f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueInputsLevel2Member"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_ba6e52d4-8174-4702-8fd3-9c209a0a205e" xlink:to="loc_us-gaap_FairValueInputsLevel2Member_a46cd3c2-b651-4045-8d59-b166de684c3f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueByMeasurementFrequencyAxis_413b057a-4569-47aa-bc52-18ea5ccaa524" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueByMeasurementFrequencyAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_3e20c22f-1ec7-4fba-9f8f-827addbcf667" xlink:to="loc_us-gaap_FairValueByMeasurementFrequencyAxis_413b057a-4569-47aa-bc52-18ea5ccaa524" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementFrequencyDomain_413b057a-4569-47aa-bc52-18ea5ccaa524_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementFrequencyDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FairValueByMeasurementFrequencyAxis_413b057a-4569-47aa-bc52-18ea5ccaa524" xlink:to="loc_us-gaap_FairValueMeasurementFrequencyDomain_413b057a-4569-47aa-bc52-18ea5ccaa524_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementFrequencyDomain_d5a41bdf-1936-46c9-9fe6-0650839f5281" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementFrequencyDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FairValueByMeasurementFrequencyAxis_413b057a-4569-47aa-bc52-18ea5ccaa524" xlink:to="loc_us-gaap_FairValueMeasurementFrequencyDomain_d5a41bdf-1936-46c9-9fe6-0650839f5281" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementsRecurringMember_d2d4d5f7-411f-4167-bff6-c43100ec6e18" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementsRecurringMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementFrequencyDomain_d5a41bdf-1936-46c9-9fe6-0650839f5281" xlink:to="loc_us-gaap_FairValueMeasurementsRecurringMember_d2d4d5f7-411f-4167-bff6-c43100ec6e18" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FinancialInstrumentAxis_2ef388f4-a0c3-4536-b600-73fe16026654" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FinancialInstrumentAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_3e20c22f-1ec7-4fba-9f8f-827addbcf667" xlink:to="loc_us-gaap_FinancialInstrumentAxis_2ef388f4-a0c3-4536-b600-73fe16026654" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_2ef388f4-a0c3-4536-b600-73fe16026654_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FinancialInstrumentAxis_2ef388f4-a0c3-4536-b600-73fe16026654" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_2ef388f4-a0c3-4536-b600-73fe16026654_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FinancialInstrumentAxis_2ef388f4-a0c3-4536-b600-73fe16026654" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CorporateBondSecuritiesMember_d5372450-025d-407c-976f-63de74b50397" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CorporateBondSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_CorporateBondSecuritiesMember_d5372450-025d-407c-976f-63de74b50397" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_USTreasurySecuritiesMember_4b1acbb9-0613-48a0-a059-dfdfef23f5cc" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_USTreasurySecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_USTreasurySecuritiesMember_4b1acbb9-0613-48a0-a059-dfdfef23f5cc" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetBackedSecuritiesMember_d0786ec3-02ef-4fb9-a43a-e1a41f7f540a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetBackedSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_AssetBackedSecuritiesMember_d0786ec3-02ef-4fb9-a43a-e1a41f7f540a" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AgencyBondsMember_2a05f4ed-ce2a-47ef-a0f3-7d1718939351" xlink:href="cgnx-20210404.xsd#cgnx_AgencyBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_cgnx_AgencyBondsMember_2a05f4ed-ce2a-47ef-a0f3-7d1718939351" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SovereignDebtSecuritiesMember_c19f0573-1480-4588-bb8f-372be783453a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SovereignDebtSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_SovereignDebtSecuritiesMember_c19f0573-1480-4588-bb8f-372be783453a" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CommercialPaperMember_688b1bd6-a3f7-476e-b8f9-75d5db5a1331" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CommercialPaperMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_CommercialPaperMember_688b1bd6-a3f7-476e-b8f9-75d5db5a1331" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MunicipalBondsMember_d9239805-916a-4f47-91bb-723941dced6c" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MunicipalBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4809caf1-48a6-4c88-89dd-416d8fce1bf7" xlink:to="loc_us-gaap_MunicipalBondsMember_d9239805-916a-4f47-91bb-723941dced6c" xlink:type="arc" order="6"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/FairValueMeasurementsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#FairValueMeasurementsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/FairValueMeasurementsDetails" xlink:type="extended" id="i614c6c49611945e48e48f7c49ace0f83_FairValueMeasurementsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_188fad02-02cf-4d26-84ad-bfcccb3760a6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueMeasurementWithUnobservableInputsReconciliationsRecurringBasisLiabilityValue_55045ceb-7022-48de-95b4-618c3c7825dd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueMeasurementWithUnobservableInputsReconciliationsRecurringBasisLiabilityValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_188fad02-02cf-4d26-84ad-bfcccb3760a6" xlink:to="loc_us-gaap_FairValueMeasurementWithUnobservableInputsReconciliationsRecurringBasisLiabilityValue_55045ceb-7022-48de-95b4-618c3c7825dd" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueLow_76c6938c-35d6-4a83-a2ce-3b22f9e6fbe8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueLow"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_188fad02-02cf-4d26-84ad-bfcccb3760a6" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueLow_76c6938c-35d6-4a83-a2ce-3b22f9e6fbe8" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueHigh_a97e31bc-4d0c-4605-9b7a-f2ce6022bbbf" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueHigh"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_188fad02-02cf-4d26-84ad-bfcccb3760a6" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsRangeOfOutcomesValueHigh_a97e31bc-4d0c-4605-9b7a-f2ce6022bbbf" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_4665f55d-1182-4a90-9198-975c7c784317" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_188fad02-02cf-4d26-84ad-bfcccb3760a6" xlink:to="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_4665f55d-1182-4a90-9198-975c7c784317" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BusinessAcquisitionAxis_1c110480-e6fd-4d6c-8487-04dc8452e3c8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BusinessAcquisitionAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_4665f55d-1182-4a90-9198-975c7c784317" xlink:to="loc_us-gaap_BusinessAcquisitionAxis_1c110480-e6fd-4d6c-8487-04dc8452e3c8" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1c110480-e6fd-4d6c-8487-04dc8452e3c8_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BusinessAcquisitionAcquireeDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_1c110480-e6fd-4d6c-8487-04dc8452e3c8" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1c110480-e6fd-4d6c-8487-04dc8452e3c8_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_2ff0fad5-7865-46f6-b989-744750be63c2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BusinessAcquisitionAcquireeDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_1c110480-e6fd-4d6c-8487-04dc8452e3c8" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_2ff0fad5-7865-46f6-b989-744750be63c2" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_GViVenturesInc.Member_891ae250-d016-4fe9-9bde-fd49884ce683" xlink:href="cgnx-20210404.xsd#cgnx_GViVenturesInc.Member"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_2ff0fad5-7865-46f6-b989-744750be63c2" xlink:to="loc_cgnx_GViVenturesInc.Member_891ae250-d016-4fe9-9bde-fd49884ce683" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestments" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestments"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestments" xlink:type="extended" id="i2fefbf70c9f74da0afe49fd379f72c9b_CashCashEquivalentsandInvestments"/>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsTables" xlink:type="extended" id="i687df4b6a9294d1ca25b85b9f7b36b4e_CashCashEquivalentsandInvestmentsTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsDetails" xlink:type="extended" id="i852dc9b11ed7449b853c9e9adae4145a_CashCashEquivalentsandInvestmentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CashAndCashEquivalentsLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InterestReceivable_a5814a9a-5a19-4623-b97c-1e7192948c74" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_InterestReceivable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_InterestReceivable_a5814a9a-5a19-4623-b97c-1e7192948c74" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLoss_c3938d41-26e4-4e65-ad5a-98f51dd3d68f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLoss"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLoss_c3938d41-26e4-4e65-ad5a-98f51dd3d68f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLossPeriodIncreaseDecrease_6f73bae0-a396-409b-b05f-854b94ecc430" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLossPeriodIncreaseDecrease"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleAllowanceForCreditLossPeriodIncreaseDecrease_6f73bae0-a396-409b-b05f-854b94ecc430" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesGrossRealizedGains_04411b2f-78f4-441f-b552-c939e19a9648" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesGrossRealizedGains"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesGrossRealizedGains_04411b2f-78f4-441f-b552-c939e19a9648" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesGrossRealizedLosses_44b242bd-abc9-44ea-b45a-a646bbfff030" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesGrossRealizedLosses"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesGrossRealizedLosses_44b242bd-abc9-44ea-b45a-a646bbfff030" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfCashAndCashEquivalentsTable_31fcae92-7df4-44f6-aecc-853287ea634e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfCashAndCashEquivalentsTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_CashAndCashEquivalentsLineItems_8d8ba2d2-596c-496a-9329-7dcd56ea12a8" xlink:to="loc_us-gaap_ScheduleOfCashAndCashEquivalentsTable_31fcae92-7df4-44f6-aecc-853287ea634e" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationAxis_87b688b3-0338-4eba-b534-948d376117be" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfCashAndCashEquivalentsTable_31fcae92-7df4-44f6-aecc-853287ea634e" xlink:to="loc_us-gaap_BalanceSheetLocationAxis_87b688b3-0338-4eba-b534-948d376117be" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_87b688b3-0338-4eba-b534-948d376117be_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_87b688b3-0338-4eba-b534-948d376117be" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_87b688b3-0338-4eba-b534-948d376117be_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_15a8c612-db67-443b-a46a-7c5699b6257b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_87b688b3-0338-4eba-b534-948d376117be" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_15a8c612-db67-443b-a46a-7c5699b6257b" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherCurrentAssetsMember_0b99f126-d0b6-4868-8dab-d5ac8216f32d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherCurrentAssetsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BalanceSheetLocationDomain_15a8c612-db67-443b-a46a-7c5699b6257b" xlink:to="loc_us-gaap_OtherCurrentAssetsMember_0b99f126-d0b6-4868-8dab-d5ac8216f32d" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsComponentsofCashCashEquivalentsandInvestmentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsComponentsofCashCashEquivalentsandInvestmentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsComponentsofCashCashEquivalentsandInvestmentsDetails" xlink:type="extended" id="i2a9a862c39fc48d9a8f31e1b77b86b6d_CashCashEquivalentsandInvestmentsComponentsofCashCashEquivalentsandInvestmentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_Cash_97eafd9b-5cc7-49ba-8a23-f273f1996a71" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_Cash"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_Cash_97eafd9b-5cc7-49ba-8a23-f273f1996a71" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CommercialPaperAtCarryingValue_b573abf6-269d-40cd-b235-da4637efee4e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CommercialPaperAtCarryingValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_CommercialPaperAtCarryingValue_b573abf6-269d-40cd-b235-da4637efee4e" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MoneyMarketFundsAtCarryingValue_36c5d2e8-9ac0-4caa-a0f6-47565b794e6d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MoneyMarketFundsAtCarryingValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_MoneyMarketFundsAtCarryingValue_36c5d2e8-9ac0-4caa-a0f6-47565b794e6d" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue_85280c13-c430-4808-88ec-8daebe366525" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CashAndCashEquivalentsAtCarryingValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_CashAndCashEquivalentsAtCarryingValue_85280c13-c430-4808-88ec-8daebe366525" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtSecuritiesCurrent_15ec87fa-2e35-421e-8463-dd032ab97764" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtSecuritiesCurrent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtSecuritiesCurrent_15ec87fa-2e35-421e-8463-dd032ab97764" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtSecuritiesNoncurrent_333c7326-6fe8-4887-995d-c53d1b93c9ab" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtSecuritiesNoncurrent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtSecuritiesNoncurrent_333c7326-6fe8-4887-995d-c53d1b93c9ab" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LongTermInvestments_ce5d2e49-5b5c-493b-a46d-c313a2de0aa7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LongTermInvestments"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_LongTermInvestments_ce5d2e49-5b5c-493b-a46d-c313a2de0aa7" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_CashCashEquivalentsShortTermAndLongTermInvestments_d1e60e8a-0bb3-4588-911a-47a0f176b886" xlink:href="cgnx-20210404.xsd#cgnx_CashCashEquivalentsShortTermAndLongTermInvestments"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_cgnx_CashCashEquivalentsShortTermAndLongTermInvestments_d1e60e8a-0bb3-4588-911a-47a0f176b886" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_26370b85-fb00-403b-a191-3cacdf1f62df" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_36a35022-2448-441a-8409-210573a826cf" xlink:to="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_26370b85-fb00-403b-a191-3cacdf1f62df" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FinancialInstrumentAxis_3cb1889d-35e3-475c-8e36-b3e7e67d51b3" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FinancialInstrumentAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_26370b85-fb00-403b-a191-3cacdf1f62df" xlink:to="loc_us-gaap_FinancialInstrumentAxis_3cb1889d-35e3-475c-8e36-b3e7e67d51b3" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_3cb1889d-35e3-475c-8e36-b3e7e67d51b3_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FinancialInstrumentAxis_3cb1889d-35e3-475c-8e36-b3e7e67d51b3" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_3cb1889d-35e3-475c-8e36-b3e7e67d51b3_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FinancialInstrumentAxis_3cb1889d-35e3-475c-8e36-b3e7e67d51b3" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_USTreasurySecuritiesMember_10484a57-86f7-4354-b784-677c8bd2bb5b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_USTreasurySecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_us-gaap_USTreasurySecuritiesMember_10484a57-86f7-4354-b784-677c8bd2bb5b" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CorporateBondSecuritiesMember_d500f920-f6b8-4715-a9c8-6073c70f6941" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CorporateBondSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_us-gaap_CorporateBondSecuritiesMember_d500f920-f6b8-4715-a9c8-6073c70f6941" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetBackedSecuritiesMember_dbb731cd-2b3a-4e7e-a98a-3932653f79ea" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetBackedSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_us-gaap_AssetBackedSecuritiesMember_dbb731cd-2b3a-4e7e-a98a-3932653f79ea" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AgencyBondsMember_c92df969-2721-4938-9aff-3f69d5cd6707" xlink:href="cgnx-20210404.xsd#cgnx_AgencyBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_cgnx_AgencyBondsMember_c92df969-2721-4938-9aff-3f69d5cd6707" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MunicipalBondsMember_936fe4e8-7017-4219-8db4-f5e3e73133be" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MunicipalBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_us-gaap_MunicipalBondsMember_936fe4e8-7017-4219-8db4-f5e3e73133be" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SovereignDebtMember_fef67a90-c740-4156-9c69-a149f6c17c18" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SovereignDebtMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_67f66e4d-cd15-4c69-ac85-4c8de70b28ce" xlink:to="loc_us-gaap_SovereignDebtMember_fef67a90-c740-4156-9c69-a149f6c17c18" xlink:type="arc" order="5"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsSummaryofAvailableforSaleInvestmentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsSummaryofAvailableforSaleInvestmentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsSummaryofAvailableforSaleInvestmentsDetails" xlink:type="extended" id="ia8b7628366f147e4a993488354c5a399_CashCashEquivalentsandInvestmentsSummaryofAvailableforSaleInvestmentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleDebtSecuritiesAmortizedCostBasis_8f006ade-b147-4262-b59c-21bb1ca2b060" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleDebtSecuritiesAmortizedCostBasis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:to="loc_us-gaap_AvailableForSaleDebtSecuritiesAmortizedCostBasis_8f006ade-b147-4262-b59c-21bb1ca2b060" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedGainBeforeTax_dfbad2d4-a9e5-49d6-943d-e7f926554600" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedGainBeforeTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:to="loc_us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedGainBeforeTax_dfbad2d4-a9e5-49d6-943d-e7f926554600" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedLossBeforeTax_07b87de0-e169-421c-9821-60172fb5dc13" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedLossBeforeTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:to="loc_us-gaap_AvailableForSaleDebtSecuritiesAccumulatedGrossUnrealizedLossBeforeTax_07b87de0-e169-421c-9821-60172fb5dc13" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_4410430c-f229-411a-aa89-013275010212" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtSecurities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_4410430c-f229-411a-aa89-013275010212" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_25b3da21-24a8-4bd0-bedd-e4563e62ab41" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4a7a4c85-c7c6-4f22-992f-ea26fc6968b1" xlink:to="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_25b3da21-24a8-4bd0-bedd-e4563e62ab41" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FinancialInstrumentAxis_5c8785e5-beb0-4053-a628-30c752214925" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FinancialInstrumentAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_25b3da21-24a8-4bd0-bedd-e4563e62ab41" xlink:to="loc_us-gaap_FinancialInstrumentAxis_5c8785e5-beb0-4053-a628-30c752214925" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_5c8785e5-beb0-4053-a628-30c752214925_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FinancialInstrumentAxis_5c8785e5-beb0-4053-a628-30c752214925" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_5c8785e5-beb0-4053-a628-30c752214925_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FinancialInstrumentAxis_5c8785e5-beb0-4053-a628-30c752214925" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AgencyBondsMember_faa4991c-b1d4-4a79-85f5-a849a9cfce43" xlink:href="cgnx-20210404.xsd#cgnx_AgencyBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_cgnx_AgencyBondsMember_faa4991c-b1d4-4a79-85f5-a849a9cfce43" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_USTreasurySecuritiesMember_402fe383-c2c2-41f4-a6a0-92e2cfe6a16d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_USTreasurySecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_us-gaap_USTreasurySecuritiesMember_402fe383-c2c2-41f4-a6a0-92e2cfe6a16d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CorporateBondSecuritiesMember_b04e9a5b-7379-425a-9f16-3ca54a07c436" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CorporateBondSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_us-gaap_CorporateBondSecuritiesMember_b04e9a5b-7379-425a-9f16-3ca54a07c436" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetBackedSecuritiesMember_67539834-c0ac-4fee-91f1-4d534bace60a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetBackedSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_us-gaap_AssetBackedSecuritiesMember_67539834-c0ac-4fee-91f1-4d534bace60a" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SovereignDebtSecuritiesMember_0f843ddb-95eb-498f-8b83-3272ad3187d2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SovereignDebtSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_us-gaap_SovereignDebtSecuritiesMember_0f843ddb-95eb-498f-8b83-3272ad3187d2" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MunicipalBondsMember_e2557f37-504d-48ca-974a-a4e9d3a153dd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MunicipalBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_4a95ef07-02d0-48ca-aa5c-8de8abee62f7" xlink:to="loc_us-gaap_MunicipalBondsMember_e2557f37-504d-48ca-974a-a4e9d3a153dd" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InvestmentTypeAxis_f1f11231-cc30-4589-be6c-0572b83a5c6d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_InvestmentTypeAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_25b3da21-24a8-4bd0-bedd-e4563e62ab41" xlink:to="loc_us-gaap_InvestmentTypeAxis_f1f11231-cc30-4589-be6c-0572b83a5c6d" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InvestmentTypeCategorizationMember_f1f11231-cc30-4589-be6c-0572b83a5c6d_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_InvestmentTypeCategorizationMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_InvestmentTypeAxis_f1f11231-cc30-4589-be6c-0572b83a5c6d" xlink:to="loc_us-gaap_InvestmentTypeCategorizationMember_f1f11231-cc30-4589-be6c-0572b83a5c6d_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_InvestmentTypeCategorizationMember_d1c2c8cb-81f6-429f-a1f0-ce66dda9f435" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_InvestmentTypeCategorizationMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_InvestmentTypeAxis_f1f11231-cc30-4589-be6c-0572b83a5c6d" xlink:to="loc_us-gaap_InvestmentTypeCategorizationMember_d1c2c8cb-81f6-429f-a1f0-ce66dda9f435" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShortTermInvestmentsMember_f027bd8b-26f2-4593-b6c1-4956b8209371" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShortTermInvestmentsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_InvestmentTypeCategorizationMember_d1c2c8cb-81f6-429f-a1f0-ce66dda9f435" xlink:to="loc_us-gaap_ShortTermInvestmentsMember_f027bd8b-26f2-4593-b6c1-4956b8209371" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_LongTermInvestmentsMember_7f84c7f0-a424-4876-a5e4-600860fa21e1" xlink:href="cgnx-20210404.xsd#cgnx_LongTermInvestmentsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_InvestmentTypeCategorizationMember_d1c2c8cb-81f6-429f-a1f0-ce66dda9f435" xlink:to="loc_cgnx_LongTermInvestmentsMember_7f84c7f0-a424-4876-a5e4-600860fa21e1" xlink:type="arc" order="1"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsGrossUnrealizedLossesandFairValuesforAvailableforSaleInvestmentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsGrossUnrealizedLossesandFairValuesforAvailableforSaleInvestmentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsGrossUnrealizedLossesandFairValuesforAvailableforSaleInvestmentsDetails" xlink:type="extended" id="i2feefb5ed95d4c0c9cbcb6a44f989ef0_CashCashEquivalentsandInvestmentsGrossUnrealizedLossesandFairValuesforAvailableforSaleInvestmentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12Months_a7f272ad-551e-4f28-b5d4-016d74ea36ce" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12Months"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12Months_a7f272ad-551e-4f28-b5d4-016d74ea36ce" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12MonthsAccumulatedLoss_f5ed97b3-f66e-42f7-ad65-efa91947aa65" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12MonthsAccumulatedLoss"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPositionLessThan12MonthsAccumulatedLoss_f5ed97b3-f66e-42f7-ad65-efa91947aa65" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLonger_73a8303a-c4af-438f-93c2-d52cf3311d22" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLonger"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLonger_73a8303a-c4af-438f-93c2-d52cf3311d22" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLongerAccumulatedLoss_5c90df49-1a07-4f22-aaaa-18b66223b8ad" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLongerAccumulatedLoss"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleContinuousUnrealizedLossPosition12MonthsOrLongerAccumulatedLoss_5c90df49-1a07-4f22-aaaa-18b66223b8ad" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPosition_70713231-e5fa-415d-8efa-f0c37ed1fe4e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPosition"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPosition_70713231-e5fa-415d-8efa-f0c37ed1fe4e" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPositionAccumulatedLoss_f7b78906-ea22-4abb-992a-719e873e9cca" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPositionAccumulatedLoss"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_DebtSecuritiesAvailableForSaleUnrealizedLossPositionAccumulatedLoss_f7b78906-ea22-4abb-992a-719e873e9cca" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_a7cc5ab4-08aa-4985-b0b6-13464542375b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_00e7c9ac-5baa-4c6c-b5ac-c8e2eabb5651" xlink:to="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_a7cc5ab4-08aa-4985-b0b6-13464542375b" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FinancialInstrumentAxis_b0d10c3a-aab9-4971-913d-f75b009f7878" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FinancialInstrumentAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_a7cc5ab4-08aa-4985-b0b6-13464542375b" xlink:to="loc_us-gaap_FinancialInstrumentAxis_b0d10c3a-aab9-4971-913d-f75b009f7878" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_b0d10c3a-aab9-4971-913d-f75b009f7878_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FinancialInstrumentAxis_b0d10c3a-aab9-4971-913d-f75b009f7878" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_b0d10c3a-aab9-4971-913d-f75b009f7878_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_60218f86-443d-4178-baf5-3debc5bd8219" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FinancialInstrumentAxis_b0d10c3a-aab9-4971-913d-f75b009f7878" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_60218f86-443d-4178-baf5-3debc5bd8219" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CorporateBondSecuritiesMember_122de2af-e4fd-4d24-b61e-bc5edf98b6d8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CorporateBondSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_60218f86-443d-4178-baf5-3debc5bd8219" xlink:to="loc_us-gaap_CorporateBondSecuritiesMember_122de2af-e4fd-4d24-b61e-bc5edf98b6d8" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MunicipalBondsMember_3ce35716-dcab-4575-9384-50ee9e4a6911" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MunicipalBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_60218f86-443d-4178-baf5-3debc5bd8219" xlink:to="loc_us-gaap_MunicipalBondsMember_3ce35716-dcab-4575-9384-50ee9e4a6911" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetBackedSecuritiesMember_8392233e-bed5-408b-b4d9-7f7383a93b83" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetBackedSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_60218f86-443d-4178-baf5-3debc5bd8219" xlink:to="loc_us-gaap_AssetBackedSecuritiesMember_8392233e-bed5-408b-b4d9-7f7383a93b83" xlink:type="arc" order="2"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsCashCashEquivalentsandInvestmentsScheduleofAllowanceforCreditLossActivityDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsCashCashEquivalentsandInvestmentsScheduleofAllowanceforCreditLossActivityDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsCashCashEquivalentsandInvestmentsScheduleofAllowanceforCreditLossActivityDetails" xlink:type="extended" id="ia392156b878a4d64b75f471d17d2b63c_CashCashEquivalentsandInvestmentsCashCashEquivalentsandInvestmentsScheduleofAllowanceforCreditLossActivityDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsEffectiveMaturityDatesofAvailableforSaleInvestmentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#CashCashEquivalentsandInvestmentsEffectiveMaturityDatesofAvailableforSaleInvestmentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/CashCashEquivalentsandInvestmentsEffectiveMaturityDatesofAvailableforSaleInvestmentsDetails" xlink:type="extended" id="ib58d4accf918417faf69f9895e326466_CashCashEquivalentsandInvestmentsEffectiveMaturityDatesofAvailableforSaleInvestmentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtMaturitiesWithinOneYearFairValue_ee5b907f-cc3a-435f-9b68-cc64e300e07f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtMaturitiesWithinOneYearFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtMaturitiesWithinOneYearFairValue_ee5b907f-cc3a-435f-9b68-cc64e300e07f" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterOneYearBeforeTwoYearsFairValue_503fbb00-ee8c-43eb-8223-b0a624ce1b6b" xlink:href="cgnx-20210404.xsd#cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterOneYearBeforeTwoYearsFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterOneYearBeforeTwoYearsFairValue_503fbb00-ee8c-43eb-8223-b0a624ce1b6b" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterTwoYearsBeforeThreeYearsFairValue_4bf6a0ab-68b5-4713-bac2-361c94fcb2e3" xlink:href="cgnx-20210404.xsd#cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterTwoYearsBeforeThreeYearsFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterTwoYearsBeforeThreeYearsFairValue_4bf6a0ab-68b5-4713-bac2-361c94fcb2e3" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterThreeYearsBeforeFourYearsFairValue_823df7cc-5945-4cf6-ad42-99b3e1269cbd" xlink:href="cgnx-20210404.xsd#cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterThreeYearsBeforeFourYearsFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterThreeYearsBeforeFourYearsFairValue_823df7cc-5945-4cf6-ad42-99b3e1269cbd" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterFourYearsBeforeFiveYearsFairValue_e08074e9-7075-4a77-ab8e-3d4747fabd43" xlink:href="cgnx-20210404.xsd#cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterFourYearsBeforeFiveYearsFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_cgnx_AvailableForSaleSecuritiesDebtMaturitiesAfterFourYearsBeforeFiveYearsFairValue_e08074e9-7075-4a77-ab8e-3d4747fabd43" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_58469514-bb21-42be-b7a2-ed8767c909ed" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AvailableForSaleSecuritiesDebtSecurities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_us-gaap_AvailableForSaleSecuritiesDebtSecurities_58469514-bb21-42be-b7a2-ed8767c909ed" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_74cc6543-dbdc-4b51-ba69-43a1c79a4675" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfAvailableForSaleSecuritiesTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesLineItems_4735ea37-ac2b-4a87-81f4-88f2cae018e6" xlink:to="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_74cc6543-dbdc-4b51-ba69-43a1c79a4675" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FinancialInstrumentAxis_38120acb-3c9d-44f2-b8e4-6bd44e52c64d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FinancialInstrumentAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfAvailableForSaleSecuritiesTable_74cc6543-dbdc-4b51-ba69-43a1c79a4675" xlink:to="loc_us-gaap_FinancialInstrumentAxis_38120acb-3c9d-44f2-b8e4-6bd44e52c64d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_38120acb-3c9d-44f2-b8e4-6bd44e52c64d_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FinancialInstrumentAxis_38120acb-3c9d-44f2-b8e4-6bd44e52c64d" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_38120acb-3c9d-44f2-b8e4-6bd44e52c64d_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FinancialInstrumentAxis_38120acb-3c9d-44f2-b8e4-6bd44e52c64d" xlink:to="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CorporateBondSecuritiesMember_ae76dd22-7d70-4bda-8f0d-592a7d06b628" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CorporateBondSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_us-gaap_CorporateBondSecuritiesMember_ae76dd22-7d70-4bda-8f0d-592a7d06b628" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_USTreasurySecuritiesMember_3a635a5c-1364-42f4-b0a5-2bc9bdd1bae8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_USTreasurySecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_us-gaap_USTreasurySecuritiesMember_3a635a5c-1364-42f4-b0a5-2bc9bdd1bae8" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AssetBackedSecuritiesMember_a6c2d1dd-73e4-4bf2-863e-558cbdd7aaab" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AssetBackedSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_us-gaap_AssetBackedSecuritiesMember_a6c2d1dd-73e4-4bf2-863e-558cbdd7aaab" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AgencyBondsMember_f2786679-4428-49d9-a042-5da96b7c7d90" xlink:href="cgnx-20210404.xsd#cgnx_AgencyBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_cgnx_AgencyBondsMember_f2786679-4428-49d9-a042-5da96b7c7d90" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SovereignDebtSecuritiesMember_fa5691c9-a99c-47ff-af55-674b1261f790" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SovereignDebtSecuritiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_us-gaap_SovereignDebtSecuritiesMember_fa5691c9-a99c-47ff-af55-674b1261f790" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MunicipalBondsMember_f29f2a5e-3524-4c95-bfaa-932b8fa9b90f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MunicipalBondsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TransfersAndServicingOfFinancialInstrumentsTypesOfFinancialInstrumentsDomain_f925ebf5-02d9-4716-84d6-3259586a5c37" xlink:to="loc_us-gaap_MunicipalBondsMember_f29f2a5e-3524-4c95-bfaa-932b8fa9b90f" xlink:type="arc" order="5"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/Inventories" xlink:type="simple" xlink:href="cgnx-20210404.xsd#Inventories"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/Inventories" xlink:type="extended" id="i4e36b5731e514772bf6f523a4c5b8c88_Inventories"/>
  <link:roleRef roleURI="http://www.cognex.com/role/InventoriesTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#InventoriesTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/InventoriesTables" xlink:type="extended" id="ic81b29e50ac94f609ca5288a681dcc9e_InventoriesTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/InventoriesScheduleofInventoriesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#InventoriesScheduleofInventoriesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/InventoriesScheduleofInventoriesDetails" xlink:type="extended" id="iccabcb69365e4bd2a167baa5d1660570_InventoriesScheduleofInventoriesDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/Leases" xlink:type="simple" xlink:href="cgnx-20210404.xsd#Leases"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/Leases" xlink:type="extended" id="ie6fd5233570e49ab8d6bb8a572bf282d_Leases"/>
  <link:roleRef roleURI="http://www.cognex.com/role/LeasesTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#LeasesTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/LeasesTables" xlink:type="extended" id="ie68522f5135a46059a688d6486629ce2_LeasesTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/LeasesNarrativeDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#LeasesNarrativeDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/LeasesNarrativeDetails" xlink:type="extended" id="i35c50633e0504bdfbb62d71b6a3f3185_LeasesNarrativeDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LessorLeaseDescriptionLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeaseCost_54b53f23-f801-489c-82ab-9c0b10742fcd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeaseCost"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeaseCost_54b53f23-f801-489c-82ab-9c0b10742fcd" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeasePayments_6ceb56ff-074b-4773-ae3b-3a20ba95f7e4" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeasePayments"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeasePayments_6ceb56ff-074b-4773-ae3b-3a20ba95f7e4" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LeaseCost_877b4e8f-03af-4674-a33c-62b443b1f403" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LeaseCost"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_LeaseCost_877b4e8f-03af-4674-a33c-62b443b1f403" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeaseLiability_eed046c6-1610-45cc-be9b-9bf41d801918" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeaseLiability"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeaseLiability_eed046c6-1610-45cc-be9b-9bf41d801918" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeaseWeightedAverageDiscountRatePercent_f261bedf-900f-48ac-be60-414197cb2bab" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeaseWeightedAverageDiscountRatePercent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeaseWeightedAverageDiscountRatePercent_f261bedf-900f-48ac-be60-414197cb2bab" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeaseWeightedAverageRemainingLeaseTerm1_82496257-083b-407f-951e-1609c4865c2f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeaseWeightedAverageRemainingLeaseTerm1"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeaseWeightedAverageRemainingLeaseTerm1_82496257-083b-407f-951e-1609c4865c2f" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OperatingLeaseLeaseIncome_16e0d3b6-9af6-4735-918b-71a9c93b157a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OperatingLeaseLeaseIncome"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_OperatingLeaseLeaseIncome_16e0d3b6-9af6-4735-918b-71a9c93b157a" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LessorLeaseDescriptionTable_52512ae3-8d50-49f4-ba91-a68d19775d0f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LessorLeaseDescriptionTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_LessorLeaseDescriptionLineItems_4590055f-df5c-48bd-9323-2ccc02fa2e28" xlink:to="loc_us-gaap_LessorLeaseDescriptionTable_52512ae3-8d50-49f4-ba91-a68d19775d0f" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringCostAndReserveAxis_63fa8e85-8c20-437d-b414-3c872bc1928a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringCostAndReserveAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LessorLeaseDescriptionTable_52512ae3-8d50-49f4-ba91-a68d19775d0f" xlink:to="loc_us-gaap_RestructuringCostAndReserveAxis_63fa8e85-8c20-437d-b414-3c872bc1928a" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TypeOfRestructuringDomain_63fa8e85-8c20-437d-b414-3c872bc1928a_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TypeOfRestructuringDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_RestructuringCostAndReserveAxis_63fa8e85-8c20-437d-b414-3c872bc1928a" xlink:to="loc_us-gaap_TypeOfRestructuringDomain_63fa8e85-8c20-437d-b414-3c872bc1928a_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TypeOfRestructuringDomain_606824f7-0c07-4a67-a253-8f4cce80d7f2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TypeOfRestructuringDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_RestructuringCostAndReserveAxis_63fa8e85-8c20-437d-b414-3c872bc1928a" xlink:to="loc_us-gaap_TypeOfRestructuringDomain_606824f7-0c07-4a67-a253-8f4cce80d7f2" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ContractTerminationMember_b4f947bf-e218-4aeb-9140-9a7748cea3ca" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ContractTerminationMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TypeOfRestructuringDomain_606824f7-0c07-4a67-a253-8f4cce80d7f2" xlink:to="loc_us-gaap_ContractTerminationMember_b4f947bf-e218-4aeb-9140-9a7748cea3ca" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/LeasesFutureMinimumLeasePaymentObligationsUnderOperatingLeasesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#LeasesFutureMinimumLeasePaymentObligationsUnderOperatingLeasesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/LeasesFutureMinimumLeasePaymentObligationsUnderOperatingLeasesDetails" xlink:type="extended" id="i3d039bed18d2449594da6128491d0529_LeasesFutureMinimumLeasePaymentObligationsUnderOperatingLeasesDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/GoodwillNotes" xlink:type="simple" xlink:href="cgnx-20210404.xsd#GoodwillNotes"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/GoodwillNotes" xlink:type="extended" id="i9dda0c9cc94b449da6677d83bd90dac9_GoodwillNotes"/>
  <link:roleRef roleURI="http://www.cognex.com/role/GoodwillTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#GoodwillTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/GoodwillTables" xlink:type="extended" id="iae5ceb3e55f94be0a7e05123f8a1c39e_GoodwillTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/GoodwillDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#GoodwillDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/GoodwillDetails" xlink:type="extended" id="ia99532b74da0474db01bec90f3a04c70_GoodwillDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IntangibleAssets" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IntangibleAssets"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IntangibleAssets" xlink:type="extended" id="i9fa65665aaf74da48c4f7f36bc736ea8_IntangibleAssets"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IntangibleAssetsTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IntangibleAssetsTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IntangibleAssetsTables" xlink:type="extended" id="i3591a39f6f4642959e0d336581122991_IntangibleAssetsTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IntangibleAssetsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IntangibleAssetsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IntangibleAssetsDetails" xlink:type="extended" id="i154611e7bc0c49eda98754857aa616b3_IntangibleAssetsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsGross_06bb7060-41c6-4e96-bdae-2db09733e94b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsGross"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsGross_06bb7060-41c6-4e96-bdae-2db09733e94b" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization_6225a0c6-19f4-490d-81b2-4bbb394b33e6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization_6225a0c6-19f4-490d-81b2-4bbb394b33e6" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsNet_446011d9-89f9-4aa4-acfd-eb8be690335a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsNet"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsNet_446011d9-89f9-4aa4-acfd-eb8be690335a" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseRemainderOfFiscalYear_efcd94e2-3254-47b6-a76a-1d5d07114f84" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseRemainderOfFiscalYear"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseRemainderOfFiscalYear_efcd94e2-3254-47b6-a76a-1d5d07114f84" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseNextTwelveMonths_24bccea2-1f84-49ee-a6d4-59b8b2046b52" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseNextTwelveMonths"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseNextTwelveMonths_24bccea2-1f84-49ee-a6d4-59b8b2046b52" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearTwo_d66679de-3b7f-4b00-9c74-a626a396285b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearTwo"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearTwo_d66679de-3b7f-4b00-9c74-a626a396285b" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearThree_eca34cd9-c16a-4ec6-b802-0f731821543d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearThree"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearThree_eca34cd9-c16a-4ec6-b802-0f731821543d" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFour_3648a84e-8a8c-49a6-9dea-659fe941351c" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFour"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFour_3648a84e-8a8c-49a6-9dea-659fe941351c" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFive_5d2a38e8-1d00-4c75-813d-ee2bbdebbad1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFive"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseYearFive_5d2a38e8-1d00-4c75-813d-ee2bbdebbad1" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseAfterYearFive_e4d6ba1f-81db-40ca-b289-762c14c3afcc" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseAfterYearFive"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsFutureAmortizationExpenseAbstract_b1216bbc-cb8b-44fc-843a-c28a53d6518f" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAmortizationExpenseAfterYearFive_e4d6ba1f-81db-40ca-b289-762c14c3afcc" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsNet_fbf0b03d-7954-4cb3-889c-97caeb2c5743" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsNet"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfFiniteLivedIntangibleAssetsTable_31039fa8-107a-47d0-96ad-737af01ca4a7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfFiniteLivedIntangibleAssetsTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsLineItems_8ff7d271-50ec-479d-a0a7-c5184cb07130" xlink:to="loc_us-gaap_ScheduleOfFiniteLivedIntangibleAssetsTable_31039fa8-107a-47d0-96ad-737af01ca4a7" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfFiniteLivedIntangibleAssetsTable_31039fa8-107a-47d0-96ad-737af01ca4a7" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_64d0b3d2-3596-4e47-9cb9-0cc9feac1ce3" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DistributionRightsMember_fdeef8b5-0893-4e32-a9b7-a4cff91e9eff" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DistributionRightsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_us-gaap_DistributionRightsMember_fdeef8b5-0893-4e32-a9b7-a4cff91e9eff" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DevelopedTechnologyRightsMember_fccd09d8-8c2d-4544-82cf-e4155e4d625e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DevelopedTechnologyRightsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_us-gaap_DevelopedTechnologyRightsMember_fccd09d8-8c2d-4544-82cf-e4155e4d625e" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_CustomerContractsAndRelationshipsMember_aa555098-3428-48be-9b79-7ed5f310cbdf" xlink:href="cgnx-20210404.xsd#cgnx_CustomerContractsAndRelationshipsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_cgnx_CustomerContractsAndRelationshipsMember_aa555098-3428-48be-9b79-7ed5f310cbdf" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherIntangibleAssetsMember_f06c863c-a029-4a95-b6eb-52c563b27b57" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherIntangibleAssetsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_us-gaap_OtherIntangibleAssetsMember_f06c863c-a029-4a95-b6eb-52c563b27b57" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TrademarksMember_7f8229cc-57d3-4317-af01-5952456b6a85" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TrademarksMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_us-gaap_TrademarksMember_7f8229cc-57d3-4317-af01-5952456b6a85" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_DistributionRightsDevelopedTechnologyRightsCustomerContractsAndRelationshipsOtherIntangibleAssetsAndTrademarksMember_f0d57a8f-a1a8-44eb-8528-c9e11c912a81" xlink:href="cgnx-20210404.xsd#cgnx_DistributionRightsDevelopedTechnologyRightsCustomerContractsAndRelationshipsOtherIntangibleAssetsAndTrademarksMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_6afa941b-0b40-42e2-8729-36ea2f1d785b" xlink:to="loc_cgnx_DistributionRightsDevelopedTechnologyRightsCustomerContractsAndRelationshipsOtherIntangibleAssetsAndTrademarksMember_f0d57a8f-a1a8-44eb-8528-c9e11c912a81" xlink:type="arc" order="5"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/WarrantyObligations" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WarrantyObligations"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WarrantyObligations" xlink:type="extended" id="ib574a1a1e13848dab7a603ff5e6fcfb8_WarrantyObligations"/>
  <link:roleRef roleURI="http://www.cognex.com/role/WarrantyObligationsTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WarrantyObligationsTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WarrantyObligationsTables" xlink:type="extended" id="i594ffaadb7834c1287ee5e30589aa596_WarrantyObligationsTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/WarrantyObligationsChangesinWarrantyObligationsDetail" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WarrantyObligationsChangesinWarrantyObligationsDetail"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WarrantyObligationsChangesinWarrantyObligationsDetail" xlink:type="extended" id="iaeb01cbcb5c048fca9a56339d1039292_WarrantyObligationsChangesinWarrantyObligationsDetail"/>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstruments" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstruments"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstruments" xlink:type="extended" id="i42d348121191425189bdde90fe1fba80_DerivativeInstruments"/>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsTables" xlink:type="extended" id="i889669e496e448f48e0e4984cfb198b9_DerivativeInstrumentsTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsDetails" xlink:type="extended" id="i23b206e1f52a401b9d9b7a1531a12b39_DerivativeInstrumentsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresLineItems_abf756a7-2807-4cc5-87aa-f0126afbf490" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_MaximumRemainingMaturityOfForeignCurrencyDerivatives1_95c9211f-9a4f-4c02-80c3-b970829385b8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_MaximumRemainingMaturityOfForeignCurrencyDerivatives1"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresLineItems_abf756a7-2807-4cc5-87aa-f0126afbf490" xlink:to="loc_us-gaap_MaximumRemainingMaturityOfForeignCurrencyDerivatives1_95c9211f-9a4f-4c02-80c3-b970829385b8" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresTable_428431cc-ba37-4338-8716-2478d09a230b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresLineItems_abf756a7-2807-4cc5-87aa-f0126afbf490" xlink:to="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresTable_428431cc-ba37-4338-8716-2478d09a230b" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationAxis_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DerivativeInstrumentsAndHedgingActivitiesDisclosuresTable_428431cc-ba37-4338-8716-2478d09a230b" xlink:to="loc_us-gaap_HedgingDesignationAxis_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_HedgingDesignationAxis_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0" xlink:to="loc_us-gaap_HedgingDesignationDomain_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_84510350-3876-47e5-8827-fd8e69261797" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_HedgingDesignationAxis_f2daf39a-9d1b-40b1-b2bb-e24a3cffd0c0" xlink:to="loc_us-gaap_HedgingDesignationDomain_84510350-3876-47e5-8827-fd8e69261797" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NondesignatedMember_e83560a5-cd8d-4953-8eaa-580a8ea844eb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_NondesignatedMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_HedgingDesignationDomain_84510350-3876-47e5-8827-fd8e69261797" xlink:to="loc_us-gaap_NondesignatedMember_e83560a5-cd8d-4953-8eaa-580a8ea844eb" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsOutstandingForwardContractsTableDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsOutstandingForwardContractsTableDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsOutstandingForwardContractsTableDetails" xlink:type="extended" id="i6b74b14dad9a42f6b0b842df21f08db4_DerivativeInstrumentsOutstandingForwardContractsTableDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeLineItems_1285a9d5-e138-44f2-8116-bb3d0873baaf" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeAssetNotionalAmount_b41948aa-098c-43e8-aa4b-5744058b36c1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeAssetNotionalAmount"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativeLineItems_1285a9d5-e138-44f2-8116-bb3d0873baaf" xlink:to="loc_us-gaap_DerivativeAssetNotionalAmount_b41948aa-098c-43e8-aa4b-5744058b36c1" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeTable_ee79abdd-16d3-4da1-a12f-5e3b5098918b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DerivativeLineItems_1285a9d5-e138-44f2-8116-bb3d0873baaf" xlink:to="loc_us-gaap_DerivativeTable_ee79abdd-16d3-4da1-a12f-5e3b5098918b" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationAxis_f2206275-cade-46f1-a1cc-fe4d4a06df25" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DerivativeTable_ee79abdd-16d3-4da1-a12f-5e3b5098918b" xlink:to="loc_us-gaap_HedgingDesignationAxis_f2206275-cade-46f1-a1cc-fe4d4a06df25" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_f2206275-cade-46f1-a1cc-fe4d4a06df25_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_HedgingDesignationAxis_f2206275-cade-46f1-a1cc-fe4d4a06df25" xlink:to="loc_us-gaap_HedgingDesignationDomain_f2206275-cade-46f1-a1cc-fe4d4a06df25_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_e00ef2b6-68bf-4923-b9d8-dea2e74b7602" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_HedgingDesignationAxis_f2206275-cade-46f1-a1cc-fe4d4a06df25" xlink:to="loc_us-gaap_HedgingDesignationDomain_e00ef2b6-68bf-4923-b9d8-dea2e74b7602" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NondesignatedMember_4696442d-82c3-46ea-92e3-41c23af4a7ff" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_NondesignatedMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_HedgingDesignationDomain_e00ef2b6-68bf-4923-b9d8-dea2e74b7602" xlink:to="loc_us-gaap_NondesignatedMember_4696442d-82c3-46ea-92e3-41c23af4a7ff" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_CurrencyAxis_cc87fba4-42f5-4fb7-8865-381f56be699e" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_CurrencyAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DerivativeTable_ee79abdd-16d3-4da1-a12f-5e3b5098918b" xlink:to="loc_srt_CurrencyAxis_cc87fba4-42f5-4fb7-8865-381f56be699e" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_AllCurrenciesDomain_cc87fba4-42f5-4fb7-8865-381f56be699e_default" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_AllCurrenciesDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_CurrencyAxis_cc87fba4-42f5-4fb7-8865-381f56be699e" xlink:to="loc_currency_AllCurrenciesDomain_cc87fba4-42f5-4fb7-8865-381f56be699e_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_AllCurrenciesDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_CurrencyAxis_cc87fba4-42f5-4fb7-8865-381f56be699e" xlink:to="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_EUR_cda1535f-7f73-4f13-ae07-170eb0492932" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_EUR"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_EUR_cda1535f-7f73-4f13-ae07-170eb0492932" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_CNY_376e3611-be73-4227-acfd-9060516e3b44" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_CNY"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_CNY_376e3611-be73-4227-acfd-9060516e3b44" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_MXN_f5fd140f-68cf-417c-81b0-ff40f467d799" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_MXN"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_MXN_f5fd140f-68cf-417c-81b0-ff40f467d799" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_JPY_423af6b0-55d2-428c-9f68-9dd155771a1c" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_JPY"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_JPY_423af6b0-55d2-428c-9f68-9dd155771a1c" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_HUF_be35aa6f-b8e5-4f25-b7eb-07556452bf52" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_HUF"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_HUF_be35aa6f-b8e5-4f25-b7eb-07556452bf52" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_GBP_cda59f26-ec88-4b10-8e90-091f2ad0cff5" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_GBP"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_GBP_cda59f26-ec88-4b10-8e90-091f2ad0cff5" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_TWD_9dcf9727-43f8-4e75-8bd0-931b10a2182a" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_TWD"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_TWD_9dcf9727-43f8-4e75-8bd0-931b10a2182a" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_CAD_13a04af1-60cb-4520-bb1c-0c2a44da7335" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_CAD"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_CAD_13a04af1-60cb-4520-bb1c-0c2a44da7335" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_SGD_31114661-f251-4756-bb54-287e793e7d6a" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_SGD"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_SGD_31114661-f251-4756-bb54-287e793e7d6a" xlink:type="arc" order="8"/>
    <link:loc xlink:type="locator" xlink:label="loc_currency_KRW_b7f65d59-023d-4177-b9aa-7ffbeceb5032" xlink:href="https://xbrl.sec.gov/currency/2020/currency-2020-01-31.xsd#currency_KRW"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_currency_AllCurrenciesDomain_363e98bf-8454-4e9a-9e0c-6e1cf7308c89" xlink:to="loc_currency_KRW_b7f65d59-023d-4177-b9aa-7ffbeceb5032" xlink:type="arc" order="9"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsScheduleofDerivativeInstrumentsinStatementofFinancialPositionFairValueDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsScheduleofDerivativeInstrumentsinStatementofFinancialPositionFairValueDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsScheduleofDerivativeInstrumentsinStatementofFinancialPositionFairValueDetails" xlink:type="extended" id="ia420a9ba733a4836856d9ec44b15ebee_DerivativeInstrumentsScheduleofDerivativeInstrumentsinStatementofFinancialPositionFairValueDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativesFairValueLineItems_64fcac30-79bb-4b64-afd0-30a14a0bacd0" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativesFairValueLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeAssets_aceb3d4a-d714-4281-9465-0496f4dbb448" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeAssets"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativesFairValueLineItems_64fcac30-79bb-4b64-afd0-30a14a0bacd0" xlink:to="loc_us-gaap_DerivativeAssets_aceb3d4a-d714-4281-9465-0496f4dbb448" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeLiabilities_d1990f4a-f021-47cf-b943-302894a04e54" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeLiabilities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativesFairValueLineItems_64fcac30-79bb-4b64-afd0-30a14a0bacd0" xlink:to="loc_us-gaap_DerivativeLiabilities_d1990f4a-f021-47cf-b943-302894a04e54" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_FairValuesDerivativesBalanceSheetLocationByDerivativeContractTypeByHedgingDesignationTable_5cf54740-138c-4a56-94bf-ad94fa17db51" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_FairValuesDerivativesBalanceSheetLocationByDerivativeContractTypeByHedgingDesignationTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DerivativesFairValueLineItems_64fcac30-79bb-4b64-afd0-30a14a0bacd0" xlink:to="loc_us-gaap_FairValuesDerivativesBalanceSheetLocationByDerivativeContractTypeByHedgingDesignationTable_5cf54740-138c-4a56-94bf-ad94fa17db51" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationAxis_c07ee090-79a3-4037-beef-7a31a5d04c8f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValuesDerivativesBalanceSheetLocationByDerivativeContractTypeByHedgingDesignationTable_5cf54740-138c-4a56-94bf-ad94fa17db51" xlink:to="loc_us-gaap_HedgingDesignationAxis_c07ee090-79a3-4037-beef-7a31a5d04c8f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_c07ee090-79a3-4037-beef-7a31a5d04c8f_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_HedgingDesignationAxis_c07ee090-79a3-4037-beef-7a31a5d04c8f" xlink:to="loc_us-gaap_HedgingDesignationDomain_c07ee090-79a3-4037-beef-7a31a5d04c8f_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_06454cd5-0722-4ed0-8beb-c2dbcff7f757" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_HedgingDesignationAxis_c07ee090-79a3-4037-beef-7a31a5d04c8f" xlink:to="loc_us-gaap_HedgingDesignationDomain_06454cd5-0722-4ed0-8beb-c2dbcff7f757" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NondesignatedMember_3f749f2f-80b7-4ea3-aa70-3e245b151fbd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_NondesignatedMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_HedgingDesignationDomain_06454cd5-0722-4ed0-8beb-c2dbcff7f757" xlink:to="loc_us-gaap_NondesignatedMember_3f749f2f-80b7-4ea3-aa70-3e245b151fbd" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationAxis_fa91eb3e-3d2d-4848-b4f9-6249a19898a9" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValuesDerivativesBalanceSheetLocationByDerivativeContractTypeByHedgingDesignationTable_5cf54740-138c-4a56-94bf-ad94fa17db51" xlink:to="loc_us-gaap_BalanceSheetLocationAxis_fa91eb3e-3d2d-4848-b4f9-6249a19898a9" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_fa91eb3e-3d2d-4848-b4f9-6249a19898a9_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_fa91eb3e-3d2d-4848-b4f9-6249a19898a9" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_fa91eb3e-3d2d-4848-b4f9-6249a19898a9_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_d49f6bbc-5e6d-4338-8a73-27fc995133ca" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_fa91eb3e-3d2d-4848-b4f9-6249a19898a9" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_d49f6bbc-5e6d-4338-8a73-27fc995133ca" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PrepaidExpensesAndOtherCurrentAssetsMember_6e582c3d-390f-4c62-b0af-a1bf4e20ce7e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PrepaidExpensesAndOtherCurrentAssetsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BalanceSheetLocationDomain_d49f6bbc-5e6d-4338-8a73-27fc995133ca" xlink:to="loc_us-gaap_PrepaidExpensesAndOtherCurrentAssetsMember_6e582c3d-390f-4c62-b0af-a1bf4e20ce7e" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AccruedExpensesMember_4480009b-b85a-4d0c-b411-e048d0c7f10b" xlink:href="cgnx-20210404.xsd#cgnx_AccruedExpensesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BalanceSheetLocationDomain_d49f6bbc-5e6d-4338-8a73-27fc995133ca" xlink:to="loc_cgnx_AccruedExpensesMember_4480009b-b85a-4d0c-b411-e048d0c7f10b" xlink:type="arc" order="1"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsOffsettingAssetsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsOffsettingAssetsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsOffsettingAssetsDetails" xlink:type="extended" id="i0768ffcba4ce47cab961ab2a23b271bc_DerivativeInstrumentsOffsettingAssetsDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/DerivativeInstrumentsDerivativeInstrumentsGainLossDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#DerivativeInstrumentsDerivativeInstrumentsGainLossDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/DerivativeInstrumentsDerivativeInstrumentsGainLossDetails" xlink:type="extended" id="i40572dc1e5b44aefbc3481453073cb64_DerivativeInstrumentsDerivativeInstrumentsGainLossDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeInstrumentsGainLossLineItems_f3691611-6f13-457b-877b-e5b4ed7da0bb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeInstrumentsGainLossLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeGainLossOnDerivativeNet_475272bd-d6dc-428e-937b-2b10b1ba09c9" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeGainLossOnDerivativeNet"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativeInstrumentsGainLossLineItems_f3691611-6f13-457b-877b-e5b4ed7da0bb" xlink:to="loc_us-gaap_DerivativeGainLossOnDerivativeNet_475272bd-d6dc-428e-937b-2b10b1ba09c9" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DerivativeInstrumentsGainLossByHedgingRelationshipByIncomeStatementLocationByDerivativeInstrumentRiskTable_d4855271-961e-400b-a991-d35bcb49e7e6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DerivativeInstrumentsGainLossByHedgingRelationshipByIncomeStatementLocationByDerivativeInstrumentRiskTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DerivativeInstrumentsGainLossLineItems_f3691611-6f13-457b-877b-e5b4ed7da0bb" xlink:to="loc_us-gaap_DerivativeInstrumentsGainLossByHedgingRelationshipByIncomeStatementLocationByDerivativeInstrumentRiskTable_d4855271-961e-400b-a991-d35bcb49e7e6" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationAxis_b60027b2-850d-482f-9a7b-1f4c272bdfb1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DerivativeInstrumentsGainLossByHedgingRelationshipByIncomeStatementLocationByDerivativeInstrumentRiskTable_d4855271-961e-400b-a991-d35bcb49e7e6" xlink:to="loc_us-gaap_HedgingDesignationAxis_b60027b2-850d-482f-9a7b-1f4c272bdfb1" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_b60027b2-850d-482f-9a7b-1f4c272bdfb1_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_HedgingDesignationAxis_b60027b2-850d-482f-9a7b-1f4c272bdfb1" xlink:to="loc_us-gaap_HedgingDesignationDomain_b60027b2-850d-482f-9a7b-1f4c272bdfb1_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_HedgingDesignationDomain_05cadf1f-49d1-4f17-be88-68b0e01aaa08" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_HedgingDesignationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_HedgingDesignationAxis_b60027b2-850d-482f-9a7b-1f4c272bdfb1" xlink:to="loc_us-gaap_HedgingDesignationDomain_05cadf1f-49d1-4f17-be88-68b0e01aaa08" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_NondesignatedMember_dd364e80-77e2-4289-a17c-64747380f923" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_NondesignatedMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_HedgingDesignationDomain_05cadf1f-49d1-4f17-be88-68b0e01aaa08" xlink:to="loc_us-gaap_NondesignatedMember_dd364e80-77e2-4289-a17c-64747380f923" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationAxis_4cfa636f-e687-470d-b30c-1a4faca5b822" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DerivativeInstrumentsGainLossByHedgingRelationshipByIncomeStatementLocationByDerivativeInstrumentRiskTable_d4855271-961e-400b-a991-d35bcb49e7e6" xlink:to="loc_us-gaap_IncomeStatementLocationAxis_4cfa636f-e687-470d-b30c-1a4faca5b822" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationDomain_4cfa636f-e687-470d-b30c-1a4faca5b822_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_IncomeStatementLocationAxis_4cfa636f-e687-470d-b30c-1a4faca5b822" xlink:to="loc_us-gaap_IncomeStatementLocationDomain_4cfa636f-e687-470d-b30c-1a4faca5b822_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationDomain_1e3e064d-6a08-4259-8bd1-794b2456d4ed" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_IncomeStatementLocationAxis_4cfa636f-e687-470d-b30c-1a4faca5b822" xlink:to="loc_us-gaap_IncomeStatementLocationDomain_1e3e064d-6a08-4259-8bd1-794b2456d4ed" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ForeignCurrencyGainLossMember_f7d4b925-51d3-4f29-a66b-e41645e23bb5" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ForeignCurrencyGainLossMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeStatementLocationDomain_1e3e064d-6a08-4259-8bd1-794b2456d4ed" xlink:to="loc_us-gaap_ForeignCurrencyGainLossMember_f7d4b925-51d3-4f29-a66b-e41645e23bb5" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognition" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognition"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognition" xlink:type="extended" id="ia191abb5b4aa431eb0d15eb3110690c5_RevenueRecognition"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionTables" xlink:type="extended" id="ie771c1b99f6a4f60a137a5099accab12_RevenueRecognitionTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionRevenueDisaggregatedbyGeographyDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionRevenueDisaggregatedbyGeographyDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionRevenueDisaggregatedbyGeographyDetails" xlink:type="extended" id="i9e2ec721380940c2a3fdd902b6d00908_RevenueRecognitionRevenueDisaggregatedbyGeographyDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DisaggregationOfRevenueLineItems_5de6c915-80c6-4575-b8f9-d0a76e848bf8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DisaggregationOfRevenueLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_c9fac53e-d95e-482d-a262-ff1f0fd954dd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_5de6c915-80c6-4575-b8f9-d0a76e848bf8" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_c9fac53e-d95e-482d-a262-ff1f0fd954dd" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DisaggregationOfRevenueTable_4e40d104-a04e-4650-a0cc-7343fe671105" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DisaggregationOfRevenueTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_5de6c915-80c6-4575-b8f9-d0a76e848bf8" xlink:to="loc_us-gaap_DisaggregationOfRevenueTable_4e40d104-a04e-4650-a0cc-7343fe671105" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_StatementGeographicalAxis_2e45ec35-7efe-4281-bee0-e1db7804f554" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_StatementGeographicalAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_4e40d104-a04e-4650-a0cc-7343fe671105" xlink:to="loc_srt_StatementGeographicalAxis_2e45ec35-7efe-4281-bee0-e1db7804f554" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_SegmentGeographicalDomain_2e45ec35-7efe-4281-bee0-e1db7804f554_default" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_SegmentGeographicalDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_2e45ec35-7efe-4281-bee0-e1db7804f554" xlink:to="loc_srt_SegmentGeographicalDomain_2e45ec35-7efe-4281-bee0-e1db7804f554_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_SegmentGeographicalDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_2e45ec35-7efe-4281-bee0-e1db7804f554" xlink:to="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_AmericasMember_5c0d9001-e105-43f8-bc11-6e2b3c7b2120" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_AmericasMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:to="loc_srt_AmericasMember_5c0d9001-e105-43f8-bc11-6e2b3c7b2120" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_EuropeMember_8dfb1a99-73e4-4e4c-a521-50db0627e274" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_EuropeMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:to="loc_srt_EuropeMember_8dfb1a99-73e4-4e4c-a521-50db0627e274" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_country_CN_c3daf89a-e5b5-49c5-81d8-4ac56da212f7" xlink:href="https://xbrl.sec.gov/country/2020/country-2020-01-31.xsd#country_CN"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:to="loc_country_CN_c3daf89a-e5b5-49c5-81d8-4ac56da212f7" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_AsiaExcludingChinaMember_2978a6b3-a591-413d-9f92-3631a0191fe9" xlink:href="cgnx-20210404.xsd#cgnx_AsiaExcludingChinaMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_618dea58-73ad-4f0e-9e4e-5a358ef5153e" xlink:to="loc_cgnx_AsiaExcludingChinaMember_2978a6b3-a591-413d-9f92-3631a0191fe9" xlink:type="arc" order="3"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionRevenueDisaggregatedbyProductsandServicesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionRevenueDisaggregatedbyProductsandServicesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionRevenueDisaggregatedbyProductsandServicesDetails" xlink:type="extended" id="iba0dc9d2185c4e4eabfac287f62e8cad_RevenueRecognitionRevenueDisaggregatedbyProductsandServicesDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_5edf5c18-4be5-4629-a8fd-6bc83a674f20" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_4df2c5ed-3324-40a7-9b78-c422c9c65599" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_5edf5c18-4be5-4629-a8fd-6bc83a674f20" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_4df2c5ed-3324-40a7-9b78-c422c9c65599" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_c7235b8b-f2dc-47c4-8e41-fa7869bc51fc" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_5edf5c18-4be5-4629-a8fd-6bc83a674f20" xlink:to="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_c7235b8b-f2dc-47c4-8e41-fa7869bc51fc" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_ProductOrServiceAxis_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_ProductOrServiceAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_c7235b8b-f2dc-47c4-8e41-fa7869bc51fc" xlink:to="loc_srt_ProductOrServiceAxis_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_ProductsAndServicesDomain_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5_default" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_ProductsAndServicesDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_ProductOrServiceAxis_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5" xlink:to="loc_srt_ProductsAndServicesDomain_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_ProductsAndServicesDomain_c01d7dfc-fd91-4ed5-b2d2-758f398e47d6" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_ProductsAndServicesDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_ProductOrServiceAxis_4d2aa6c8-ccd5-4320-affd-7e9d9a3142d5" xlink:to="loc_srt_ProductsAndServicesDomain_c01d7dfc-fd91-4ed5-b2d2-758f398e47d6" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_StandardProductsandServicesMember_eba37fec-732b-4bd4-b1bb-ab36c392b1d3" xlink:href="cgnx-20210404.xsd#cgnx_StandardProductsandServicesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_ProductsAndServicesDomain_c01d7dfc-fd91-4ed5-b2d2-758f398e47d6" xlink:to="loc_cgnx_StandardProductsandServicesMember_eba37fec-732b-4bd4-b1bb-ab36c392b1d3" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_ApplicationSpecificCustomerSolutionsMember_9066b5b1-d968-48e0-afb0-0b260d9c79a6" xlink:href="cgnx-20210404.xsd#cgnx_ApplicationSpecificCustomerSolutionsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_ProductsAndServicesDomain_c01d7dfc-fd91-4ed5-b2d2-758f398e47d6" xlink:to="loc_cgnx_ApplicationSpecificCustomerSolutionsMember_9066b5b1-d968-48e0-afb0-0b260d9c79a6" xlink:type="arc" order="1"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionAdditionalInformationDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionAdditionalInformationDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionAdditionalInformationDetails" xlink:type="extended" id="ifd28374df7fb4558a9e56e4cf6ff8a98_RevenueRecognitionAdditionalInformationDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionScheduleofAllowanceforCreditLossDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionScheduleofAllowanceforCreditLossDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionScheduleofAllowanceforCreditLossDetails" xlink:type="extended" id="iadfd2be1ba0e4bdb9323a84a80a30e59_RevenueRecognitionScheduleofAllowanceforCreditLossDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RevenueRecognitionDeferredRevenueActivityDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RevenueRecognitionDeferredRevenueActivityDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RevenueRecognitionDeferredRevenueActivityDetails" xlink:type="extended" id="i3ddd03c4d1bb400aa41b5a68c77c7f4c_RevenueRecognitionDeferredRevenueActivityDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpense" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpense"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpense" xlink:type="extended" id="ifb3a0c659a6840dcab4e119ac63efb8e_StockBasedCompensationExpense"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseTables" xlink:type="extended" id="ifbdb4b8cbbe349aab49847e17b46d648_StockBasedCompensationExpenseTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseDetails" xlink:type="extended" id="i46c26a89745a42c69e3205113b8f511e_StockBasedCompensationExpenseDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_bde9b595-7871-4014-a39b-61775647da44" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_bde9b595-7871-4014-a39b-61775647da44" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_fa8bca7c-9c68-4373-8623-fc933cec5ddd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_fa8bca7c-9c68-4373-8623-fc933cec5ddd" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_ExpirationPeriodOfStockOptionPlan_a049d18d-f9c5-4f57-b244-b226fb048f56" xlink:href="cgnx-20210404.xsd#cgnx_ExpirationPeriodOfStockOptionPlan"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_ExpirationPeriodOfStockOptionPlan_a049d18d-f9c5-4f57-b244-b226fb048f56" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_1a84178a-d953-407c-ac29-dd92537fa93c" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_1a84178a-d953-407c-ac29-dd92537fa93c" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_SharesBasedCompensationArrangementBySharesBasedPaymentAwardOptionsExercisableIntrinsicValue_0b432808-a844-4251-ba18-cc587f9f8d82" xlink:href="cgnx-20210404.xsd#cgnx_SharesBasedCompensationArrangementBySharesBasedPaymentAwardOptionsExercisableIntrinsicValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_SharesBasedCompensationArrangementBySharesBasedPaymentAwardOptionsExercisableIntrinsicValue_0b432808-a844-4251-ba18-cc587f9f8d82" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedFairValue_8f1a7cb0-0bf2-4c7e-b30b-8958e0221d2d" xlink:href="cgnx-20210404.xsd#cgnx_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedFairValue_8f1a7cb0-0bf2-4c7e-b30b-8958e0221d2d" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_be5f8b82-c8ad-4fa8-bacc-3af3d2248456" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_be5f8b82-c8ad-4fa8-bacc-3af3d2248456" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_2d601e87-560d-44f3-a9e5-bdfc05415100" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_2d601e87-560d-44f3-a9e5-bdfc05415100" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_NumberOfGroupsWithinEmployeePopulation_ff56c88f-e272-4255-83c2-ae86f4520046" xlink:href="cgnx-20210404.xsd#cgnx_NumberOfGroupsWithinEmployeePopulation"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_NumberOfGroupsWithinEmployeePopulation_ff56c88f-e272-4255-83c2-ae86f4520046" xlink:type="arc" order="8"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_EstimatedForfeitureRateForUnvestedOptionsForSeniorManagement_be9d50ca-2142-46fb-8122-1970893484c4" xlink:href="cgnx-20210404.xsd#cgnx_EstimatedForfeitureRateForUnvestedOptionsForSeniorManagement"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_EstimatedForfeitureRateForUnvestedOptionsForSeniorManagement_be9d50ca-2142-46fb-8122-1970893484c4" xlink:type="arc" order="9"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_EstimatedForfeitureRateForUnvestedOptionsForAllNonSeniorManagement_845ba37c-db78-4cd8-a698-1884d83509e6" xlink:href="cgnx-20210404.xsd#cgnx_EstimatedForfeitureRateForUnvestedOptionsForAllNonSeniorManagement"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_EstimatedForfeitureRateForUnvestedOptionsForAllNonSeniorManagement_845ba37c-db78-4cd8-a698-1884d83509e6" xlink:type="arc" order="10"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_IncreaseInCompensationExpenseDueToRevisedEstimatedForfeitureRates_43ec4ac1-3cb3-4c18-b095-84f0c85ee005" xlink:href="cgnx-20210404.xsd#cgnx_IncreaseInCompensationExpenseDueToRevisedEstimatedForfeitureRates"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_IncreaseInCompensationExpenseDueToRevisedEstimatedForfeitureRates_43ec4ac1-3cb3-4c18-b095-84f0c85ee005" xlink:type="arc" order="11"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognized_56c3b8b7-7ed7-4e10-8f3c-f9cfffa8d2c3" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognized"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognized_56c3b8b7-7ed7-4e10-8f3c-f9cfffa8d2c3" xlink:type="arc" order="12"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_EmployeeServiceSharebasedCompensationNonvestedAwardsCompensationNotyetRecognizedPeriodforRecognition_4f8567e3-773f-4ce6-8fd6-933d97ccc271" xlink:href="cgnx-20210404.xsd#cgnx_EmployeeServiceSharebasedCompensationNonvestedAwardsCompensationNotyetRecognizedPeriodforRecognition"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_EmployeeServiceSharebasedCompensationNonvestedAwardsCompensationNotyetRecognizedPeriodforRecognition_4f8567e3-773f-4ce6-8fd6-933d97ccc271" xlink:type="arc" order="13"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AllocatedShareBasedCompensationExpense_744b0941-4a70-472a-9b74-62b8b2234e03" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AllocatedShareBasedCompensationExpense"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_AllocatedShareBasedCompensationExpense_744b0941-4a70-472a-9b74-62b8b2234e03" xlink:type="arc" order="14"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense_37bc47cb-f641-4c60-b112-f0a560c62e98" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense_37bc47cb-f641-4c60-b112-f0a560c62e98" xlink:type="arc" order="15"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_EmployeeServiceShareBasedCompensationRecognizedPeriodCostsCapitalizedAmount_cc4a4ac5-715d-431c-a47c-f35614a6bea2" xlink:href="cgnx-20210404.xsd#cgnx_EmployeeServiceShareBasedCompensationRecognizedPeriodCostsCapitalizedAmount"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_cgnx_EmployeeServiceShareBasedCompensationRecognizedPeriodCostsCapitalizedAmount_cc4a4ac5-715d-431c-a47c-f35614a6bea2" xlink:type="arc" order="16"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_b1908a26-364d-40ff-917f-f8cda0d773c9" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_0fa43988-bab5-4e48-8d68-444b541cb678" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_b1908a26-364d-40ff-917f-f8cda0d773c9" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_RangeAxis_3bda6caf-d4b8-42d4-8d32-491741a0c381" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_RangeAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_b1908a26-364d-40ff-917f-f8cda0d773c9" xlink:to="loc_srt_RangeAxis_3bda6caf-d4b8-42d4-8d32-491741a0c381" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_RangeMember_3bda6caf-d4b8-42d4-8d32-491741a0c381_default" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_RangeMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_3bda6caf-d4b8-42d4-8d32-491741a0c381" xlink:to="loc_srt_RangeMember_3bda6caf-d4b8-42d4-8d32-491741a0c381_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_RangeMember_61cc7efa-b267-45f6-a8ec-f4f33b2035ba" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_RangeMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_3bda6caf-d4b8-42d4-8d32-491741a0c381" xlink:to="loc_srt_RangeMember_61cc7efa-b267-45f6-a8ec-f4f33b2035ba" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_MinimumMember_6781b37f-11fc-4086-b4f1-d5c2baa43fcd" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_MinimumMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_61cc7efa-b267-45f6-a8ec-f4f33b2035ba" xlink:to="loc_srt_MinimumMember_6781b37f-11fc-4086-b4f1-d5c2baa43fcd" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_srt_MaximumMember_cb528350-9c71-4e7e-a9d1-5f6a05b500a6" xlink:href="http://xbrl.fasb.org/srt/2020/elts/srt-2020-01-31.xsd#srt_MaximumMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_61cc7efa-b267-45f6-a8ec-f4f33b2035ba" xlink:to="loc_srt_MaximumMember_cb528350-9c71-4e7e-a9d1-5f6a05b500a6" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AwardTypeAxis_331cfc3b-02fc-4d86-b2ae-eb5853065a69" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AwardTypeAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_b1908a26-364d-40ff-917f-f8cda0d773c9" xlink:to="loc_us-gaap_AwardTypeAxis_331cfc3b-02fc-4d86-b2ae-eb5853065a69" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_331cfc3b-02fc-4d86-b2ae-eb5853065a69_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AwardTypeAxis_331cfc3b-02fc-4d86-b2ae-eb5853065a69" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_331cfc3b-02fc-4d86-b2ae-eb5853065a69_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_1a74de09-7eef-465c-9398-339008843225" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AwardTypeAxis_331cfc3b-02fc-4d86-b2ae-eb5853065a69" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_1a74de09-7eef-465c-9398-339008843225" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeStockOptionMember_108c2055-f30b-4c75-9e47-2e6a24b750f8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EmployeeStockOptionMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_1a74de09-7eef-465c-9398-339008843225" xlink:to="loc_us-gaap_EmployeeStockOptionMember_108c2055-f30b-4c75-9e47-2e6a24b750f8" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PerformanceSharesMember_b90bd22e-0597-4440-9e05-48834810a125" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PerformanceSharesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_1a74de09-7eef-465c-9398-339008843225" xlink:to="loc_us-gaap_PerformanceSharesMember_b90bd22e-0597-4440-9e05-48834810a125" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestrictedStockUnitsRSUMember_7151cdba-645f-4d26-a65a-10b81bec5924" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestrictedStockUnitsRSUMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_1a74de09-7eef-465c-9398-339008843225" xlink:to="loc_us-gaap_RestrictedStockUnitsRSUMember_7151cdba-645f-4d26-a65a-10b81bec5924" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PlanNameAxis_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PlanNameAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_b1908a26-364d-40ff-917f-f8cda0d773c9" xlink:to="loc_us-gaap_PlanNameAxis_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PlanNameDomain_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_PlanNameAxis_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4" xlink:to="loc_us-gaap_PlanNameDomain_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PlanNameDomain_3453b1be-0347-452d-88de-c5dbcdbccf7f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_PlanNameAxis_ab813f4c-bb50-4c92-8736-4ef67cbcf7b4" xlink:to="loc_us-gaap_PlanNameDomain_3453b1be-0347-452d-88de-c5dbcdbccf7f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_GeneralStockOptionPlanMember_b72b210d-574b-4d7a-b026-ff407cb01d3c" xlink:href="cgnx-20210404.xsd#cgnx_GeneralStockOptionPlanMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_PlanNameDomain_3453b1be-0347-452d-88de-c5dbcdbccf7f" xlink:to="loc_cgnx_GeneralStockOptionPlanMember_b72b210d-574b-4d7a-b026-ff407cb01d3c" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseSummaryofStockOptionActivityDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseSummaryofStockOptionActivityDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseSummaryofStockOptionActivityDetails" xlink:type="extended" id="i39219e17f57c44929434a3b4b0e907ca_StockBasedCompensationExpenseSummaryofStockOptionActivityDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseWeightedAverageAssumptionsUsedinEstimatingFairValuesofStockOptionsGrantedDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseWeightedAverageAssumptionsUsedinEstimatingFairValuesofStockOptionsGrantedDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseWeightedAverageAssumptionsUsedinEstimatingFairValuesofStockOptionsGrantedDetails" xlink:type="extended" id="i217902a84bba40f6bf93fcc4db4d38c0_StockBasedCompensationExpenseWeightedAverageAssumptionsUsedinEstimatingFairValuesofStockOptionsGrantedDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseStockBasedCompensationExpenseScheduleofRestrictedStockUnitsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseStockBasedCompensationExpenseScheduleofRestrictedStockUnitsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseStockBasedCompensationExpenseScheduleofRestrictedStockUnitsDetails" xlink:type="extended" id="i5d918ee78b5947a4a856ba973f31300b_StockBasedCompensationExpenseStockBasedCompensationExpenseScheduleofRestrictedStockUnitsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_7adf493e-6587-4f7e-8292-f616e1013e6b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_7adf493e-6587-4f7e-8292-f616e1013e6b" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber_a54eff81-8f12-419b-99e2-d10458a037a3" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber_a54eff81-8f12-419b-99e2-d10458a037a3" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod_71432fd9-9906-453b-af04-65c736370433" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod_71432fd9-9906-453b-af04-65c736370433" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_8379a98b-1e7d-4da1-8cae-a8c5e58c8df3" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_8379a98b-1e7d-4da1-8cae-a8c5e58c8df3" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod_c8a1daec-7a95-4609-b206-13e179261a0b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedRollForward_124d3ae8-34b3-4afb-be4c-201f9c489aa0" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod_c8a1daec-7a95-4609-b206-13e179261a0b" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber_fb5a75db-f8d2-4ab3-84c0-3a30a3092c10" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_7adf493e-6587-4f7e-8292-f616e1013e6b" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValue_980dad75-92e3-4c67-9c73-4ffeb8ff2a0e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValue_980dad75-92e3-4c67-9c73-4ffeb8ff2a0e" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_634eac93-b7fb-4174-a022-77270816db44" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriodWeightedAverageGrantDateFairValue_634eac93-b7fb-4174-a022-77270816db44" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriodWeightedAverageGrantDateFairValue_9dbdc89f-d4ba-4875-8bc3-c0f980849c74" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriodWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriodWeightedAverageGrantDateFairValue_9dbdc89f-d4ba-4875-8bc3-c0f980849c74" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeituresWeightedAverageGrantDateFairValue_b58613f2-9930-406c-8039-6a4eeb14f6cd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeituresWeightedAverageGrantDateFairValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValueRollForward_c9a35fd8-cc70-4dd7-b2a2-c92b26c63154" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeituresWeightedAverageGrantDateFairValue_b58613f2-9930-406c-8039-6a4eeb14f6cd" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValue_c0142c5e-619f-4a3a-ad48-63d3cfad8f77" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedWeightedAverageGrantDateFairValue"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_fc4c6b90-0488-4a14-9aa0-1042d8d65a9f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_7adf493e-6587-4f7e-8292-f616e1013e6b" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_fc4c6b90-0488-4a14-9aa0-1042d8d65a9f" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AwardTypeAxis_5a67a390-70aa-45fe-9905-fdaf340ddf91" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AwardTypeAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_fc4c6b90-0488-4a14-9aa0-1042d8d65a9f" xlink:to="loc_us-gaap_AwardTypeAxis_5a67a390-70aa-45fe-9905-fdaf340ddf91" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_5a67a390-70aa-45fe-9905-fdaf340ddf91_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AwardTypeAxis_5a67a390-70aa-45fe-9905-fdaf340ddf91" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_5a67a390-70aa-45fe-9905-fdaf340ddf91_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_623a294e-67c2-4d92-8778-f8b88e64e0a7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AwardTypeAxis_5a67a390-70aa-45fe-9905-fdaf340ddf91" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_623a294e-67c2-4d92-8778-f8b88e64e0a7" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestrictedStockUnitsRSUMember_fb47b149-abbc-470d-ac3f-4ec39aa34617" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestrictedStockUnitsRSUMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_623a294e-67c2-4d92-8778-f8b88e64e0a7" xlink:to="loc_us-gaap_RestrictedStockUnitsRSUMember_fb47b149-abbc-470d-ac3f-4ec39aa34617" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/StockBasedCompensationExpenseScheduleofEmployeeServiceSharebasedCompensationAllocationofRecognizedPeriodCostsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockBasedCompensationExpenseScheduleofEmployeeServiceSharebasedCompensationAllocationofRecognizedPeriodCostsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockBasedCompensationExpenseScheduleofEmployeeServiceSharebasedCompensationAllocationofRecognizedPeriodCostsDetails" xlink:type="extended" id="i4e4ade9e6a21426392ac093808caf71f_StockBasedCompensationExpenseScheduleofEmployeeServiceSharebasedCompensationAllocationofRecognizedPeriodCostsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsLineItems_c4cfb936-61a8-4bd6-a549-4e652e47b773" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AllocatedShareBasedCompensationExpense_82c69342-cedd-4b5f-b81a-089fbf934b6d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AllocatedShareBasedCompensationExpense"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsLineItems_c4cfb936-61a8-4bd6-a549-4e652e47b773" xlink:to="loc_us-gaap_AllocatedShareBasedCompensationExpense_82c69342-cedd-4b5f-b81a-089fbf934b6d" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfEmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsTable_99643bd7-e45e-4cf8-8ca1-a1c52396c127" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfEmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_EmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsLineItems_c4cfb936-61a8-4bd6-a549-4e652e47b773" xlink:to="loc_us-gaap_ScheduleOfEmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsTable_99643bd7-e45e-4cf8-8ca1-a1c52396c127" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationAxis_101fe17d-9790-473d-91c6-5109fdd65e12" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfEmployeeServiceShareBasedCompensationAllocationOfRecognizedPeriodCostsTable_99643bd7-e45e-4cf8-8ca1-a1c52396c127" xlink:to="loc_us-gaap_IncomeStatementLocationAxis_101fe17d-9790-473d-91c6-5109fdd65e12" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationDomain_101fe17d-9790-473d-91c6-5109fdd65e12_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_IncomeStatementLocationAxis_101fe17d-9790-473d-91c6-5109fdd65e12" xlink:to="loc_us-gaap_IncomeStatementLocationDomain_101fe17d-9790-473d-91c6-5109fdd65e12_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeStatementLocationDomain_d63b0137-e1e5-496b-99f5-c91c9e83e35d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeStatementLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_IncomeStatementLocationAxis_101fe17d-9790-473d-91c6-5109fdd65e12" xlink:to="loc_us-gaap_IncomeStatementLocationDomain_d63b0137-e1e5-496b-99f5-c91c9e83e35d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_CostOfGoodsTotalMember_416b8049-ad84-4a0d-aa0e-237df07bd69e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_CostOfGoodsTotalMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeStatementLocationDomain_d63b0137-e1e5-496b-99f5-c91c9e83e35d" xlink:to="loc_us-gaap_CostOfGoodsTotalMember_416b8049-ad84-4a0d-aa0e-237df07bd69e" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ResearchAndDevelopmentExpenseMember_383216c9-94ae-49b6-b4f5-383dc620203a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ResearchAndDevelopmentExpenseMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeStatementLocationDomain_d63b0137-e1e5-496b-99f5-c91c9e83e35d" xlink:to="loc_us-gaap_ResearchAndDevelopmentExpenseMember_383216c9-94ae-49b6-b4f5-383dc620203a" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_SellingGeneralAndAdministrativeMember_544ea503-0c14-4919-bf8c-d21373e823e4" xlink:href="cgnx-20210404.xsd#cgnx_SellingGeneralAndAdministrativeMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeStatementLocationDomain_d63b0137-e1e5-496b-99f5-c91c9e83e35d" xlink:to="loc_cgnx_SellingGeneralAndAdministrativeMember_544ea503-0c14-4919-bf8c-d21373e823e4" xlink:type="arc" order="2"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/StockRepurchaseProgram" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockRepurchaseProgram"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockRepurchaseProgram" xlink:type="extended" id="i018c4d323e5845c9abbe168c0ec4391b_StockRepurchaseProgram"/>
  <link:roleRef roleURI="http://www.cognex.com/role/StockRepurchaseProgramDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#StockRepurchaseProgramDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/StockRepurchaseProgramDetails" xlink:type="extended" id="i3531cc6eae11479aa0f6e5c5156dd301_StockRepurchaseProgramDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EquityClassOfTreasuryStockLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchaseProgramAuthorizedAmount1_2a8183fa-0331-4174-83f7-f180573ec728" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchaseProgramAuthorizedAmount1"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRepurchaseProgramAuthorizedAmount1_2a8183fa-0331-4174-83f7-f180573ec728" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchasedDuringPeriodShares_19be2c72-7eb6-4419-aa05-381dd4759e89" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchasedDuringPeriodShares"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRepurchasedDuringPeriodShares_19be2c72-7eb6-4419-aa05-381dd4759e89" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchasedDuringPeriodValue_77710656-caac-4f79-b9d5-5b00a17e8124" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchasedDuringPeriodValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRepurchasedDuringPeriodValue_77710656-caac-4f79-b9d5-5b00a17e8124" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRedeemedOrCalledDuringPeriodShares_9e8d75ef-3620-462f-a4aa-21a844acf41a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRedeemedOrCalledDuringPeriodShares"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRedeemedOrCalledDuringPeriodShares_9e8d75ef-3620-462f-a4aa-21a844acf41a" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRedeemedOrCalledDuringPeriodValue_dbb34174-eddf-44cb-b107-ded9ebce8e24" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRedeemedOrCalledDuringPeriodValue"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRedeemedOrCalledDuringPeriodValue_dbb34174-eddf-44cb-b107-ded9ebce8e24" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StockRepurchaseProgramRemainingAuthorizedRepurchaseAmount1_8621cf56-71ea-4f34-b54a-a133dbaed822" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StockRepurchaseProgramRemainingAuthorizedRepurchaseAmount1"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_StockRepurchaseProgramRemainingAuthorizedRepurchaseAmount1_8621cf56-71ea-4f34-b54a-a133dbaed822" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ClassOfTreasuryStockTable_4e4e950c-f03a-4a2a-adda-b16ca137bc09" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ClassOfTreasuryStockTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_06a830dc-9932-48ff-bb9c-ee0a847c2106" xlink:to="loc_us-gaap_ClassOfTreasuryStockTable_4e4e950c-f03a-4a2a-adda-b16ca137bc09" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareRepurchaseProgramAxis_4cb72419-050a-423f-87c9-a009969036a7" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareRepurchaseProgramAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ClassOfTreasuryStockTable_4e4e950c-f03a-4a2a-adda-b16ca137bc09" xlink:to="loc_us-gaap_ShareRepurchaseProgramAxis_4cb72419-050a-423f-87c9-a009969036a7" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareRepurchaseProgramDomain_4cb72419-050a-423f-87c9-a009969036a7_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareRepurchaseProgramDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_ShareRepurchaseProgramAxis_4cb72419-050a-423f-87c9-a009969036a7" xlink:to="loc_us-gaap_ShareRepurchaseProgramDomain_4cb72419-050a-423f-87c9-a009969036a7_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareRepurchaseProgramDomain_03a50e8b-6888-4526-bca6-e52f8baa9f5d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareRepurchaseProgramDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_ShareRepurchaseProgramAxis_4cb72419-050a-423f-87c9-a009969036a7" xlink:to="loc_us-gaap_ShareRepurchaseProgramDomain_03a50e8b-6888-4526-bca6-e52f8baa9f5d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_RepurchaseProgramOctober2018Member_4801f4d5-8738-429c-8c8e-72f555b2f6ac" xlink:href="cgnx-20210404.xsd#cgnx_RepurchaseProgramOctober2018Member"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareRepurchaseProgramDomain_03a50e8b-6888-4526-bca6-e52f8baa9f5d" xlink:to="loc_cgnx_RepurchaseProgramOctober2018Member_4801f4d5-8738-429c-8c8e-72f555b2f6ac" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_RepurchaseProgramMarch2020Member_a9fe9e58-dd8c-46e5-a76e-bf2469668c27" xlink:href="cgnx-20210404.xsd#cgnx_RepurchaseProgramMarch2020Member"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareRepurchaseProgramDomain_03a50e8b-6888-4526-bca6-e52f8baa9f5d" xlink:to="loc_cgnx_RepurchaseProgramMarch2020Member_a9fe9e58-dd8c-46e5-a76e-bf2469668c27" xlink:type="arc" order="1"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/Taxes" xlink:type="simple" xlink:href="cgnx-20210404.xsd#Taxes"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/Taxes" xlink:type="extended" id="i05ff21c747bc48658a06edf97fd9fa68_Taxes"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IncomeTaxesTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IncomeTaxesTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IncomeTaxesTables" xlink:type="extended" id="ic13494391f814b34a7a4cb197abdfe1f_IncomeTaxesTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IncomeTaxesReconciliationofUnitedStatesFederalStatutoryCorporateTaxRatetoCompanysEffectiveTaxRateorIncomeTaxProvisionDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IncomeTaxesReconciliationofUnitedStatesFederalStatutoryCorporateTaxRatetoCompanysEffectiveTaxRateorIncomeTaxProvisionDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IncomeTaxesReconciliationofUnitedStatesFederalStatutoryCorporateTaxRatetoCompanysEffectiveTaxRateorIncomeTaxProvisionDetails" xlink:type="extended" id="ib7d7bcb1f3914ce2a3122e3d95b4c72e_IncomeTaxesReconciliationofUnitedStatesFederalStatutoryCorporateTaxRatetoCompanysEffectiveTaxRateorIncomeTaxProvisionDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/IncomeTaxesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#IncomeTaxesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/IncomeTaxesDetails" xlink:type="extended" id="ia1ab0d6c72c0475a8fe08fd2d95c7c95_IncomeTaxesDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxContingencyLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EffectiveIncomeTaxRateReconciliationShareBasedCompensationExcessTaxBenefitPercent_14e1aa7a-8130-4f9a-9876-ec0ea4d150b0" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EffectiveIncomeTaxRateReconciliationShareBasedCompensationExcessTaxBenefitPercent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_EffectiveIncomeTaxRateReconciliationShareBasedCompensationExcessTaxBenefitPercent_14e1aa7a-8130-4f9a-9876-ec0ea4d150b0" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EffectiveIncomeTaxRateReconciliationTaxSettlements_46fa3858-ee3f-4f2b-80fb-1802a5066b83" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EffectiveIncomeTaxRateReconciliationTaxSettlements"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_EffectiveIncomeTaxRateReconciliationTaxSettlements_46fa3858-ee3f-4f2b-80fb-1802a5066b83" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_EffectiveIncomeTaxRateReconciliationExcludingDiscreteItemsPercent_88d75575-4c0d-4ef5-b9c3-15ef7f333035" xlink:href="cgnx-20210404.xsd#cgnx_EffectiveIncomeTaxRateReconciliationExcludingDiscreteItemsPercent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_EffectiveIncomeTaxRateReconciliationExcludingDiscreteItemsPercent_88d75575-4c0d-4ef5-b9c3-15ef7f333035" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease_a4b3d804-804d-40a8-a8ae-33cc11961224" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease_a4b3d804-804d-40a8-a8ae-33cc11961224" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_IncreaseDecreaseInterestAndPenalties_d9eae3cf-56ae-4ecb-b175-03fa7c2e4025" xlink:href="cgnx-20210404.xsd#cgnx_IncreaseDecreaseInterestAndPenalties"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_IncreaseDecreaseInterestAndPenalties_d9eae3cf-56ae-4ecb-b175-03fa7c2e4025" xlink:type="arc" order="4"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate_0dd3ac69-f2e6-4f28-92c0-6b2c2dc7fd98" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate_0dd3ac69-f2e6-4f28-92c0-6b2c2dc7fd98" xlink:type="arc" order="5"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EffectiveIncomeTaxRateReconciliationForeignIncomeTaxRateDifferential_ee62f22e-82d6-4763-81c3-1bf13d41f9eb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EffectiveIncomeTaxRateReconciliationForeignIncomeTaxRateDifferential"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_EffectiveIncomeTaxRateReconciliationForeignIncomeTaxRateDifferential_ee62f22e-82d6-4763-81c3-1bf13d41f9eb" xlink:type="arc" order="6"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_LiabilityForUncertainTaxPositions_c0ebeed6-e244-49b8-ac77-16aa412fe10e" xlink:href="cgnx-20210404.xsd#cgnx_LiabilityForUncertainTaxPositions"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_LiabilityForUncertainTaxPositions_c0ebeed6-e244-49b8-ac77-16aa412fe10e" xlink:type="arc" order="7"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_LiabilityForUncertainTaxPositionsNoncurrent_f3565805-2faf-4e49-8ece-1ac40c9220b8" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_LiabilityForUncertainTaxPositionsNoncurrent"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_LiabilityForUncertainTaxPositionsNoncurrent_f3565805-2faf-4e49-8ece-1ac40c9220b8" xlink:type="arc" order="8"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncreaseDecreaseInDeferredLiabilities_311a5154-5653-48c5-9ebd-20bf15f3de5b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncreaseDecreaseInDeferredLiabilities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_IncreaseDecreaseInDeferredLiabilities_311a5154-5653-48c5-9ebd-20bf15f3de5b" xlink:type="arc" order="9"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued_22a954c7-908d-401a-a8ef-08db300bbbed" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued_22a954c7-908d-401a-a8ef-08db300bbbed" xlink:type="arc" order="10"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_MinimumDecreaseInIncomeTaxExpenseDueToReleaseInReserves_1fdb1676-bc5d-41c2-b3ae-24856f193917" xlink:href="cgnx-20210404.xsd#cgnx_MinimumDecreaseInIncomeTaxExpenseDueToReleaseInReserves"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_MinimumDecreaseInIncomeTaxExpenseDueToReleaseInReserves_1fdb1676-bc5d-41c2-b3ae-24856f193917" xlink:type="arc" order="11"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_MaxiumumDecreaseInIncomeTaxExpenseDueToReleaseInReserves_ebd5709a-194f-49aa-bcf2-c80dbe776d3d" xlink:href="cgnx-20210404.xsd#cgnx_MaxiumumDecreaseInIncomeTaxExpenseDueToReleaseInReserves"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_MaxiumumDecreaseInIncomeTaxExpenseDueToReleaseInReserves_ebd5709a-194f-49aa-bcf2-c80dbe776d3d" xlink:type="arc" order="12"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_TaxyearsopentoexaminationbyInternalRevenueService_a90c1687-ba2c-4b6b-af32-80cafdaca7a0" xlink:href="cgnx-20210404.xsd#cgnx_TaxyearsopentoexaminationbyInternalRevenueService"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_TaxyearsopentoexaminationbyInternalRevenueService_a90c1687-ba2c-4b6b-af32-80cafdaca7a0" xlink:type="arc" order="13"/>
    <link:loc xlink:type="locator" xlink:label="loc_cgnx_IncomeTaxExaminationYearsUnderExaminationOtherEntities_828e6ab4-587c-4940-9f4b-d23aced50098" xlink:href="cgnx-20210404.xsd#cgnx_IncomeTaxExaminationYearsUnderExaminationOtherEntities"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_cgnx_IncomeTaxExaminationYearsUnderExaminationOtherEntities_828e6ab4-587c-4940-9f4b-d23aced50098" xlink:type="arc" order="14"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxContingencyTable_f5a893ae-5278-4a64-a836-ecbe81c4730e" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxContingencyTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_IncomeTaxContingencyLineItems_964dce67-b7f8-423c-83fb-997599e33e48" xlink:to="loc_us-gaap_IncomeTaxContingencyTable_f5a893ae-5278-4a64-a836-ecbe81c4730e" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityAxis_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_IncomeTaxContingencyTable_f5a893ae-5278-4a64-a836-ecbe81c4730e" xlink:to="loc_us-gaap_IncomeTaxAuthorityAxis_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityDomain_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_IncomeTaxAuthorityAxis_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2" xlink:to="loc_us-gaap_IncomeTaxAuthorityDomain_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityDomain_2d8b725c-5d62-405d-b11b-cf3d90cc14bd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_IncomeTaxAuthorityAxis_fcfedae5-e1fb-4c87-91ee-7eb7bf455ec2" xlink:to="loc_us-gaap_IncomeTaxAuthorityDomain_2d8b725c-5d62-405d-b11b-cf3d90cc14bd" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ForeignCountryMember_d048ae67-3690-4310-a380-5e176b81c088" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ForeignCountryMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxAuthorityDomain_2d8b725c-5d62-405d-b11b-cf3d90cc14bd" xlink:to="loc_us-gaap_ForeignCountryMember_d048ae67-3690-4310-a380-5e176b81c088" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_DomesticCountryMember_ffd32075-9311-461d-be77-aafb6400be5d" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_DomesticCountryMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxAuthorityDomain_2d8b725c-5d62-405d-b11b-cf3d90cc14bd" xlink:to="loc_us-gaap_DomesticCountryMember_ffd32075-9311-461d-be77-aafb6400be5d" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityNameAxis_40b6ff28-f758-49b8-8485-7ba509b31781" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityNameAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_IncomeTaxContingencyTable_f5a893ae-5278-4a64-a836-ecbe81c4730e" xlink:to="loc_us-gaap_IncomeTaxAuthorityNameAxis_40b6ff28-f758-49b8-8485-7ba509b31781" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityNameDomain_40b6ff28-f758-49b8-8485-7ba509b31781_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_IncomeTaxAuthorityNameAxis_40b6ff28-f758-49b8-8485-7ba509b31781" xlink:to="loc_us-gaap_IncomeTaxAuthorityNameDomain_40b6ff28-f758-49b8-8485-7ba509b31781_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_IncomeTaxAuthorityNameDomain_2f06477a-249b-4ddb-bb69-8ca44238a8ca" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_IncomeTaxAuthorityNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_IncomeTaxAuthorityNameAxis_40b6ff28-f758-49b8-8485-7ba509b31781" xlink:to="loc_us-gaap_IncomeTaxAuthorityNameDomain_2f06477a-249b-4ddb-bb69-8ca44238a8ca" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RevenueCommissionersIrelandMember_e07f6d6a-bc2b-461c-b315-f0bac94f7304" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RevenueCommissionersIrelandMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxAuthorityNameDomain_2f06477a-249b-4ddb-bb69-8ca44238a8ca" xlink:to="loc_us-gaap_RevenueCommissionersIrelandMember_e07f6d6a-bc2b-461c-b315-f0bac94f7304" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_StateAdministrationOfTaxationChinaMember_e561252e-c18d-4875-bd0a-3477f2728b7a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_StateAdministrationOfTaxationChinaMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxAuthorityNameDomain_2f06477a-249b-4ddb-bb69-8ca44238a8ca" xlink:to="loc_us-gaap_StateAdministrationOfTaxationChinaMember_e561252e-c18d-4875-bd0a-3477f2728b7a" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_country_KP_e5c58a5a-68bf-4c8f-bf2a-8638a398a275" xlink:href="https://xbrl.sec.gov/country/2020/country-2020-01-31.xsd#country_KP"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_IncomeTaxAuthorityNameDomain_2f06477a-249b-4ddb-bb69-8ca44238a8ca" xlink:to="loc_country_KP_e5c58a5a-68bf-4c8f-bf2a-8638a398a275" xlink:type="arc" order="2"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/WeightedAverageShares" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WeightedAverageShares"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WeightedAverageShares" xlink:type="extended" id="i56282cc37a6f406caab0601fe32535fd_WeightedAverageShares"/>
  <link:roleRef roleURI="http://www.cognex.com/role/WeightedAverageSharesTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WeightedAverageSharesTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WeightedAverageSharesTables" xlink:type="extended" id="ifcb20cd469ac498ca1b7dd2f1c0605b3_WeightedAverageSharesTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/WeightedAverageSharesCalculationofWeightedAverageSharesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WeightedAverageSharesCalculationofWeightedAverageSharesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WeightedAverageSharesCalculationofWeightedAverageSharesDetails" xlink:type="extended" id="ief553d0a51754e61ba59c4bb62fe1d59_WeightedAverageSharesCalculationofWeightedAverageSharesDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/WeightedAverageSharesDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#WeightedAverageSharesDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/WeightedAverageSharesDetails" xlink:type="extended" id="i4bcee0489b694adaa974d8d1b5bc1e2a_WeightedAverageSharesDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_a5763447-ff61-492c-b68b-a906f3fdc742" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount_ffe813e9-f0a9-4c87-9552-f94d13ca721a" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_a5763447-ff61-492c-b68b-a906f3fdc742" xlink:to="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareAmount_ffe813e9-f0a9-4c87-9552-f94d13ca721a" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_7e7c129c-82a5-4989-80ac-6567c67d9266" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_a5763447-ff61-492c-b68b-a906f3fdc742" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_7e7c129c-82a5-4989-80ac-6567c67d9266" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareByAntidilutiveSecuritiesAxis_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareByAntidilutiveSecuritiesAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_7e7c129c-82a5-4989-80ac-6567c67d9266" xlink:to="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareByAntidilutiveSecuritiesAxis_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AntidilutiveSecuritiesNameDomain_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AntidilutiveSecuritiesNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareByAntidilutiveSecuritiesAxis_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1" xlink:to="loc_us-gaap_AntidilutiveSecuritiesNameDomain_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AntidilutiveSecuritiesNameDomain_dbf91b59-cf0f-4eaa-b073-b5b7ad9e8112" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AntidilutiveSecuritiesNameDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AntidilutiveSecuritiesExcludedFromComputationOfEarningsPerShareByAntidilutiveSecuritiesAxis_a7cb41f4-927a-4e74-b0d3-9743cbfe5cd1" xlink:to="loc_us-gaap_AntidilutiveSecuritiesNameDomain_dbf91b59-cf0f-4eaa-b073-b5b7ad9e8112" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_EmployeeStockOptionMember_cb624df6-b5b3-48d9-a1c5-9ad9a05a9076" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_EmployeeStockOptionMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AntidilutiveSecuritiesNameDomain_dbf91b59-cf0f-4eaa-b073-b5b7ad9e8112" xlink:to="loc_us-gaap_EmployeeStockOptionMember_cb624df6-b5b3-48d9-a1c5-9ad9a05a9076" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestrictedStockMember_f6f1df6e-ec4b-4c85-a402-45db47ffc5d4" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestrictedStockMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AntidilutiveSecuritiesNameDomain_dbf91b59-cf0f-4eaa-b073-b5b7ad9e8112" xlink:to="loc_us-gaap_RestrictedStockMember_f6f1df6e-ec4b-4c85-a402-45db47ffc5d4" xlink:type="arc" order="1"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/RestructuringCharges" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RestructuringCharges"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RestructuringCharges" xlink:type="extended" id="i230311742685420d9b7320a3097c9791_RestructuringCharges"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RestructuringChargesTables" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RestructuringChargesTables"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RestructuringChargesTables" xlink:type="extended" id="iee61d7f259824769a8b85f1c66874736_RestructuringChargesTables"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RestructuringChargesNarrativeDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RestructuringChargesNarrativeDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RestructuringChargesNarrativeDetails" xlink:type="extended" id="if080da76d23343978e4f2c1834d8bc85_RestructuringChargesNarrativeDetails"/>
  <link:roleRef roleURI="http://www.cognex.com/role/RestructuringChargesActivityinRestructuringReserveDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#RestructuringChargesActivityinRestructuringReserveDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/RestructuringChargesActivityinRestructuringReserveDetails" xlink:type="extended" id="i6255ab74399e4de8a639441ddf7029ad_RestructuringChargesActivityinRestructuringReserveDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringCostAndReserveLineItems_538f0abb-fc0a-40ba-9f46-904ddd86d7cb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringCostAndReserveLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringReserveRollForward_54c05f52-8739-470e-8d72-520e89c2e47b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringReserveRollForward"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RestructuringCostAndReserveLineItems_538f0abb-fc0a-40ba-9f46-904ddd86d7cb" xlink:to="loc_us-gaap_RestructuringReserveRollForward_54c05f52-8739-470e-8d72-520e89c2e47b" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringReserve_30c11efb-dce3-473d-a978-090107f6765b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringReserve"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RestructuringReserveRollForward_54c05f52-8739-470e-8d72-520e89c2e47b" xlink:to="loc_us-gaap_RestructuringReserve_30c11efb-dce3-473d-a978-090107f6765b" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_PaymentsForRestructuring_e2070014-a755-403a-bc8d-88dbe02bbffb" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_PaymentsForRestructuring"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RestructuringReserveRollForward_54c05f52-8739-470e-8d72-520e89c2e47b" xlink:to="loc_us-gaap_PaymentsForRestructuring_e2070014-a755-403a-bc8d-88dbe02bbffb" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringReserveTranslationAdjustment_d0b9a826-fec9-4357-89aa-df48780991e4" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringReserveTranslationAdjustment"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RestructuringReserveRollForward_54c05f52-8739-470e-8d72-520e89c2e47b" xlink:to="loc_us-gaap_RestructuringReserveTranslationAdjustment_d0b9a826-fec9-4357-89aa-df48780991e4" xlink:type="arc" order="3"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringReserve_01d0e49b-5a62-4943-98f9-030e4cc289d6" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringReserve"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ScheduleOfRestructuringAndRelatedCostsTable_ff1254fb-ecd1-40af-a937-8a35a67c6f1f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ScheduleOfRestructuringAndRelatedCostsTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_RestructuringCostAndReserveLineItems_538f0abb-fc0a-40ba-9f46-904ddd86d7cb" xlink:to="loc_us-gaap_ScheduleOfRestructuringAndRelatedCostsTable_ff1254fb-ecd1-40af-a937-8a35a67c6f1f" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_RestructuringCostAndReserveAxis_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_RestructuringCostAndReserveAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfRestructuringAndRelatedCostsTable_ff1254fb-ecd1-40af-a937-8a35a67c6f1f" xlink:to="loc_us-gaap_RestructuringCostAndReserveAxis_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TypeOfRestructuringDomain_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TypeOfRestructuringDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_RestructuringCostAndReserveAxis_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2" xlink:to="loc_us-gaap_TypeOfRestructuringDomain_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_TypeOfRestructuringDomain_da3fe99d-3b62-4b0b-b139-94bbb18d3e79" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_TypeOfRestructuringDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_RestructuringCostAndReserveAxis_bc6d82f0-310d-455c-9ea9-c79d9c51dfb2" xlink:to="loc_us-gaap_TypeOfRestructuringDomain_da3fe99d-3b62-4b0b-b139-94bbb18d3e79" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OneTimeTerminationBenefitsMember_63558519-4252-4e84-9617-1cd728fb3d56" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OneTimeTerminationBenefitsMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TypeOfRestructuringDomain_da3fe99d-3b62-4b0b-b139-94bbb18d3e79" xlink:to="loc_us-gaap_OneTimeTerminationBenefitsMember_63558519-4252-4e84-9617-1cd728fb3d56" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_ContractTerminationMember_2990a491-dc1e-4221-9c2a-54db2fb30d6f" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_ContractTerminationMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TypeOfRestructuringDomain_da3fe99d-3b62-4b0b-b139-94bbb18d3e79" xlink:to="loc_us-gaap_ContractTerminationMember_2990a491-dc1e-4221-9c2a-54db2fb30d6f" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_OtherRestructuringMember_dfa33332-09e4-4e72-8049-232040961fcd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_OtherRestructuringMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TypeOfRestructuringDomain_da3fe99d-3b62-4b0b-b139-94bbb18d3e79" xlink:to="loc_us-gaap_OtherRestructuringMember_dfa33332-09e4-4e72-8049-232040961fcd" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationAxis_4505b784-7025-411d-99e9-5a1c323f10b1" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfRestructuringAndRelatedCostsTable_ff1254fb-ecd1-40af-a937-8a35a67c6f1f" xlink:to="loc_us-gaap_BalanceSheetLocationAxis_4505b784-7025-411d-99e9-5a1c323f10b1" xlink:type="arc" order="2"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_4505b784-7025-411d-99e9-5a1c323f10b1_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_4505b784-7025-411d-99e9-5a1c323f10b1" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_4505b784-7025-411d-99e9-5a1c323f10b1_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_879fbf78-f467-4437-a5e6-a251921ab234" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_BalanceSheetLocationDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_4505b784-7025-411d-99e9-5a1c323f10b1" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_879fbf78-f467-4437-a5e6-a251921ab234" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_AccruedLiabilitiesMember_9c4c0443-97c2-403f-b09e-12784c5cd31b" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_AccruedLiabilitiesMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BalanceSheetLocationDomain_879fbf78-f467-4437-a5e6-a251921ab234" xlink:to="loc_us-gaap_AccruedLiabilitiesMember_9c4c0443-97c2-403f-b09e-12784c5cd31b" xlink:type="arc" order="0"/>
  </link:definitionLink>
  <link:roleRef roleURI="http://www.cognex.com/role/SubsequentEvents" xlink:type="simple" xlink:href="cgnx-20210404.xsd#SubsequentEvents"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/SubsequentEvents" xlink:type="extended" id="icbda4be25e0d453c8ec85365694cad28_SubsequentEvents"/>
  <link:roleRef roleURI="http://www.cognex.com/role/SubsequentEventsDetails" xlink:type="simple" xlink:href="cgnx-20210404.xsd#SubsequentEventsDetails"/>
  <link:definitionLink xlink:role="http://www.cognex.com/role/SubsequentEventsDetails" xlink:type="extended" id="if27649a192ca43caa619b362302e40cb_SubsequentEventsDetails">
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventLineItems_ae45494c-32c5-442a-9220-cfc4eca73c32" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventLineItems"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_Dividends_d361e991-966f-4931-b457-a07fb37b4205" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_Dividends"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_ae45494c-32c5-442a-9220-cfc4eca73c32" xlink:to="loc_us-gaap_Dividends_d361e991-966f-4931-b457-a07fb37b4205" xlink:type="arc" order="0"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventTable_14bdfcb2-5d42-4565-b855-d7ce808a99cf" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventTable"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SubsequentEventLineItems_ae45494c-32c5-442a-9220-cfc4eca73c32" xlink:to="loc_us-gaap_SubsequentEventTable_14bdfcb2-5d42-4565-b855-d7ce808a99cf" xlink:type="arc" order="1" xbrldt:closed="true" xbrldt:contextElement="segment"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventTypeAxis_a15505b1-d801-413b-8671-82e7a07fb758" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventTypeAxis"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_14bdfcb2-5d42-4565-b855-d7ce808a99cf" xlink:to="loc_us-gaap_SubsequentEventTypeAxis_a15505b1-d801-413b-8671-82e7a07fb758" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_a15505b1-d801-413b-8671-82e7a07fb758_default" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventTypeDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_a15505b1-d801-413b-8671-82e7a07fb758" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_a15505b1-d801-413b-8671-82e7a07fb758_default" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_146e9f55-a303-49b3-adab-f444a2c857bd" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventTypeDomain"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_a15505b1-d801-413b-8671-82e7a07fb758" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_146e9f55-a303-49b3-adab-f444a2c857bd" xlink:type="arc" order="1"/>
    <link:loc xlink:type="locator" xlink:label="loc_us-gaap_SubsequentEventMember_43363e33-f60f-4c51-b4ef-1f9cbc93d269" xlink:href="http://xbrl.fasb.org/us-gaap/2020/elts/us-gaap-2020-01-31.xsd#us-gaap_SubsequentEventMember"/>
    <link:definitionArc xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventTypeDomain_146e9f55-a303-49b3-adab-f444a2c857bd" xlink:to="loc_us-gaap_SubsequentEventMember_43363e33-f60f-4c51-b4ef-1f9cbc93d269" xlink:type="arc" order="0"/>
  </link:definitionLink>
</link:linkbase>
