content: <?xml version="1.0" encoding="UTF-8"?><edgarSubmission xmlns="http://www.sec.gov/edgar/ownership" xmlns:com="http://www.sec.gov/edgar/common">
    <headerData>
      <submissionType>144</submissionType>
      <filerInfo>
        <filer>
          <filerCredentials>
            <cik>0001042873</cik>
            <ccc>XXXXXXXX</ccc>
          </filerCredentials>
        </filer>
        <liveTestFlag>LIVE</liveTestFlag>
  
  
  
      </filerInfo>
    </headerData>
    <formData>
      <issuerInfo>
        <issuerCik>0000760498</issuerCik>
        <issuerName>Bancfirst Corporation</issuerName>
        <secFileNumber>000-14384</secFileNumber>
        <issuerAddress>
          <com:street1>100 N BROADWAY AVE</com:street1>
          <com:city>OKLAHOMA CITY</com:city>
          <com:stateOrCountry>OK</com:stateOrCountry>
          <com:zipCode>73102</com:zipCode>
        </issuerAddress>
        <issuerContactPhone>4052701000</issuerContactPhone>
        <nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>RAINBOLT DAVID E</nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>
        <relationshipsToIssuer>
          <relationshipToIssuer>Officer</relationshipToIssuer>
          <relationshipToIssuer>Director</relationshipToIssuer>
          <relationshipToIssuer>10% Stockholder</relationshipToIssuer>
        </relationshipsToIssuer>
      </issuerInfo>
      <securitiesInformation>
        <securitiesClassTitle>Common Stock</securitiesClassTitle>
        <brokerOrMarketmakerDetails>
          <name>BancFirst Trust</name>
          <address>
            <com:street1>100 N. Broadway</com:street1>
            <com:city>Oklahoma City</com:city>
            <com:stateOrCountry>OK</com:stateOrCountry>
            <com:zipCode>73102</com:zipCode>
          </address>
        </brokerOrMarketmakerDetails>
        <noOfUnitsSold>90000</noOfUnitsSold>
        <aggregateMarketValue>9679500.00</aggregateMarketValue>
        <noOfUnitsOutstanding>33022124</noOfUnitsOutstanding>
        <approxSaleDate>08/28/2024</approxSaleDate>
        <securitiesExchangeName>Nasdaq Global Market</securitiesExchangeName>
      </securitiesInformation>
      <securitiesToBeSold>
        <securitiesClassTitle>Common Stock</securitiesClassTitle>
        <acquiredDate>12/31/2019</acquiredDate>
        <natureOfAcquisitionTransaction>Acquired shares from family partnership</natureOfAcquisitionTransaction>
        <nameOfPersonfromWhomAcquired>R. Banking Limited Partnership</nameOfPersonfromWhomAcquired>
        <isGiftTransaction>N</isGiftTransaction>
        <amountOfSecuritiesAcquired>5357500</amountOfSecuritiesAcquired>
        <paymentDate>12/31/2019</paymentDate>
        <natureOfPayment>NA</natureOfPayment>
      </securitiesToBeSold>
      <nothingToReportFlagOnSecuritiesSoldInPast3Months>Y</nothingToReportFlagOnSecuritiesSoldInPast3Months>
      <remarks>David E Rainbolt is trustee of three trust and they will sell 30,000 shares each. </remarks>
      <noticeSignature>
        <noticeDate>08/28/2024</noticeDate>
        <signature>By: POA from David E Rainbolt</signature>
      </noticeSignature>
    </formData>
  </edgarSubmission>
metadata_documents: [{"type": "144", "sequence": "1", "filename": "primary_doc.xml", "secsgml_size_bytes": 3020}]
text: 144
  0001042873
  XXXXXXXX
  LIVE
  0000760498
  Bancfirst Corporation
  000-14384
  100 N BROADWAY AVE
  OKLAHOMA CITY
  OK
  73102
  4052701000
  RAINBOLT DAVID E
  Officer
  Director
  10% Stockholder
  Common Stock
  BancFirst Trust
  100 N. Broadway
  Oklahoma City
  OK
  73102
  90000
  9679500.00
  33022124
  08/28/2024
  Nasdaq Global Market
  Common Stock
  12/31/2019
  Acquired shares from family partnership
  R. Banking Limited Partnership
  N
  5357500
  12/31/2019
  NA
  Y
  David E Rainbolt is trustee of three trust and they will sell 30,000 shares each.
  08/28/2024
  By: POA from David E Rainbolt