<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.26.1</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>1044</ContextCount>
  <ElementCount>486</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>132</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>6</UnitCount>
  <MyReports>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>0000001 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DocumentandEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>9952151 - Statement - Consolidated Balance Sheet (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedBalanceSheetUnaudited</Role>
      <ShortName>Consolidated Balance Sheet (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>9952152 - Statement - Consolidated Balance Sheet (Unaudited) (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedBalanceSheetUnauditedParenthetical</Role>
      <ShortName>Consolidated Balance Sheet (Unaudited) (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>9952153 - Statement - Consolidated Statement of Income (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedStatementofIncomeUnaudited</Role>
      <ShortName>Consolidated Statement of Income (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>9952154 - Statement - Consolidated Statement of Comprehensive Income (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedStatementofComprehensiveIncomeUnaudited</Role>
      <ShortName>Consolidated Statement of Comprehensive Income (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>9952155 - Statement - Consolidated Statement of Cash Flows (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedStatementofCashFlowsUnaudited</Role>
      <ShortName>Consolidated Statement of Cash Flows (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>9952156 - Statement - Consolidated Statement of Changes in Shareholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedStatementofChangesinShareholdersEquity</Role>
      <ShortName>Consolidated Statement of Changes in Shareholders' Equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>9952157 - Statement - Consolidated Statement of Changes in Shareholders' Equity (Unaudited) (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ConsolidatedStatementofChangesinShareholdersEquityUnauditedParenthetical</Role>
      <ShortName>Consolidated Statement of Changes in Shareholders' Equity (Unaudited) (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>9952158 - Disclosure - Significant accounting policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Significantaccountingpolicies</Role>
      <ShortName>Significant accounting policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>9952159 - Disclosure - Divestiture</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Divestiture</Role>
      <ShortName>Divestiture</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>9952160 - Disclosure - Investment securities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Investmentsecurities</Role>
      <ShortName>Investment securities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>9952161 - Disclosure - Loans and allowance for loan losses</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Loansandallowanceforloanlosses</Role>
      <ShortName>Loans and allowance for loan losses</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>9952162 - Disclosure - Borrowings</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Borrowings</Role>
      <ShortName>Borrowings</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>9952163 - Disclosure - Shareholders' equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Shareholdersequity</Role>
      <ShortName>Shareholders' equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>9952164 - Disclosure - Revenue from contracts with customers</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Revenuefromcontractswithcustomers</Role>
      <ShortName>Revenue from contracts with customers</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>9952165 - Disclosure - Pension plans and other postretirement benefits</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Pensionplansandotherpostretirementbenefits</Role>
      <ShortName>Pension plans and other postretirement benefits</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>9952166 - Disclosure - Earnings per common share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Earningspercommonshare</Role>
      <ShortName>Earnings per common share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>9952167 - Disclosure - Comprehensive income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Comprehensiveincome</Role>
      <ShortName>Comprehensive income</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>9952168 - Disclosure - Derivative financial instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Derivativefinancialinstruments</Role>
      <ShortName>Derivative financial instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>9952169 - Disclosure - Variable interest entities and asset securitizations</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Variableinterestentitiesandassetsecuritizations</Role>
      <ShortName>Variable interest entities and asset securitizations</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>9952170 - Disclosure - Fair value measurements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Fairvaluemeasurements</Role>
      <ShortName>Fair value measurements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>9952171 - Disclosure - Commitments and contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Commitmentsandcontingencies</Role>
      <ShortName>Commitments and contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>9952172 - Disclosure - Segment information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/Segmentinformation</Role>
      <ShortName>Segment information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>23</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>9952173 - Disclosure - Relationship with BLG and Bayview Financial</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/RelationshipwithBLGandBayviewFinancial</Role>
      <ShortName>Relationship with BLG and Bayview Financial</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>24</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>995445 - Disclosure - Insider Trading Arrangements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/InsiderTradingArrangements</Role>
      <ShortName>Insider Trading Arrangements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>25</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>9955511 - Disclosure - Significant accounting policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SignificantaccountingpoliciesPolicies</Role>
      <ShortName>Significant accounting policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <Position>26</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>9955512 - Disclosure - Significant accounting policies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SignificantaccountingpoliciesTables</Role>
      <ShortName>Significant accounting policies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Significantaccountingpolicies</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>9955513 - Disclosure - Investment securities (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesTables</Role>
      <ShortName>Investment securities (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Investmentsecurities</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>9955514 - Disclosure - Loans and allowance for loan losses (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesTables</Role>
      <ShortName>Loans and allowance for loan losses (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Loansandallowanceforloanlosses</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>9955515 - Disclosure - Borrowings (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/BorrowingsTables</Role>
      <ShortName>Borrowings (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Borrowings</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>9955516 - Disclosure - Shareholders' equity (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ShareholdersequityTables</Role>
      <ShortName>Shareholders' equity (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Shareholdersequity</ParentRole>
      <Position>31</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>9955517 - Disclosure - Revenue from contracts with customers (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/RevenuefromcontractswithcustomersTables</Role>
      <ShortName>Revenue from contracts with customers (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Revenuefromcontractswithcustomers</ParentRole>
      <Position>32</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>9955518 - Disclosure - Pension plans and other postretirement benefits (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/PensionplansandotherpostretirementbenefitsTables</Role>
      <ShortName>Pension plans and other postretirement benefits (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Pensionplansandotherpostretirementbenefits</ParentRole>
      <Position>33</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>9955519 - Disclosure - Earnings per common share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/EarningspercommonshareTables</Role>
      <ShortName>Earnings per common share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Earningspercommonshare</ParentRole>
      <Position>34</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>9955520 - Disclosure - Comprehensive income (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ComprehensiveincomeTables</Role>
      <ShortName>Comprehensive income (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Comprehensiveincome</ParentRole>
      <Position>35</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>9955521 - Disclosure - Derivative financial instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsTables</Role>
      <ShortName>Derivative financial instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Derivativefinancialinstruments</ParentRole>
      <Position>36</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>9955522 - Disclosure - Variable interest entities and asset securitizations (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/VariableinterestentitiesandassetsecuritizationsTables</Role>
      <ShortName>Variable interest entities and asset securitizations (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Variableinterestentitiesandassetsecuritizations</ParentRole>
      <Position>37</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>9955523 - Disclosure - Fair value measurements (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsTables</Role>
      <ShortName>Fair value measurements (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Fairvaluemeasurements</ParentRole>
      <Position>38</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>9955524 - Disclosure - Commitments and contingencies (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/CommitmentsandcontingenciesTables</Role>
      <ShortName>Commitments and contingencies (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Commitmentsandcontingencies</ParentRole>
      <Position>39</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>9955525 - Disclosure - Segment information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SegmentinformationTables</Role>
      <ShortName>Segment information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.mtb.com/role/Segmentinformation</ParentRole>
      <Position>40</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>9955526 - Disclosure - Significant accounting policies - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SignificantaccountingpoliciesAdditionalInformationDetails</Role>
      <ShortName>Significant accounting policies - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>9955527 - Disclosure - Significant accounting policies - Schedule of Prior Period Adjustments (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SignificantaccountingpoliciesScheduleofPriorPeriodAdjustmentsDetails</Role>
      <ShortName>Significant accounting policies - Schedule of Prior Period Adjustments (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>9955528 - Disclosure - Divestiture - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DivestitureAdditionalInformationDetails</Role>
      <ShortName>Divestiture - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>9955529 - Disclosure - Investment securities - Amortized Cost and Estimated Fair Value of Investment Securities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesAmortizedCostandEstimatedFairValueofInvestmentSecuritiesDetail</Role>
      <ShortName>Investment securities - Amortized Cost and Estimated Fair Value of Investment Securities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>9955530 - Disclosure - Investment securities - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesAdditionalInformationDetail</Role>
      <ShortName>Investment securities - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>9955531 - Disclosure - Investment securities - Investment Securities in Continuous Unrealized Loss Position (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesInvestmentSecuritiesinContinuousUnrealizedLossPositionDetail</Role>
      <ShortName>Investment securities - Investment Securities in Continuous Unrealized Loss Position (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>9955532 - Disclosure - Investment securities - Amortized Cost and Estimated Fair Value of Debt Securities by Contractual Maturity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesAmortizedCostandEstimatedFairValueofDebtSecuritiesbyContractualMaturityDetail</Role>
      <ShortName>Investment securities - Amortized Cost and Estimated Fair Value of Debt Securities by Contractual Maturity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>9955533 - Disclosure - Investment securities - Investment Securities Realized Gains and Losses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/InvestmentsecuritiesInvestmentSecuritiesRealizedGainsandLossesDetail</Role>
      <ShortName>Investment securities - Investment Securities Realized Gains and Losses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>9955534 - Disclosure - Loans and allowance for loan losses - Summary of Current, Past Due and Nonaccrual Loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesSummaryofCurrentPastDueandNonaccrualLoansDetail</Role>
      <ShortName>Loans and allowance for loan losses - Summary of Current, Past Due and Nonaccrual Loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>9955535 - Disclosure - Loans and allowance for loan losses - Summary of Pledged Loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesSummaryofPledgedLoansDetail</Role>
      <ShortName>Loans and allowance for loan losses - Summary of Pledged Loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>9955536 - Disclosure - Loans and allowance for loan losses - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesAdditionalInformationDetail</Role>
      <ShortName>Loans and allowance for loan losses - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>51</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>9955537 - Disclosure - Loans and allowance for loan losses - Summary of Loan grades applied various classes of Commercial and Real Estate Loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesSummaryofLoangradesappliedvariousclassesofCommercialandRealEstateLoansDetail</Role>
      <ShortName>Loans and allowance for loan losses - Summary of Loan grades applied various classes of Commercial and Real Estate Loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>9955538 - Disclosure - Loans and allowance for loan losses - Summary of loans in Accrual and Nonaccrual Status (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesSummaryofloansinAccrualandNonaccrualStatusDetail</Role>
      <ShortName>Loans and allowance for loan losses - Summary of loans in Accrual and Nonaccrual Status (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>9955539 - Disclosure - Loans and allowance for loan losses - Changes in Allowance for Credit Losses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesChangesinAllowanceforCreditLossesDetail</Role>
      <ShortName>Loans and allowance for loan losses - Changes in Allowance for Credit Losses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>9955540 - Disclosure - Loans and allowance for loan losses - Loan and Leases Considered Nonaccrual and Interest Income Recognized on Loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesLoanandLeasesConsideredNonaccrualandInterestIncomeRecognizedonLoansDetail</Role>
      <ShortName>Loans and allowance for loan losses - Loan and Leases Considered Nonaccrual and Interest Income Recognized on Loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>9955541 - Disclosure - Loans and allowance for loan losses - Loan Modification Activities to Borrowers Experiencing Financial Difficulty on Financing Receivables (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesLoanModificationActivitiestoBorrowersExperiencingFinancialDifficultyonFinancingReceivablesDetail</Role>
      <ShortName>Loans and allowance for loan losses - Loan Modification Activities to Borrowers Experiencing Financial Difficulty on Financing Receivables (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>9955542 - Disclosure - Loans and allowance for loan losses - Effect of Loan Modification on Weighted-average Remaining Life (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesEffectofLoanModificationonWeightedaverageRemainingLifeDetail</Role>
      <ShortName>Loans and allowance for loan losses - Effect of Loan Modification on Weighted-average Remaining Life (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>9955543 - Disclosure - Loans and allowance for loan losses - Summary of Payment Status of Loans Modified (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/LoansandallowanceforloanlossesSummaryofPaymentStatusofLoansModifiedDetail</Role>
      <ShortName>Loans and allowance for loan losses - Summary of Payment Status of Loans Modified (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>9955544 - Disclosure - Borrowings - Schedule of Borrowings (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/BorrowingsScheduleofBorrowingsDetails</Role>
      <ShortName>Borrowings - Schedule of Borrowings (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>9955545 - Disclosure - Borrowings - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/BorrowingsAdditionalInformationDetail</Role>
      <ShortName>Borrowings - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>9955546 - Disclosure - Shareholders' equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ShareholdersequityAdditionalInformationDetail</Role>
      <ShortName>Shareholders' equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>61</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>9955547 - Disclosure - Shareholders' equity - Issued and Outstanding Preferred Stock (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ShareholdersequityIssuedandOutstandingPreferredStockDetail</Role>
      <ShortName>Shareholders' equity - Issued and Outstanding Preferred Stock (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>62</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>9955548 - Disclosure - Revenue from contracts with customers - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/RevenuefromcontractswithcustomersAdditionalInformationDetails</Role>
      <ShortName>Revenue from contracts with customers - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>63</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R64.htm</HtmlFileName>
      <LongName>9955549 - Disclosure - Revenue from contracts with customers - Summary of Sources of Noninterest Income that are Subject to Revenue Recognition Accounting Guidance (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/RevenuefromcontractswithcustomersSummaryofSourcesofNoninterestIncomethatareSubjecttoRevenueRecognitionAccountingGuidanceDetails</Role>
      <ShortName>Revenue from contracts with customers - Summary of Sources of Noninterest Income that are Subject to Revenue Recognition Accounting Guidance (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>64</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R65.htm</HtmlFileName>
      <LongName>9955550 - Disclosure - Pension plans and other postretirement benefits - Net Periodic Defined Benefit Cost for Defined Benefit Plans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/PensionplansandotherpostretirementbenefitsNetPeriodicDefinedBenefitCostforDefinedBenefitPlansDetail</Role>
      <ShortName>Pension plans and other postretirement benefits - Net Periodic Defined Benefit Cost for Defined Benefit Plans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>65</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R66.htm</HtmlFileName>
      <LongName>9955551 - Disclosure - Pension plans and other postretirement benefits - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/PensionplansandotherpostretirementbenefitsAdditionalInformationDetails</Role>
      <ShortName>Pension plans and other postretirement benefits - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>66</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R67.htm</HtmlFileName>
      <LongName>9955552 - Disclosure - Earnings per common share - Computations of Basic Earnings Per Common Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/EarningspercommonshareComputationsofBasicEarningsPerCommonShareDetail</Role>
      <ShortName>Earnings per common share - Computations of Basic Earnings Per Common Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>67</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R68.htm</HtmlFileName>
      <LongName>9955553 - Disclosure - Earnings per common share - Computations of Diluted Earnings Per Common Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/EarningspercommonshareComputationsofDilutedEarningsPerCommonShareDetail</Role>
      <ShortName>Earnings per common share - Computations of Diluted Earnings Per Common Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>68</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R69.htm</HtmlFileName>
      <LongName>9955554 - Disclosure - Earnings per common share - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/EarningspercommonshareAdditionalInformationDetail</Role>
      <ShortName>Earnings per common share - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>69</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R70.htm</HtmlFileName>
      <LongName>9955555 - Disclosure - Comprehensive income - Components of Other Comprehensive Income (Loss) and Amounts Reclassified from Accumulated Other Comprehensive Income (Loss) to Net Income (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ComprehensiveincomeComponentsofOtherComprehensiveIncomeLossandAmountsReclassifiedfromAccumulatedOtherComprehensiveIncomeLosstoNetIncomeDetail</Role>
      <ShortName>Comprehensive income - Components of Other Comprehensive Income (Loss) and Amounts Reclassified from Accumulated Other Comprehensive Income (Loss) to Net Income (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>70</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R71.htm</HtmlFileName>
      <LongName>9955556 - Disclosure - Comprehensive income - Accumulated Other Comprehensive Income (Loss), Net (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/ComprehensiveincomeAccumulatedOtherComprehensiveIncomeLossNetDetail</Role>
      <ShortName>Comprehensive income - Accumulated Other Comprehensive Income (Loss), Net (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>71</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R72.htm</HtmlFileName>
      <LongName>9955557 - Disclosure - Derivative financial instruments - Information about Interest Rate Swap Agreements (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsInformationaboutInterestRateSwapAgreementsDetail</Role>
      <ShortName>Derivative financial instruments - Information about Interest Rate Swap Agreements (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>72</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R73.htm</HtmlFileName>
      <LongName>9955558 - Disclosure - Derivative financial instruments - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsAdditionalInformationDetail</Role>
      <ShortName>Derivative financial instruments - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>73</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R74.htm</HtmlFileName>
      <LongName>9955559 - Disclosure - Derivative financial instruments - Information about Fair Values of Derivative Instruments in Consolidated Balance Sheet (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsInformationaboutFairValuesofDerivativeInstrumentsinConsolidatedBalanceSheetDetail</Role>
      <ShortName>Derivative financial instruments - Information about Fair Values of Derivative Instruments in Consolidated Balance Sheet (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>74</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R75.htm</HtmlFileName>
      <LongName>9955560 - Disclosure - Derivative financial instruments - Information about Fair Values of Derivative Instruments in Consolidated Statement of Income (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsInformationaboutFairValuesofDerivativeInstrumentsinConsolidatedStatementofIncomeDetail</Role>
      <ShortName>Derivative financial instruments - Information about Fair Values of Derivative Instruments in Consolidated Statement of Income (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>75</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R76.htm</HtmlFileName>
      <LongName>9955561 - Disclosure - Derivative financial instruments - Information about Hedged Items Included in Consolidated Balance Sheet (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativefinancialinstrumentsInformationaboutHedgedItemsIncludedinConsolidatedBalanceSheetDetail</Role>
      <ShortName>Derivative financial instruments - Information about Hedged Items Included in Consolidated Balance Sheet (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>76</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R77.htm</HtmlFileName>
      <LongName>9955562 - Disclosure - Derivative Financial Instruments - Schedule of Fair Value with Netting (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/DerivativeFinancialInstrumentsScheduleofFairValuewithNettingDetails</Role>
      <ShortName>Derivative Financial Instruments - Schedule of Fair Value with Netting (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>77</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R78.htm</HtmlFileName>
      <LongName>9955563 - Disclosure - Variable interest entities and asset securitizations - Asset-backed Notes Issued to Investors (Details)</LongName>
      <ReportType>Notes</ReportType>
      <Role>http://www.mtb.com/role/VariableinterestentitiesandassetsecuritizationsAssetbackedNotesIssuedtoInvestorsDetails</Role>
      <ShortName>Variable interest entities and asset securitizations - Asset-backed Notes Issued to Investors (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>78</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R79.htm</HtmlFileName>
      <LongName>9955564 - Disclosure - Variable interest entities and asset securitizations - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/VariableinterestentitiesandassetsecuritizationsAdditionalInformationDetail</Role>
      <ShortName>Variable interest entities and asset securitizations - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>79</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R80.htm</HtmlFileName>
      <LongName>9955565 - Disclosure - Variable interest entities and asset securitizations - Summary of Carrying Amount (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/VariableinterestentitiesandassetsecuritizationsSummaryofCarryingAmountDetails</Role>
      <ShortName>Variable interest entities and asset securitizations - Summary of Carrying Amount (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>80</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R81.htm</HtmlFileName>
      <LongName>9955566 - Disclosure - Fair value measurements - Assets and Liabilities Measured at Estimated Fair Value on Recurring Basis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsAssetsandLiabilitiesMeasuredatEstimatedFairValueonRecurringBasisDetail</Role>
      <ShortName>Fair value measurements - Assets and Liabilities Measured at Estimated Fair Value on Recurring Basis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>81</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R82.htm</HtmlFileName>
      <LongName>9955567 - Disclosure - Fair value measurements - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsAdditionalInformationDetail</Role>
      <ShortName>Fair value measurements - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>82</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R83.htm</HtmlFileName>
      <LongName>9955568 - Disclosure - Fair value measurements - Mortgage Servicing Rights at Fair Value (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsMortgageServicingRightsatFairValueDetail</Role>
      <ShortName>Fair value measurements - Mortgage Servicing Rights at Fair Value (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>83</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R84.htm</HtmlFileName>
      <LongName>9955569 - Disclosure - Fair value measurements - Mortgage Servicing Rights Fair Value Measurement Inputs (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsMortgageServicingRightsFairValueMeasurementInputsDetail</Role>
      <ShortName>Fair value measurements - Mortgage Servicing Rights Fair Value Measurement Inputs (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>84</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R85.htm</HtmlFileName>
      <LongName>9955570 - Disclosure - Fair Value Measurements - Assets and Liabilities Measured at Estimated Fair Value on Nonrecurring Basis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairValueMeasurementsAssetsandLiabilitiesMeasuredatEstimatedFairValueonNonrecurringBasisDetail</Role>
      <ShortName>Fair Value Measurements - Assets and Liabilities Measured at Estimated Fair Value on Nonrecurring Basis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>85</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R86.htm</HtmlFileName>
      <LongName>9955571 - Disclosure - Fair value measurements - Carrying Amounts and Estimated Fair Value for Financial Instrument Assets (Liabilities) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/FairvaluemeasurementsCarryingAmountsandEstimatedFairValueforFinancialInstrumentAssetsLiabilitiesDetail</Role>
      <ShortName>Fair value measurements - Carrying Amounts and Estimated Fair Value for Financial Instrument Assets (Liabilities) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>86</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R87.htm</HtmlFileName>
      <LongName>9955572 - Disclosure - Commitments and contingencies - Commitments and Contingent Liabilities Outstanding (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/CommitmentsandcontingenciesCommitmentsandContingentLiabilitiesOutstandingDetail</Role>
      <ShortName>Commitments and contingencies - Commitments and Contingent Liabilities Outstanding (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>87</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R88.htm</HtmlFileName>
      <LongName>9955573 - Disclosure - Commitments and contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/CommitmentsandcontingenciesAdditionalInformationDetail</Role>
      <ShortName>Commitments and contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>88</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R89.htm</HtmlFileName>
      <LongName>9955574 - Disclosure - Segment information - Information about Company's Segments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SegmentinformationInformationaboutCompanysSegmentsDetail</Role>
      <ShortName>Segment information - Information about Company's Segments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>89</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R90.htm</HtmlFileName>
      <LongName>9955575 - Disclosure - Segment information - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/SegmentinformationAdditionalInformationDetails</Role>
      <ShortName>Segment information - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>90</Position>
    </Report>
    <Report instance="mtb-20260630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R91.htm</HtmlFileName>
      <LongName>9955576 - Disclosure - Relationship with BLG and Bayview Financial (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.mtb.com/role/RelationshipwithBLGandBayviewFinancialDetail</Role>
      <ShortName>Relationship with BLG and Bayview Financial (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.mtb.com/role/RelationshipwithBLGandBayviewFinancial</ParentRole>
      <Position>91</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" isDefinitelyFs="true" isUsgaap="true" original="mtb-20260630.htm">mtb-20260630.htm</File>
    <File>mtb-20260630.xsd</File>
    <File>mtb-20260630_cal.xml</File>
    <File>mtb-20260630_def.xml</File>
    <File>mtb-20260630_lab.xml</File>
    <File>mtb-20260630_pre.xml</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="3362">http://fasb.org/us-gaap/2026</BaseTaxonomy>
    <BaseTaxonomy items="42">http://xbrl.sec.gov/dei/2026</BaseTaxonomy>
    <BaseTaxonomy items="11">http://xbrl.sec.gov/ecd/2026</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
