<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2018-11-15</periodOfReport>

    <notSubjectToSection16>1</notSubjectToSection16>

    <issuer>
        <issuerCik>0001028215</issuerCik>
        <issuerName>KMG CHEMICALS INC</issuerName>
        <issuerTradingSymbol>KMG</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001436708</rptOwnerCik>
            <rptOwnerName>Fraser Christopher T.</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>9448 BELLA TERRA DRIVE</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>FT WORTH</rptOwnerCity>
            <rptOwnerState>TX</rptOwnerState>
            <rptOwnerZipCode>76126</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>President and CEO</officerTitle>
            <otherText></otherText>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2018-11-15</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>D</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>296869</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2018-11-15</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>D</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>88445</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>by Deferred Compensation Plan</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Time and Performance Stock Awards</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>0</value>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2018-11-15</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>D</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>4</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F3"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <footnoteId id="F3"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
        <derivativeTransaction>
            <securityTitle>
                <value>Time Based Stock Award</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>0</value>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2018-11-15</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>D</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>1</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <value>2021-07-31</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <footnoteId id="F4"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">Disposed of pursuant to the Agreement and Plan of Merger (the &quot;Merger Agreement&quot;), dated as of August 14, 2018, by and among KMG Chemicals, Inc. (&quot;KMG&quot;), Cabot Microelectronics Corporation (&quot;Cabot Microelectronics&quot;) and Cobalt Merger Sub Corporation, in exchange for 59,373 shares of Cabot Microelectronics common stock and $16,520,842 in cash consideration at the Effective Time of the merger.</footnote>
        <footnote id="F2">Disposed of pursuant to the Agreement and Plan of Merger (the &quot;Merger Agreement&quot;), dated as of August 14, 2018, by and among KMG Chemicals, Inc. (&quot;KMG&quot;), Cabot Microelectronics Corporation (&quot;Cabot Microelectronics&quot;) and Cobalt Merger Sub Corporation, in exchange for 17,689 shares of Cabot Microelectronics common stock and $4,921,964 in cash consideration at the Effective Time of the merger.</footnote>
        <footnote id="F3">Pursuant to the Merger Agreement, the restricted stock unit awards which were granted prior to August 14, 2018 and which expire 7/31/19 and 7/31/20, fully vested and were cancelled and converted in the merger in exchange for 54,382 shares of Cabot Microelectronics common stock and $15,131,934 in cash consideration at the Effective Time of the merger, which is the right to receive the merger consideration in respect of each share of KMG common stock underlying the applicable restricted stock united award.</footnote>
        <footnote id="F4">Pursuant to the Merger Agreement, the restricted stock unit award which was granted on or following August 14, 2018, was assumed by Cabot Microelectronics and converted into a restricted stock unit award relating to a number of shares of Cabot Microelectronics common stock (rounded to the nearest whole share) equal to (i) the number of shares of KMG common stock subject to such KMG restricted stock unit award immediately prior to the effective time, multiplied by (ii) the &quot;equity award exchange ratio&quot; (defined below). The assumed restricted stock unit awards will be subject to the same terms and conditions as were applicable to the corresponding KMG equity award immediately prior to the effective time (including vesting terms). The &quot;equity award exchange ratio&quot; means the sum of (a) 0.2000 and (b) the quotient (rounded to four decimal places) obtained by dividing (x) $55.65 by (y) the volume weighted average price per share (calculated to the nearest one-hundredth of one cent) of Cabot</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>Christopher T Fraser</signatureName>
        <signatureDate>2018-11-16</signatureDate>
    </ownerSignature>
</ownershipDocument>
