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

    <schemaVersion>X0202</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2005-06-07</periodOfReport>

    <issuer>
        <issuerCik>0001130591</issuerCik>
        <issuerName>XENOPORT INC</issuerName>
        <issuerTradingSymbol>XNPT</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0000937889</rptOwnerCik>
            <rptOwnerName>VENROCK ASSOCIATES</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>30 ROCKEFELLER PLAZA, ROOM 5508</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>NEW YORK</rptOwnerCity>
            <rptOwnerState>NY</rptOwnerState>
            <rptOwnerZipCode>10112</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>1</isTenPercentOwner>
            <isOther>0</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Series D Preferred Stock</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F1"/>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2005-06-07</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>J</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
                <footnoteId id="F2"/>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>2914</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F3"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>2914</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>71247</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">Each share of Series D Preferred Stock will automatically convert into Common Stock on a 1-for-1 basis concurrently with the closing of the Issuer's initial public offering.</footnote>
        <footnote id="F2">Shares of Series D Preferred Stock received pursuant to a stock dividend paid as an in-kind dividend on the Issuer's outstanding shares of Series D Preferred Stock.</footnote>
        <footnote id="F3">Shares of Preferred Stock are convertible into Common Stock at any time and have no expiration date.  All outstanding shares of Preferred Stock will automatically convert into shares of Common Stock concurrently with the closing of the Issuer's initial public offering.</footnote>
    </footnotes>

    <remarks></remarks>

    <ownerSignature>
        <signatureName>Bryan E. Roberts, General Partner</signatureName>
        <signatureDate>2005-06-09</signatureDate>
    </ownerSignature>
</ownershipDocument>
