<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2026"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="banf-20260921.xsd" xlink:type="simple"/>
    <context id="C_9a96522f-8ee1-4024-a676-ddfdf02899f9">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000760498</identifier>
        </entity>
        <period>
            <startDate>2026-09-21</startDate>
            <endDate>2026-09-21</endDate>
        </period>
    </context>
    <dei:AmendmentFlag
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_e80b9f54-f508-424f-807c-3a80d67911b9">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_b1ca7f45-32e0-4554-a96f-79fcf75c8101">0000760498</dei:EntityCentralIndexKey>
    <dei:DocumentType
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_82840d3f-bacf-4828-8d07-e783d58bdda2">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_fc2ca5ea-3947-4eec-8b1d-e00ed1586aeb">2026-09-21</dei:DocumentPeriodEndDate>
    <dei:EntityRegistrantName
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_f1e04762-b4e3-4ae7-9a6a-7ce70dfd39bd">BancFirst Corporation</dei:EntityRegistrantName>
    <dei:EntityIncorporationStateCountryCode
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_df715f74-8729-4d0c-9194-f7f15fd9ea2c">OK</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_664959a6-2292-4419-8c14-4ef25a526e5e">0-14384</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_b55eb6db-47a0-4f7b-82dd-1507d6476fc8">73-1221379</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_e9abc43f-19bd-4d94-89d1-1f46769b7aa6">100 N. Broadway Ave.</dei:EntityAddressAddressLine1>
    <dei:EntityAddressCityOrTown
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_aa820b3b-b0d8-4d07-98fc-23c80dd15b1b">Oklahoma City</dei:EntityAddressCityOrTown>
    <dei:EntityAddressStateOrProvince
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_7cf123be-76bb-4d7d-b5dd-f79cd2d26d6d">OK</dei:EntityAddressStateOrProvince>
    <dei:EntityAddressPostalZipCode
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_089302ce-6f25-4e24-829d-e587dec2197f">73102-8405</dei:EntityAddressPostalZipCode>
    <dei:CityAreaCode
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_8d5b23fa-a914-44ca-8e86-5bff1d9047ab">405</dei:CityAreaCode>
    <dei:LocalPhoneNumber
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_53a08a4c-a142-4b2d-af6e-f1ad9db14bf7">270-1086</dei:LocalPhoneNumber>
    <dei:EntityInformationFormerLegalOrRegisteredName
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_73a6fda1-57f8-4d7b-a468-292650959e0c">None</dei:EntityInformationFormerLegalOrRegisteredName>
    <dei:WrittenCommunications
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_47329484-f86f-4317-8e60-6f3eac265fb0">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_8e73306f-5494-42ff-9ceb-da4a4f28e97a">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_0045643e-1a8b-44fe-9708-bbda2bad9b2c">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_a2fc7b4a-3f29-4355-ad15-b27dccc49d66">false</dei:PreCommencementIssuerTenderOffer>
    <dei:Security12bTitle
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_8434a335-dfb2-4adf-81d2-cbbd7d088913">Common Stock, $1.00 Par Value Per Share</dei:Security12bTitle>
    <dei:TradingSymbol
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_841cd5d2-31f8-452b-90a5-207e036f5cb2">BANF</dei:TradingSymbol>
    <dei:SecurityExchangeName
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_d96385e6-2d51-40a8-84dc-27d5e2e1ef20">NASDAQ</dei:SecurityExchangeName>
    <dei:EntityEmergingGrowthCompany
      contextRef="C_9a96522f-8ee1-4024-a676-ddfdf02899f9"
      id="F_1a8f0ba8-e2fa-4980-a2f8-6f19053f9840">false</dei:EntityEmergingGrowthCompany>
</xbrl>
