<?xml version="1.0" encoding="UTF-8"?><edgarSubmission xmlns="http://www.sec.gov/edgar/ownership" xmlns:ns2="http://www.sec.gov/edgar/common">
    <headerData>
        <submissionType>144</submissionType>
        <filerInfo>
            <filer>
                <filerCredentials>
                    <cik>0001938568</cik>
                    <ccc>XXXXXXXX</ccc>
                </filerCredentials>
            </filer>
            <liveTestFlag>LIVE</liveTestFlag>



        </filerInfo>
    </headerData>
    <formData>
        <issuerInfo>
            <issuerCik>0000851205</issuerCik>
            <issuerName>COGNEX CORPORATION</issuerName>
            <secFileNumber>001-34218</secFileNumber>
            <issuerAddress>
                <ns2:street1>One Vision Drive</ns2:street1>
                <ns2:city>Natick</ns2:city>
                <ns2:stateOrCountry>MA</ns2:stateOrCountry>
                <ns2:zipCode>01760-2059</ns2:zipCode>
            </issuerAddress>
            <issuerContactPhone>(508) 650-3000</issuerContactPhone>
            <nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>JOERG KUECHEN</nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>
            <relationshipsToIssuer>
                <relationshipToIssuer>Officer</relationshipToIssuer>
            </relationshipsToIssuer>
        </issuerInfo>
        <securitiesInformation>
            <securitiesClassTitle>Common</securitiesClassTitle>
            <brokerOrMarketmakerDetails>
                <name>Morgan Stanley Smith Barney LLC Executive Financial Services</name>
                <address>
                    <ns2:street1>1 New York Plaza</ns2:street1>
                    <ns2:street2>8th Floor</ns2:street2>
                    <ns2:city>New York</ns2:city>
                    <ns2:stateOrCountry>NY</ns2:stateOrCountry>
                    <ns2:zipCode>10004</ns2:zipCode>
                </address>
            </brokerOrMarketmakerDetails>
            <noOfUnitsSold>5331</noOfUnitsSold>
            <aggregateMarketValue>218211.69</aggregateMarketValue>
            <noOfUnitsOutstanding>171633726</noOfUnitsOutstanding>
            <approxSaleDate>03/12/2024</approxSaleDate>
            <securitiesExchangeName>NASDAQ</securitiesExchangeName>
        </securitiesInformation>
        <securitiesToBeSold>
            <securitiesClassTitle>COMMON</securitiesClassTitle>
            <acquiredDate>02/21/2024</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>ISSUER</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>1775</amountOfSecuritiesAcquired>
            <paymentDate>02/21/2024</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <securitiesToBeSold>
            <securitiesClassTitle>COMMON</securitiesClassTitle>
            <acquiredDate>02/22/2024</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>ISSUER</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>1793</amountOfSecuritiesAcquired>
            <paymentDate>02/22/2024</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <securitiesToBeSold>
            <securitiesClassTitle>COMMON</securitiesClassTitle>
            <acquiredDate>02/16/2024</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>ISSUER</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>1763</amountOfSecuritiesAcquired>
            <paymentDate>02/16/2024</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <nothingToReportFlagOnSecuritiesSoldInPast3Months>Y</nothingToReportFlagOnSecuritiesSoldInPast3Months>
        <noticeSignature>
            <noticeDate>03/12/2024</noticeDate>
            <planAdoptionDates>
                <planAdoptionDate>12/12/2023</planAdoptionDate>
            </planAdoptionDates>
            <signature>/s/ Joerg Kuechen</signature>
        </noticeSignature>
    </formData>
</edgarSubmission>
[{"type": "144", "sequence": "1", "filename": "primary_doc.xml", "secsgml_size_bytes": 4479}]
144
0001938568
XXXXXXXX
LIVE
0000851205
COGNEX CORPORATION
001-34218
One Vision Drive
Natick
MA
01760-2059
(508) 650-3000
JOERG KUECHEN
Officer
Common
Morgan Stanley Smith Barney LLC Executive Financial Services
1 New York Plaza
8th Floor
New York
NY
10004
5331
218211.69
171633726
03/12/2024
NASDAQ
COMMON
02/21/2024
Restricted Stock
ISSUER
N
1775
02/21/2024
Not Applicable
COMMON
02/22/2024
Restricted Stock
ISSUER
N
1793
02/22/2024
Not Applicable
COMMON
02/16/2024
Restricted Stock
ISSUER
N
1763
02/16/2024
Not Applicable
Y
03/12/2024
12/12/2023
/s/ Joerg Kuechen