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

    <schemaVersion>X0202</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2005-01-27</periodOfReport>

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

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001041957</rptOwnerCik>
            <rptOwnerName>CASE KARL E</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>106 CENTRAL STREET</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>WELLESLEY</rptOwnerCity>
            <rptOwnerState>MA</rptOwnerState>
            <rptOwnerZipCode>02481</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2005-01-27</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>500</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>6038</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Share Units</value>
                <footnoteId id="F3"/>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F4"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F5"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>203.1635</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>4379.1288</value>
                    <footnoteId id="F6"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">These securities were awarded to the reporting person pursuant to the Issuer's 2002 Stock Incentive Plan, are subject to certain restrictions, and vest on January 27, 2006.</footnote>
        <footnote id="F2">These shares were awarded to the reporting person pursuant to the Issuer's 2002 Stock Incentive Plan and no consideration was paid by the reporting person for the shares.</footnote>
        <footnote id="F3">The reporting person participates in the MGIC Investment Corporation Deferred Compensation Plan for Non-Employee Directors under which units corresponding to shares of Common Stock of the Issuer (&quot;Share Units&quot;) are acquired through compensation deferral.  Dividends which would have been received on shares represented by Share Units are also invested in Share Units. The Share Units are settled in cash, generally at the time the reporting person ceases to be a Director of the Issuer.</footnote>
        <footnote id="F4">These Share Units do not have a specified dollar-denominated exercise or conversion price.  (Their value is based, on a one-for-one basis, on the price of the Issuer's common stock on the New York Stock Exchange.)</footnote>
        <footnote id="F5">These Share Units do not become exercisable or expire on a fixed date.  (Generally, the Share Units become payable at the time the reporting person ceases to be a Director of the Issuer.)</footnote>
        <footnote id="F6">The number of Share Units beneficially owned by the reporting person includes Share Units owned prior to August 15, 1996, which were and continue to be exempt from Section 16 of the Securities and Exchange Act of 1934.  The reporting person disclaims any waiver of such exemption.</footnote>
    </footnotes>

    <remarks>This Form 4 is being 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>2005-01-28</signatureDate>
    </ownerSignature>
</ownershipDocument>

