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

    <schemaVersion>X0407</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2023-06-30</periodOfReport>

    <notSubjectToSection16>true</notSubjectToSection16>

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

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001159021</rptOwnerCik>
            <rptOwnerName>HALEY STEPHEN W</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>445 PINE AVENUE</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>GOLETA</rptOwnerCity>
            <rptOwnerState>CA</rptOwnerState>
            <rptOwnerZipCode>93117</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isOfficer>true</isOfficer>
            <officerTitle>Exec Vice President</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>false</aff10b5One>

    <ownerSignature>
        <signatureName>Haley Stephen W</signatureName>
        <signatureDate>2023-07-05</signatureDate>
    </ownerSignature>
</ownershipDocument>
