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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2025-12-10</periodOfReport>

    <issuer>
        <issuerCik>0001085913</issuerCik>
        <issuerName>FARMERS &amp; MERCHANTS BANCORP</issuerName>
        <issuerTradingSymbol>FMCB</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001733836</rptOwnerCik>
            <rptOwnerName>Green Steven K.</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>111 W. PINE ST.</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>LODI</rptOwnerCity>
            <rptOwnerState>CA</rptOwnerState>
            <rptOwnerZipCode>95240</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>true</isDirector>
            <isOfficer>false</isOfficer>
            <isTenPercentOwner>false</isTenPercentOwner>
            <isOther>false</isOther>
            <officerTitle></officerTitle>
            <otherText></otherText>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common stock</value>
            </securityTitle>
            <transactionDate>
                <value>2025-12-10</value>
            </transactionDate>
            <deemedExecutionDate></deemedExecutionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>G</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>362</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>547</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Held in family trust</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable></derivativeTable>

    <footnotes>
        <footnote id="F1">Shares previously held indirectly through the Company's Non-Qualified Executive Retirement Plans, which, in connection with the liquidation and distribution of the Plans, were distributed by the Trustees of the Plan to Reporting Person's family trust on December 10, 2025, for no consideration.  The Reporting Person is a trustee of the trust, and the Reporting Person and member of his immediate family are the sole beneficiaries of the trust.  The Reporting Person remains the beneficial owner of the securities held by the trust.</footnote>
        <footnote id="F2">185 additional shares of the Issuer's common stock held in Trust were previously reported as directly owned by the Reporting Person.</footnote>
    </footnotes>

    <remarks></remarks>

    <ownerSignature>
        <signatureName>Green Steven K.</signatureName>
        <signatureDate>2025-12-18</signatureDate>
    </ownerSignature>
</ownershipDocument>
