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

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2016-01-25</periodOfReport>

    <issuer>
        <issuerCik>0000876437</issuerCik>
        <issuerName>MGIC INVESTMENT CORP</issuerName>
        <issuerTradingSymbol>MTG</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001041968</rptOwnerCik>
            <rptOwnerName>LANE JEFFREY H</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>MGIC PLAZA</rptOwnerStreet1>
            <rptOwnerStreet2>250 EAST KILBOURN AVENUE</rptOwnerStreet2>
            <rptOwnerCity>MILWAUKEE</rptOwnerCity>
            <rptOwnerState>WI</rptOwnerState>
            <rptOwnerZipCode>53202</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>Executive Vice President</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2016-01-25</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>96000</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>811663</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2016-01-25</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>24000</value>
                    <footnoteId id="F2"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>835663</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">These share units are subject to certain restrictions, and vest when such restrictions lapse. Partial vesting of these share units occurs on March 4 of each of the three years beginning in 2017, based on certain performance standards. If it is not possible to determine whether the performance standards have been met on any particular vesting date, the vesting date will be extended until such determination can be made. Any of these share units which have not vested when the final vesting is determined in 2019 will be forfeited.</footnote>
        <footnote id="F2">These share units are subject to certain restrictions, and vest when such restrictions lapse. One-third of these share units vest on February 10 of each of the three years beginning in 2017, subject to certain performance standards. If it is not possible to determine whether the performance standards have been met on any particular vesting date, the vesting date will be extended until such determination can be made. Any of these share units not vested as of February 10, 2019, may vest over the next two years if the performance standards are then satisfied. Any of these share units not vested as of February 10, 2021, will be forfeited.</footnote>
        <footnote id="F3">These share units were awarded to the reporting person pursuant to the Issuer's 20015 Omnibus Incentive Plan and no price was paid by the reporting person for the shares.</footnote>
    </footnotes>

    <remarks>This form is signed by the reporting person's attorney-in-fact pursuant to a previously filed power of attorney.</remarks>

    <ownerSignature>
        <signatureName>Dan D. Stilwell, Attorney-in-fact</signatureName>
        <signatureDate>2016-01-26</signatureDate>
    </ownerSignature>
</ownershipDocument>
